]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
ci: Improve binary build jobs
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 10 Aug 2025 08:56:19 +0000 (10:56 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 31 Aug 2025 08:30:48 +0000 (10:30 +0200)
For x86_64, build in an Alma Linux 8 container since RHEL 8 is the
oldest still active LTS mainstream Linux distribution to my knowledge.

For aarch64, cross compile in an x86_64 environment instead of in a
native aarch64 environment. This is because I want to be able to build
release binaries locally on my x86_64 machine if there is some problem
with the CI environment and it feels good to match that in CI. The build
is still on Ubuntu 22.04 – I made a quick attempt to get
cross-compilation working in Alma Linux 8 working but gave up.

.github/workflows/build.yaml
toolchains/aarch64-linux-gnu.cmake [new file with mode: 0644]

index c701c04659d94db1ae658eb38f0346fc72f01983..15ae6dafe9827e0d2a67fcc518dcb32d8b5801b6 100644 (file)
@@ -255,49 +255,85 @@ jobs:
           name: ${{ matrix.sys }}-${{ matrix.compiler }}-testdir.tar.xz
           path: testdir.tar.xz
 
-  build_macos_universal:
+  build_linux_aarch64_binary:
     timeout-minutes: 30
-    name: macOS universal binary
-    runs-on: macos-15
-    env:
-      CMAKE_GENERATOR: Ninja
+    name: Linux aarch64 binary
+    runs-on: ubuntu-22.04
+    strategy:
+      fail-fast: false
     steps:
+      - name: Prepare environment
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross
       - name: Get source
         uses: actions/checkout@v4
-      - name: Build macOS universal binary
-        run: ci/build-macos-binary
-      - name: Archive universal binary
+      - name: Build binary
+        env:
+          CMAKE_GENERATOR: Ninja
+          CMAKE_PARAMS: |
+            -D CMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu.cmake
+            -D CMAKE_EXE_LINKER_FLAGS_INIT=-static-libstdc++
+        run: ci/build-binary
+      - name: Upload binary
         uses: actions/upload-artifact@v4
         with:
-          name: macOS-binary
-          path: build_universal/ccache
+          name: linux-binary-aarch64
+          path: install/bin/ccache
 
-  build_linux_binary:
+  build_linux_x86_64_binary:
     timeout-minutes: 30
-    name: Linux ${{ matrix.arch }} binary
-    runs-on: ${{ matrix.os }}
+    name: Linux x86_64 binary
+    runs-on: ubuntu-22.04
+    container:
+      image: almalinux:8
     strategy:
       fail-fast: false
-      matrix:
-        include:
-          - os: ubuntu-22.04
-            arch: x86_64
-
-          - os: ubuntu-22.04-arm
-            arch: aarch64
+    steps:
+      - name: Prepare environment
+        run: |
+          dnf install -y dnf-plugins-core
+          dnf config-manager --set-enabled powertools
+          dnf install -y epel-release
+          dnf install -y \
+            --setopt=install_weak_deps=False \
+            --setopt=tsflags=nodocs \
+            cmake \
+            gcc \
+            gcc-c++ \
+            gcc-toolset-11 \
+            git \
+            ninja-build
+      - name: Get source
+        uses: actions/checkout@v4
+      - name: Build binary
+        env:
+          CMAKE_GENERATOR: Ninja
+          CMAKE_PARAMS: -D CMAKE_EXE_LINKER_FLAGS_INIT=-static-libstdc++
+        run: |
+          scl enable gcc-toolset-11 ci/build-binary
+      - name: Upload binary
+        uses: actions/upload-artifact@v4
+        with:
+          name: linux-binary-x86_64
+          path: install/bin/ccache
 
+  build_macos_universal:
+    timeout-minutes: 30
+    name: macOS universal binary
+    runs-on: macos-15
     env:
       CMAKE_GENERATOR: Ninja
     steps:
       - name: Get source
         uses: actions/checkout@v4
-      - name: Build binary
-        run: ci/build-binary
-      - name: Archive binary
+      - name: Build macOS universal binary
+        run: ci/build-macos-binary
+      - name: Archive universal binary
         uses: actions/upload-artifact@v4
         with:
-          name: linux-binary-${{ matrix.arch }}
-          path: install/bin/ccache
+          name: macOS-binary
+          path: build_universal/ccache
 
   build_windows_binary:
     timeout-minutes: 30
@@ -338,7 +374,7 @@ jobs:
         env:
           CMAKE_PARAMS: -D CMAKE_TOOLCHAIN_FILE=../toolchains/${{ matrix.toolchain }}.cmake
         run: ci/build-binary
-      - name: Archive binary
+      - name: Upload binary
         uses: actions/upload-artifact@v4
         with:
           name: windows-binary-${{ matrix.arch }}
diff --git a/toolchains/aarch64-linux-gnu.cmake b/toolchains/aarch64-linux-gnu.cmake
new file mode 100644 (file)
index 0000000..5ace2aa
--- /dev/null
@@ -0,0 +1,8 @@
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR aarch64)
+set(TOOLCHAIN_PREFIX aarch64-linux-gnu)
+set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
+set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)