fix: do not use lazy properties or workspaces #1043
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python package | |
| env: | |
| PY_COLORS: "1" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: null | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12"] | |
| group: [1, 2, 3, 4] | |
| env: | |
| NUM_SPLITS: 4 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| fetch-tags: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install pytest pytest-codspeed pytest-randomly pytest-split pytest-retry | |
| python -m pip install . | |
| - name: Restore test durations | |
| uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| path: .test_durations | |
| key: test-durations-${{ github.ref }}-${{ github.sha }} | |
| restore-keys: | | |
| test-durations-${{ github.ref }}- | |
| test-durations- | |
| - name: Post-process test durations | |
| run: | | |
| if [[ -f .test_durations ]]; then | |
| cp .test_durations .test_durations.${{ matrix.group }} | |
| ls -lah .test_durations* | |
| echo " " | |
| cat .test_durations* | |
| fi | |
| - name: Test with pytest | |
| run: | | |
| pytest \ | |
| -vv \ | |
| --durations=100 \ | |
| --randomly-seed=42 \ | |
| --splits ${NUM_SPLITS} --group ${{ matrix.group }} \ | |
| --store-durations \ | |
| --durations-path=.test_durations.${{ matrix.group }} \ | |
| --splitting-algorithm least_duration \ | |
| --clean-durations \ | |
| --retries 1 | |
| - name: Test with pytest in float32 | |
| if: ${{ matrix.group == '1' }} | |
| run: | | |
| pytest \ | |
| -vv \ | |
| --test-in-float32 | |
| - name: Upload test durations | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: test-durations-${{ matrix.group }} | |
| path: .test_durations.${{ matrix.group }} | |
| include-hidden-files: true | |
| build-status: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download test duration artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| pattern: test-durations-* | |
| - name: Combine test durations | |
| run: | | |
| # see https://stackoverflow.com/a/71416016/1745538 | |
| jq 'reduce inputs as $i (.; . + $i)' test-durations-*/.test_durations.* > .test_durations | |
| - name: Save test durations | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: .test_durations | |
| key: test-durations-${{ github.ref }}-${{ github.sha }} | |
| - name: check status | |
| run: | | |
| echo "Builds all passed!" |