From: Viktor Szépe Date: Sun, 26 Nov 2023 15:55:56 +0000 (+0100) Subject: ci: Split dependency installation step into two (#1359) X-Git-Tag: v4.9~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=335e0664456670dbff4fcdf9f757a3cab2826263;p=thirdparty%2Fccache.git ci: Split dependency installation step into two (#1359) --- diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c74e28f2e..db060f191 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -86,50 +86,52 @@ jobs: compiler: xcode version: "14.2" steps: - - name: Install dependencies + - name: Install dependencies on Linux + if: ${{ runner.os == 'Linux' }} run: | - if [ "${{ runner.os }}" = "Linux" ]; then - sudo apt-get update - - packages="elfutils libhiredis-dev libzstd-dev ninja-build pkg-config python3 redis-server redis-tools" - # Install ld.gold (binutils) and ld.lld (lld) on different runs. - if [ "${{ matrix.config.os }}" = "ubuntu-22.04" ]; then - sudo apt-get install -y $packages binutils - else - sudo apt-get install -y $packages lld - fi + sudo apt-get update - if [ "${{ matrix.config.compiler }}" = "gcc" ]; then - echo "CC=gcc-${{ matrix.config.version }}" >> $GITHUB_ENV - echo "CXX=g++-${{ matrix.config.version }}" >> $GITHUB_ENV - - sudo apt install -y g++-${{ matrix.config.version }} g++-${{ matrix.config.version }}-multilib - if [ "${{ matrix.config.version }}" = 8 ]; then - # The compilation test in StdFilesystem.cmake doesn't work when - # GCC 9 is installed as well, so need to force linking with - # libstdc++fs for GCC 8. Note: This requires using -fuse-ld=lld to - # work. - echo "LDFLAGS=-lstdc++fs" >> $GITHUB_ENV - fi - else - echo "CC=clang-${{ matrix.config.version }}" >> $GITHUB_ENV - echo "CXX=clang++-${{ matrix.config.version }}" >> $GITHUB_ENV - - sudo apt install -y clang-${{ matrix.config.version }} g++-multilib lld-${{ matrix.config.version }} - fi - elif [ "${{ runner.os }}" = "macOS" ]; then - HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 \ - brew install ninja pkg-config hiredis redis - - if [ "${{ matrix.config.compiler }}" = "gcc" ]; then - brew install gcc@${{ matrix.config.version }} - echo "CC=gcc-${{ matrix.config.version }}" >> $GITHUB_ENV - echo "CXX=g++-${{ matrix.config.version }}" >> $GITHUB_ENV - else - sudo xcode-select -switch /Applications/Xcode_${{ matrix.config.version }}.app - echo "CC=clang" >> $GITHUB_ENV - echo "CXX=clang++" >> $GITHUB_ENV + packages="elfutils libhiredis-dev libzstd-dev ninja-build pkg-config python3 redis-server redis-tools" + # Install ld.gold (binutils) and ld.lld (lld) on different runs. + if [ "${{ matrix.config.os }}" = "ubuntu-22.04" ]; then + sudo apt-get install -y $packages binutils + else + sudo apt-get install -y $packages lld + fi + + if [ "${{ matrix.config.compiler }}" = "gcc" ]; then + echo "CC=gcc-${{ matrix.config.version }}" >> $GITHUB_ENV + echo "CXX=g++-${{ matrix.config.version }}" >> $GITHUB_ENV + + sudo apt-get install -y g++-${{ matrix.config.version }} g++-${{ matrix.config.version }}-multilib + if [ "${{ matrix.config.version }}" = 8 ]; then + # The compilation test in StdFilesystem.cmake doesn't work when + # GCC 9 is installed as well, so need to force linking with + # libstdc++fs for GCC 8. Note: This requires using -fuse-ld=lld to + # work. + echo "LDFLAGS=-lstdc++fs" >> $GITHUB_ENV fi + else + echo "CC=clang-${{ matrix.config.version }}" >> $GITHUB_ENV + echo "CXX=clang++-${{ matrix.config.version }}" >> $GITHUB_ENV + + sudo apt-get install -y clang-${{ matrix.config.version }} g++-multilib lld-${{ matrix.config.version }} + fi + + - name: Install dependencies on macOS + if: ${{ runner.os == 'macOS' }} + run: | + HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 \ + brew install ninja pkg-config hiredis redis + + if [ "${{ matrix.config.compiler }}" = "gcc" ]; then + brew install gcc@${{ matrix.config.version }} + echo "CC=gcc-${{ matrix.config.version }}" >> $GITHUB_ENV + echo "CXX=g++-${{ matrix.config.version }}" >> $GITHUB_ENV + else + sudo xcode-select -switch /Applications/Xcode_${{ matrix.config.version }}.app + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV fi - name: Get source