[pre-commit.ci] pre-commit autoupdate (#507) #2340
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: GPU Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: | |
| - labeled | |
| - opened | |
| - synchronize | |
| # Cancel the job if new commits are pushed | |
| # https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: flying-sheep/check@v1 | |
| with: | |
| success: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'run-gpu-ci') }} | |
| get-envs: | |
| runs-on: ubuntu-latest | |
| needs: check | |
| outputs: | |
| envs: ${{ steps.get-envs.outputs.envs }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| filter: blob:none | |
| fetch-depth: 0 | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: false | |
| - id: get-envs | |
| run: | | |
| ENVS_JSON=$(uvx hatch env show --json | jq -c ' | |
| to_entries | |
| | map( | |
| select(.key | startswith("hatch-test") and endswith("12")) | |
| | { | |
| name: .key, | |
| python: .value.python | sub("3[.]13"; "3.13.3"), | |
| } | |
| )') | |
| echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT | |
| test: | |
| needs: get-envs | |
| runs-on: cirun-aws-gpu | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| env: ${{ fromJson(needs.get-envs.outputs.envs) }} | |
| env: | |
| ENV_NAME: ${{ matrix.env.name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| filter: blob:none | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: ${{ matrix.env.python }} | |
| - name: Install dependencies | |
| run: uvx hatch -v env create ${{ matrix.env.name }} | |
| - name: Run tests | |
| run: uvx hatch run ${{ matrix.env.name }}:run | |
| remove-label: | |
| name: Remove 'run-gpu-ci' Label | |
| runs-on: ubuntu-latest | |
| if: ${{ always() && github.event_name == 'pull_request' }} | |
| steps: | |
| - uses: actions-ecosystem/action-remove-labels@v1 | |
| if: contains(github.event.pull_request.labels.*.name, 'run-gpu-ci') | |
| with: | |
| labels: 'run-gpu-ci' | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| all-green: | |
| name: All Tests Green | |
| if: always() | |
| needs: | |
| - get-envs | |
| - test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |