From 3557adbadfc0a55c9adc9090c74eab8ddce69ba9 Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Thu, 13 Aug 2026 06:55:14 +0000 Subject: [PATCH 1/2] ci: trigger GPU tests with PR labels --- .github/workflows/ci.yml | 50 ---------------- .github/workflows/gpu-pr.yml | 113 ----------------------------------- .github/workflows/gpu.yml | 82 +++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 163 deletions(-) delete mode 100644 .github/workflows/gpu-pr.yml create mode 100644 .github/workflows/gpu.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7425310..292ebdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,53 +64,3 @@ jobs: - name: Test GPU infrastructure run: uv run pytest -q -m "not gpu" - - gpu-test: - if: github.event_name == 'push' - needs: build-and-test - concurrency: - group: gpu-ci - cancel-in-progress: false - runs-on: ubuntu-24.04 - timeout-minutes: 45 - - steps: - - uses: actions/checkout@v4 - - - name: Install LLVM ${{ env.LLVM_VERSION }} and MLIR - run: | - wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${LLVM_VERSION} main" - sudo apt-get update - sudo apt-get install -y \ - clang-${LLVM_VERSION} \ - llvm-${LLVM_VERSION}-dev \ - libmlir-${LLVM_VERSION}-dev \ - mlir-${LLVM_VERSION}-tools - - - uses: astral-sh/setup-uv@v4 - - - name: Install Python dependencies - run: uv sync - - - name: Configure - run: | - cmake -B build \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER=clang-${LLVM_VERSION} \ - -DCMAKE_CXX_COMPILER=clang++-${LLVM_VERSION} \ - -DMLIR_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/mlir \ - -DLLVM_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm - - - name: Build - run: cmake --build build - - - name: Run GPU tests on Vast.ai - env: - VASTAI_API_KEY: ${{ secrets.VASTAI_API_KEY }} - run: | - if [ -z "$VASTAI_API_KEY" ]; then - echo "VASTAI_API_KEY repository secret is not configured" >&2 - exit 1 - fi - uv run pytest -v -m gpu diff --git a/.github/workflows/gpu-pr.yml b/.github/workflows/gpu-pr.yml deleted file mode 100644 index d527209..0000000 --- a/.github/workflows/gpu-pr.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: GPU PR - -on: - issue_comment: - types: [created] - -permissions: - contents: read - pull-requests: read - statuses: write - -env: - LLVM_VERSION: "20" - -jobs: - authorize: - if: github.event.issue.pull_request && github.event.comment.body == '/gpu-test' && github.event.comment.author_association == 'OWNER' - runs-on: ubuntu-24.04 - outputs: - head-sha: ${{ steps.pr.outputs.head-sha }} - same-repository: ${{ steps.pr.outputs.same-repository }} - - steps: - - name: Resolve pull request head - id: pr - env: - GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ github.event.issue.number }} - run: | - head_repo=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" --jq '.head.repo.full_name') - head_sha=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}" --jq '.head.sha') - echo "head-sha=${head_sha}" >> "$GITHUB_OUTPUT" - if [ "$head_repo" = "$GITHUB_REPOSITORY" ]; then - echo "same-repository=true" >> "$GITHUB_OUTPUT" - else - echo "same-repository=false" >> "$GITHUB_OUTPUT" - fi - - gpu-test: - if: needs.authorize.outputs.same-repository == 'true' - needs: authorize - concurrency: - group: gpu-ci - cancel-in-progress: false - runs-on: ubuntu-24.04 - timeout-minutes: 45 - - steps: - - name: Mark GPU tests as running on the PR - env: - GH_TOKEN: ${{ github.token }} - HEAD_SHA: ${{ needs.authorize.outputs.head-sha }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - run: | - gh api --method POST "repos/${GITHUB_REPOSITORY}/statuses/${HEAD_SHA}" \ - -f state=pending \ - -f context='GPU tests' \ - -f target_url="$RUN_URL" - - - uses: actions/checkout@v4 - with: - ref: ${{ needs.authorize.outputs.head-sha }} - - - name: Install LLVM ${{ env.LLVM_VERSION }} and MLIR - run: | - wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc - sudo add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${LLVM_VERSION} main" - sudo apt-get update - sudo apt-get install -y \ - clang-${LLVM_VERSION} \ - llvm-${LLVM_VERSION}-dev \ - libmlir-${LLVM_VERSION}-dev \ - mlir-${LLVM_VERSION}-tools - - - uses: astral-sh/setup-uv@v4 - - - name: Install Python dependencies - run: uv sync - - - name: Configure - run: | - cmake -B build \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER=clang-${LLVM_VERSION} \ - -DCMAKE_CXX_COMPILER=clang++-${LLVM_VERSION} \ - -DMLIR_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/mlir \ - -DLLVM_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm - - - name: Build - run: cmake --build build - - - name: Run GPU tests on Vast.ai - env: - VASTAI_API_KEY: ${{ secrets.VASTAI_API_KEY }} - run: | - if [ -z "$VASTAI_API_KEY" ]; then - echo "VASTAI_API_KEY repository secret is not configured" >&2 - exit 1 - fi - uv run pytest -v -m gpu - - - name: Report GPU test result on the PR - if: always() - env: - GH_TOKEN: ${{ github.token }} - HEAD_SHA: ${{ needs.authorize.outputs.head-sha }} - STATE: ${{ job.status == 'success' && 'success' || 'failure' }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - run: | - gh api --method POST "repos/${GITHUB_REPOSITORY}/statuses/${HEAD_SHA}" \ - -f state="$STATE" \ - -f context='GPU tests' \ - -f target_url="$RUN_URL" diff --git a/.github/workflows/gpu.yml b/.github/workflows/gpu.yml new file mode 100644 index 0000000..0c74724 --- /dev/null +++ b/.github/workflows/gpu.yml @@ -0,0 +1,82 @@ +name: GPU + +on: + pull_request: + types: [labeled] + workflow_run: + workflows: [CI] + types: [completed] + branches: [canon] + +permissions: + contents: read + issues: write + +env: + LLVM_VERSION: "20" + +jobs: + gpu-test: + if: >- + (github.event_name == 'pull_request' && github.event.label.name == 'gpu-test' && + github.actor == github.repository_owner && github.triggering_actor == github.repository_owner && + github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'push' && + github.event.workflow_run.conclusion == 'success') + concurrency: + group: gpu-ci + cancel-in-progress: false + runs-on: ubuntu-24.04 + timeout-minutes: 45 + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} + + - name: Install LLVM ${{ env.LLVM_VERSION }} and MLIR + run: | + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc + sudo add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${LLVM_VERSION} main" + sudo apt-get update + sudo apt-get install -y \ + clang-${LLVM_VERSION} \ + llvm-${LLVM_VERSION}-dev \ + libmlir-${LLVM_VERSION}-dev \ + mlir-${LLVM_VERSION}-tools + + - uses: astral-sh/setup-uv@v4 + + - name: Install Python dependencies + run: uv sync + + - name: Configure + run: | + cmake -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER=clang-${LLVM_VERSION} \ + -DCMAKE_CXX_COMPILER=clang++-${LLVM_VERSION} \ + -DMLIR_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/mlir \ + -DLLVM_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm + + - name: Build + run: cmake --build build + + - name: Run GPU tests on Vast.ai + env: + VASTAI_API_KEY: ${{ secrets.VASTAI_API_KEY }} + run: | + if [ -z "$VASTAI_API_KEY" ]; then + echo "VASTAI_API_KEY repository secret is not configured" >&2 + exit 1 + fi + uv run pytest -v -m gpu + + - name: Remove GPU test trigger label + if: always() && github.event_name == 'pull_request' + env: + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + gh api --method DELETE \ + "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels/gpu-test" From 6269dfc73570166874c2770b72717ef9160f6db6 Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Thu, 13 Aug 2026 08:39:10 +0000 Subject: [PATCH 2/2] ci: allow GPU workflow to remove PR labels --- .github/workflows/gpu.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gpu.yml b/.github/workflows/gpu.yml index 0c74724..c92f159 100644 --- a/.github/workflows/gpu.yml +++ b/.github/workflows/gpu.yml @@ -11,6 +11,7 @@ on: permissions: contents: read issues: write + pull-requests: write env: LLVM_VERSION: "20"