From: Joel Rosdahl Date: Sun, 10 Aug 2025 08:56:19 +0000 (+0200) Subject: ci: Improve binary build jobs X-Git-Tag: v4.12~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d75b847bbb381ca841441498abae7c97e509f9a;p=thirdparty%2Fccache.git ci: Improve binary build jobs 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. --- diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c701c046..15ae6daf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 index 00000000..5ace2aad --- /dev/null +++ b/toolchains/aarch64-linux-gnu.cmake @@ -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)