1name: linux 2 3on: [push, pull_request] 4 5permissions: 6 contents: read 7 8jobs: 9 build: 10 runs-on: ubuntu-20.04 11 strategy: 12 matrix: 13 cxx: [g++-4.8, g++-10, clang++-9] 14 build_type: [Debug, Release] 15 std: [11] 16 include: 17 - cxx: g++-4.8 18 install: sudo apt install g++-4.8 19 - cxx: g++-8 20 build_type: Debug 21 std: 14 22 install: sudo apt install g++-8 23 - cxx: g++-8 24 build_type: Debug 25 std: 17 26 install: sudo apt install g++-8 27 - cxx: g++-9 28 build_type: Debug 29 std: 17 30 - cxx: g++-10 31 build_type: Debug 32 std: 17 33 - cxx: g++-11 34 build_type: Debug 35 std: 20 36 install: sudo apt install g++-11 37 - cxx: clang++-8 38 build_type: Debug 39 std: 17 40 cxxflags: -stdlib=libc++ 41 install: sudo apt install clang-8 libc++-8-dev libc++abi-8-dev 42 - cxx: clang++-9 43 install: sudo apt install clang-9 44 - cxx: clang++-9 45 build_type: Debug 46 fuzz: -DFMT_FUZZ=ON -DFMT_FUZZ_LINKMAIN=ON 47 std: 17 48 install: sudo apt install clang-9 49 - cxx: clang++-11 50 build_type: Debug 51 std: 20 52 - cxx: clang++-11 53 build_type: Debug 54 std: 20 55 cxxflags: -stdlib=libc++ 56 install: sudo apt install libc++-11-dev libc++abi-11-dev 57 - shared: -DBUILD_SHARED_LIBS=ON 58 59 steps: 60 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 61 62 - name: Set timezone 63 run: sudo timedatectl set-timezone 'Asia/Yekaterinburg' 64 65 - name: Add repositories for older GCC 66 run: | 67 # Below two repos provide GCC 4.8, 5.5 and 6.4 68 sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic main' 69 sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic universe' 70 # Below two repos additionally update GCC 6 to 6.5 71 # sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates main' 72 # sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates universe' 73 if: ${{ matrix.cxx == 'g++-4.8' }} 74 75 - name: Add ubuntu mirrors 76 run: | 77 # Github Actions caching proxy is at times unreliable 78 # see https://github.com/actions/runner-images/issues/7048 79 printf 'http://azure.archive.ubuntu.com/ubuntu\tpriority:1\n' | sudo tee /etc/apt/mirrors.txt 80 curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt 81 sudo sed -i 's~http://azure.archive.ubuntu.com/ubuntu/~mirror+file:/etc/apt/mirrors.txt~' /etc/apt/sources.list 82 83 - name: Create Build Environment 84 run: | 85 sudo apt update 86 ${{matrix.install}} 87 sudo apt install locales-all 88 cmake -E make_directory ${{runner.workspace}}/build 89 90 - name: Configure 91 working-directory: ${{runner.workspace}}/build 92 env: 93 CXX: ${{matrix.cxx}} 94 CXXFLAGS: ${{matrix.cxxflags}} 95 run: | 96 cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.fuzz}} ${{matrix.shared}} \ 97 -DCMAKE_CXX_STANDARD=${{matrix.std}} -DFMT_DOC=OFF \ 98 -DCMAKE_CXX_VISIBILITY_PRESET=hidden -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON \ 99 -DFMT_PEDANTIC=ON -DFMT_WERROR=ON $GITHUB_WORKSPACE 100 101 - name: Build 102 working-directory: ${{runner.workspace}}/build 103 run: | 104 threads=`nproc` 105 cmake --build . --config ${{matrix.build_type}} --parallel $threads 106 107 - name: Test 108 working-directory: ${{runner.workspace}}/build 109 run: ctest -C ${{matrix.build_type}} 110 env: 111 CTEST_OUTPUT_ON_FAILURE: True 112