[llvm] [Github][RFC] Add workflow to diff codegen on llvm-test-suite (PR #190010)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 09:29:02 PDT 2026
================
@@ -0,0 +1,115 @@
+# When /test-suite is commented on a PR, checks out the PR, builds clang and
+# then the test-suite in several configurations. It then checks out the base of
+# the PR, builds clang and the test-suite again, and then uploads the diff of
+# the codegen.
+
+name: Diff test-suite codegen
+
+on:
+ issue_comment:
+ types:
+ - created
+
+permissions:
+ contents: read
+
+jobs:
+ test-suite:
+ name: Build test-suite and diff
+ runs-on: ubuntu-24.04
+ container:
+ image: ghcr.io/llvm/ci-ubuntu-24.04:latest
+ if: github.event.issue.pull_request && startswith(github.event.comment.body, '/test-suite')
+ steps:
+ - name: Get pull request
+ id: get-pr
+ uses: actions/github-script at ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
+ with:
+ script: |
+ const { data: pr } = await github.rest.pulls.get({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: context.payload.issue.number
+ })
+ return pr
+ - name: Check pull request is mergeable
+ if: ${{ !fromJSON(steps.get-pr.outputs.result).mergeable }}
+ run: |
+ echo "Unable to diff test-suite with PR, PR isn't mergeable" >> comments
+ exit 1
+ - name: Checkout pull request
+ uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ ref: ${{ fromJSON(steps.get-pr.outputs.result).merge_commit_sha }}
+ repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}
+ fetch-depth: 2
+ path: llvm-project
+ persist-credentials: false
+ - name: Checkout llvm/llvm-test-suite
+ uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
+ with:
+ repository: llvm/llvm-test-suite
+ path: llvm-test-suite
+ persist-credentials: false
+ - name: Setup environment variables
+ run: |
+ echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
+ echo "BASE_SHA=$(git rev-parse HEAD^)" >> $GITHUB_ENV
+ SCRIPTS_DIR="$GITHUB_WORKSPACE/llvm-project/.github/workflows/test-suite"
+ echo "SCRIPTS_DIR=$SCRIPTS_DIR" >> $GITHUB_ENV
+ echo "$SCRIPTS_DIR" >> $GITHUB_PATH
+ echo "$GITHUB_WORKSPACE/llvm-project/build/bin" >> $GITHUB_PATH
+ working-directory: llvm-project
+ - name: Install system dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y cmake ninja-build libc6-dev-arm64-cross libc6-dev-riscv64-cross libgcc-14-dev-arm64-cross libgcc-14-dev-riscv64-cross libstdc++-14-dev-arm64-cross libstdc++-14-dev-riscv64-cross
+ - name: Configure Clang
+ run: cmake -B build -C $SCRIPTS_DIR/llvm.cmake llvm -GNinja
+ working-directory: llvm-project
+ - name: Build Clang @ head
+ run: ninja -C build
+ working-directory: llvm-project
+ - name: Configure and build test-suite @ head
+ run: |
+ configure-and-build.sh rva23u64-O3-head $SCRIPTS_DIR/riscv64.cmake
+ configure-and-build.sh armv9-a-O3-head $SCRIPTS_DIR/aarch64.cmake
+ configure-and-build.sh x86_64-O3-head $SCRIPTS_DIR/x86_64.cmake
+ working-directory: llvm-test-suite
+ - name: Build test-suite @ base
+ run: git checkout $BASE_SHA && ninja -C build
+ working-directory: llvm-project
+ - name: Configure and build test-suite @ base
+ run: |
+ configure-and-build.sh rva23u64-O3-base $SCRIPTS_DIR/riscv64.cmake
+ configure-and-build.sh armv9-a-O3-base $SCRIPTS_DIR/aarch64.cmake
+ configure-and-build.sh x86_64-O3-base $SCRIPTS_DIR/x86_64.cmake
+ working-directory: llvm-test-suite
+ - name: Compute diffs
+ run: |
+ mkdir diffs
+ ./utils/tdiff.py -a build.rva23u64-O3-base -b build.rva23u64-O3-head -s all > diffs/rva23u64-O3.diff || true
+ ./utils/tdiff.py -a build.armv9-a-O3-base -b build.armv9-a-O3-head -s all > diffs/armv9-a-O3.diff || true
+ ./utils/tdiff.py -a build.x86_64-O3-base -b build.x86_64-O3-head -s all > diffs/x86_64-O3.diff || true
+ working-directory: llvm-test-suite
+ - name: Upload diffs
+ uses: actions/upload-artifact at bbbca2ddaa5d8feaa63e36b76fdaad77386f024f #v7.0.0
+ id: upload-diffs
+ with:
+ name: diffs
+ path: llvm-test-suite/diffs
+ - name: Upload results
+ uses: actions/upload-artifact at bbbca2ddaa5d8feaa63e36b76fdaad77386f024f #v7.0.0
+ with:
+ name: results
+ path: llvm-test-suite/results*.json
+ - name: Create comment
+ run: |
+ echo "test-suite diff from $BASE_SHA...$HEAD_SHA: ${{ steps.upload-diffs.outputs.artifact-url }} >> comments
----------------
github-advanced-security[bot] wrote:
code injection via template expansion
[Show more details](https://github.com/llvm/llvm-project/security/code-scanning/1792)
https://github.com/llvm/llvm-project/pull/190010
More information about the llvm-commits
mailing list