[llvm] [workflows] Port buildkite Windows config to GitHub actions (PR #82093)

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 11:00:42 PDT 2024


================
@@ -0,0 +1,198 @@
+name: "Windows Precommit Tests"
+
+permissions:
+  contents: read
+
+on:
+  pull_request:
+    branches:
+      - main
+
+concurrency:
+  # Skip intermediate builds: always.
+  # Cancel intermediate builds: only if it is a pull request build.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
+
+jobs:
+  compute-projects:
+    name: "Compute Projects to Test"
+    runs-on: ubuntu-22.04
+    outputs:
+      projects: ${{ steps.vars.outputs.projects }}
+      check-targets: ${{ steps.vars.outputs.check-targets }}
+      test-build: ${{ steps.vars.outputs.check-targets != '' }}
+    steps:
+      - name: Fetch LLVM sources
+        uses: actions/checkout at v4
+        with:
+          fetch-depth: 2
+
+      - name: Compute projects to test
+        id: vars
+        uses: ./.github/workflows/compute-projects-to-test
+
+  build-windows-part1:
+    name: "Build LLVM/Clang"
+    runs-on: windows-2022
+    needs:
+      - compute-projects
+    if: ${{ needs.compute-projects.outputs.test-build == 'true' }}
+    steps:
+      - name: Setup Windows
+        uses: llvm/actions/setup-windows at main
+        with:
+          arch: amd64
+
+      - name: Fetch LLVM sources
+        uses: actions/checkout at v4
+
+      - name: Setup sccache
+        uses: hendrikmuhs/ccache-action at v1
+        with:
+          max-size: 2G
+          variant: sccache
+          key: precommit-windows
+
+      - name: Restore sccache from previous PR run
+        uses: ./.github/workflows/pr-sccache-restore
+
+      - name: Compute projects to test
+        id: compute-projects
+        uses: ./.github/workflows/compute-projects-to-test
+
+      - name: Configure LLVM
+        shell: bash
+        run: |
+          cmake -B build -GNinja \
+            -DCMAKE_BUILD_TYPE=Release \
+            -DLLVM_ENABLE_PROJECTS="${{ needs.compute-projects.outputs.projects }}" \
+            -DLLVM_ENABLE_ASSERTIONS=ON \
+            -DLLVM_LIT_ARGS="-v --no-progress-bar" \
+            -DCMAKE_C_COMPILER_LAUNCHER=sccache \
+            -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
+            -S llvm
+
+      - name: Build
+        shell: bash
+        run: |
+          targets="llc"
+          if echo "${{ needs.compute-projects.outputs.check-targets }}" | grep clang; then
+            targets="$targets clang"
+          fi
+          ninja -C build $targets
+
+      - name: Save sccache for next PR run
+        if: always()
+        uses: ./.github/workflows/pr-sccache-save
+
+      - name: Package Build Directory
+        shell: bash
+        run: |
+          tar -c . | zstd -T0 -c > ../llvm-project.tar.zst
+          mv ../llvm-project.tar.zst .
+
+      - name: Upload Build
+        uses: actions/upload-artifact at 26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
+        with:
+          name: part1
+          path: llvm-project.tar.zst
+          retention-days: 2
+
+  build-windows-part2:
+    name: "Build All"
+    needs:
+      - build-windows-part1
+    runs-on: windows-2022
+    steps:
+      - name: Setup Windows
+        uses: llvm/actions/setup-windows at main
+        with:
+          arch: amd64
+
+      - name: Setup ccache
+        uses: hendrikmuhs/ccache-action at v1
+        with:
+          max-size: 2G
+          variant: sccache
+          key: precommit-windows
+          # The llvm-project.zip archive contains the sccache directory from
+          # part 1, so we don't need to restore the cache.
+          restore: false
+
+      - name: Download Artifact
+        uses: actions/download-artifact at 6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
+        with:
+          pattern: part1
+
+      - name: Unpack Artifact
+        shell: bash
+        run: |
+          tar --zstd -xf llvm-project.tar.zst
+          rm llvm-project.tar.zst
+
+      - name: Build
+        shell: bash
+        run: |
+          ls
+          ninja -C build
----------------
tstellar wrote:

Think about this more, I think I have a better idea for working around the timeouts. I'm going to try something else.

https://github.com/llvm/llvm-project/pull/82093


More information about the llvm-commits mailing list