Skip to content

workflows/release-binaries: Do a preliminary build to fill ccache #72576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

tstellar
Copy link
Collaborator

Build clang with the host compiler and ccache enabled in order to speed up the phase 1 builds. This helps reduce the amount of time spent running on the non-free builders.

Build clang with the host compiler and ccache enabled in order to speed
up the phase 1 builds.  This helps reduce the amount of time spent
running on the non-free builders.
@llvmbot
Copy link
Member

llvmbot commented Nov 16, 2023

@llvm/pr-subscribers-github-workflow

Author: Tom Stellard (tstellar)

Changes

Build clang with the host compiler and ccache enabled in order to speed up the phase 1 builds. This helps reduce the amount of time spent running on the non-free builders.


Full diff: https://github.com/llvm/llvm-project/pull/72576.diff

1 Files Affected:

  • (modified) .github/workflows/release-binaries.yml (+46-2)
diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml
index e52e52f5d3f36fa..75d4f419ab1fdc1 100644
--- a/.github/workflows/release-binaries.yml
+++ b/.github/workflows/release-binaries.yml
@@ -57,17 +57,52 @@ jobs:
         fi
         bash .github/workflows/set-release-binary-outputs.sh "${{ github.actor }}" "$tag" "$upload"
 
+  # Try to get around the 6 hour timeout by first running a job to fill
+  # the build cache.
+  fill-cache:
+    name: "Fill Cache ${{ matrix.os }}"
+    needs: prepare
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os:
+          - ubuntu-22.04
+    steps:
+    - name: Checkout LLVM
+      uses: actions/checkout@v4
+      with:
+        ref: ${{ inputs.tag || github.ref_name }}
+
+    - name: Install Ninja
+      uses: llvm/actions/install-ninja@main
+
+    - name: Setup sccache
+      uses: hendrikmuhs/ccache-action@v1
+      with:
+        max-size: 250M
+        key: sccache-${{ matrix.os }}-release
+        variant: sccache
+
+    - name: Build Clang
+      run: |
+        cmake -G Ninja  -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE=Release -DCMAKE_ENABLE_ASSERTIONS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DLLVM_ENABLE_PROJECTS=clang -S llvm -B build
+        ninja -v -C build
+
+
   build-binaries:
     name: ${{ matrix.target.triple }}
     permissions:
       contents: write # To upload assets to release.
-    needs: prepare
+    needs:
+      - prepare
+      - fill-cache
     runs-on: ${{ matrix.target.runs-on }}
     strategy:
       fail-fast: false
       matrix:
         target:
           - triple: x86_64-linux-gnu-ubuntu-22.04
+            os: ubuntu-22.04
             runs-on: ubuntu-22.04-16x64
             debian-build-deps: >
               chrpath
@@ -81,6 +116,14 @@ jobs:
         ref: ${{ needs.prepare.outputs.ref }}
         path: ${{ needs.prepare.outputs.build-dir }}/llvm-project
 
+    - name: Setup sccache
+      uses: hendrikmuhs/ccache-action@v1
+      with:
+        max-size: 250M
+        key: sccache-${{ matrix.target.os }}-release
+        save: false
+        variant: sccache
+
     - name: Install Brew build dependencies
       if: matrix.target.brew-build-deps != ''
       run: brew install ${{ matrix.target.brew-build-deps }}
@@ -102,7 +145,8 @@ jobs:
         -triple ${{ matrix.target.triple }} \
         -use-ninja \
         -no-checkout \
-        -no-test-suite
+        -no-test-suite \
+        -configure-flags "-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
 
     - name: Upload binaries
       if: ${{ always() && needs.prepare.outputs.upload == 'true' }}

Copy link
Collaborator

@tru tru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@tstellar tstellar merged commit e746b56 into llvm:main Nov 21, 2023
tru pushed a commit that referenced this pull request Nov 27, 2023
…2576)

Build clang with the host compiler and ccache enabled in order to speed
up the phase 1 builds. This helps reduce the amount of time spent
running on the non-free builders.

(cherry picked from commit e746b56)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants