|
| 1 | +# NOTE: Make sure this file is consistent with .gitlab/tests.yml |
| 2 | +name: E2E Example tests |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: ["pull-request/[0-9]+"] |
| 7 | + # NOTE: paths cannot be used since push happens to copied PR and only latest commit to PR is used |
| 8 | + schedule: |
| 9 | + - cron: "0 0 * * *" # Nightly |
| 10 | + workflow_dispatch: # On-demand |
| 11 | + |
| 12 | +# Cancel previous runs if new commit is pushed to the same PR |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ startsWith(github.ref, 'refs/heads/pull-request/') && github.ref || github.sha }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + check-file-changes: |
| 19 | + if: startsWith(github.ref, 'refs/heads/pull-request/') |
| 20 | + runs-on: ubuntu-latest |
| 21 | + outputs: |
| 22 | + any_changed: ${{ steps.changed-tests.outputs.any_changed }} |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + - id: get-pr-info |
| 28 | + uses: nv-gha-runners/get-pr-info@main |
| 29 | + # Get commit from main branch that is present in the PR to use as base for changed files |
| 30 | + - id: calculate-merge-base |
| 31 | + env: |
| 32 | + PR_SHA: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).head.sha }} |
| 33 | + BASE_SHA: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.sha }} |
| 34 | + run: | |
| 35 | + (echo -n "merge-base="; git merge-base "$BASE_SHA" "$PR_SHA") | tee --append "${GITHUB_OUTPUT}" |
| 36 | + - name: Check for changes in test-relevant directories |
| 37 | + id: changed-tests |
| 38 | + uses: step-security/[email protected] |
| 39 | + with: |
| 40 | + base_sha: ${{ steps.calculate-merge-base.outputs.merge-base }} |
| 41 | + sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).head.sha }} |
| 42 | + files: | |
| 43 | + .github/workflows/example_tests.yml |
| 44 | + examples/llm_ptq/** |
| 45 | + modelopt/torch/** |
| 46 | + tests/examples/llm_ptq/** |
| 47 | + setup.py |
| 48 | + fail_on_initial_diff_error: true |
| 49 | + wait-checks: |
| 50 | + needs: [check-file-changes] |
| 51 | + if: needs.check-file-changes.outputs.any_changed == 'true' |
| 52 | + uses: ./.github/workflows/_wait_for_checks.yml |
| 53 | + permissions: |
| 54 | + checks: read |
| 55 | + secrets: inherit |
| 56 | + with: |
| 57 | + match_pattern: '^DCO$|^linux$' # Wait for DCO and Unit tests / linux to pass |
| 58 | + delay: 300s |
| 59 | + example-tests-pr: |
| 60 | + needs: [check-file-changes, wait-checks] |
| 61 | + if: needs.check-file-changes.outputs.any_changed == 'true' |
| 62 | + # Runner list at https://github.com/nv-gha-runners/enterprise-runner-configuration/blob/main/docs/runner-groups.md |
| 63 | + runs-on: linux-amd64-gpu-h100-latest-1 |
| 64 | + timeout-minutes: 120 |
| 65 | + strategy: |
| 66 | + matrix: |
| 67 | + EXAMPLE: [llm_ptq] |
| 68 | + container: &example_container |
| 69 | + image: nvcr.io/nvidia/tensorrt-llm/release:1.1.0rc2.post2 |
| 70 | + env: |
| 71 | + LD_LIBRARY_PATH: "/usr/lib/x86_64-linux-gnu:/usr/local/tensorrt/targets/x86_64-linux-gnu/lib:${LD_LIBRARY_PATH}" |
| 72 | + # PATH: "/usr/local/tensorrt/targets/x86_64-linux-gnu/bin:${PATH}" |
| 73 | + PIP_CONSTRAINT: "" # Disable pip constraint for upgrading packages |
| 74 | + steps: &example_steps |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + - uses: nv-gha-runners/setup-proxy-cache@main |
| 77 | + - name: Run example tests |
| 78 | + run: | |
| 79 | + pip install ".[all,dev-test]" |
| 80 | + find examples/${{ matrix.EXAMPLE }} -name "requirements.txt" | while read req_file; do pip install -r "$req_file" || exit 1; done |
| 81 | + pytest -s tests/examples/${{ matrix.EXAMPLE }} |
| 82 | + example-tests-non-pr: |
| 83 | + if: ${{ !startsWith(github.ref, 'refs/heads/pull-request/') }} |
| 84 | + # Runner list at https://github.com/nv-gha-runners/enterprise-runner-configuration/blob/main/docs/runner-groups.md |
| 85 | + runs-on: linux-amd64-gpu-h100-latest-1 |
| 86 | + timeout-minutes: 120 |
| 87 | + strategy: |
| 88 | + matrix: |
| 89 | + EXAMPLE: [llm_ptq] |
| 90 | + container: *example_container |
| 91 | + steps: *example_steps |
| 92 | + example-pr-required-check: |
| 93 | + # Run even if example-tests-pr is skipped |
| 94 | + if: ${{ startsWith(github.ref, 'refs/heads/pull-request/') && always() }} |
| 95 | + needs: [check-file-changes, example-tests-pr] |
| 96 | + runs-on: ubuntu-latest |
| 97 | + steps: |
| 98 | + - name: Required GPU tests did not succeed |
| 99 | + if: ${{ needs.check-file-changes.result != 'success' || (needs.check-file-changes.outputs.any_changed == 'true' && needs.example-tests-pr.result != 'success') }} |
| 100 | + run: exit 1 |
0 commit comments