fmt/.github/workflows/linux.yml

112 lines
3.8 KiB
YAML
Raw Normal View History

2020-11-03 18:45:16 +00:00
name: linux
2020-11-04 00:01:26 +00:00
on: [push, pull_request]
2020-11-03 18:04:28 +00:00
permissions:
contents: read
2020-11-03 18:04:28 +00:00
jobs:
build:
runs-on: ubuntu-20.04
2020-11-03 19:41:25 +00:00
strategy:
matrix:
2021-04-01 15:24:55 +00:00
cxx: [g++-4.8, g++-10, clang++-9]
2020-11-03 20:16:15 +00:00
build_type: [Debug, Release]
2020-11-14 19:52:35 +00:00
std: [11]
2020-11-04 00:48:01 +00:00
include:
2020-11-14 19:52:35 +00:00
- cxx: g++-4.8
install: sudo apt install g++-4.8
- cxx: g++-8
build_type: Debug
2020-11-14 19:52:35 +00:00
std: 14
2021-04-01 15:24:55 +00:00
install: sudo apt install g++-8
- cxx: g++-8
build_type: Debug
std: 17
install: sudo apt install g++-8
- cxx: g++-9
build_type: Debug
std: 17
2020-11-14 19:52:35 +00:00
- cxx: g++-10
build_type: Debug
2020-11-14 19:52:35 +00:00
std: 17
- cxx: g++-11
build_type: Debug
std: 20
install: sudo apt install g++-11
- cxx: clang++-8
build_type: Debug
std: 17
cxxflags: -stdlib=libc++
install: sudo apt install clang-8 libc++-8-dev libc++abi-8-dev
- cxx: clang++-9
install: sudo apt install clang-9
- cxx: clang++-9
2020-11-04 00:48:01 +00:00
build_type: Debug
fuzz: -DFMT_FUZZ=ON -DFMT_FUZZ_LINKMAIN=ON
2020-11-14 19:52:35 +00:00
std: 17
install: sudo apt install clang-9
2021-04-08 00:18:13 +00:00
- cxx: clang++-11
build_type: Debug
std: 20
- cxx: clang++-11
build_type: Debug
std: 20
cxxflags: -stdlib=libc++
install: sudo apt install libc++-11-dev libc++abi-11-dev
- shared: -DBUILD_SHARED_LIBS=ON
2020-11-03 18:04:28 +00:00
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Set timezone
run: sudo timedatectl set-timezone 'Asia/Yekaterinburg'
- name: Add repositories for older GCC
run: |
# Below two repos provide GCC 4.8, 5.5 and 6.4
sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic main'
sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic universe'
# Below two repos additionally update GCC 6 to 6.5
# sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates main'
# sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates universe'
if: ${{ matrix.cxx == 'g++-4.8' }}
2020-11-03 18:04:28 +00:00
- name: Add ubuntu mirrors
run: |
# Github Actions caching proxy is at times unreliable
# see https://github.com/actions/runner-images/issues/7048
printf 'http://azure.archive.ubuntu.com/ubuntu\tpriority:1\n' | sudo tee /etc/apt/mirrors.txt
curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt
sudo sed -i 's~http://azure.archive.ubuntu.com/ubuntu/~mirror+file:/etc/apt/mirrors.txt~' /etc/apt/sources.list
2020-11-03 18:04:28 +00:00
- name: Create Build Environment
2020-11-04 00:48:01 +00:00
run: |
sudo apt update
2020-11-04 00:48:01 +00:00
${{matrix.install}}
2021-06-10 19:30:34 +00:00
sudo apt install locales-all
2020-11-04 00:48:01 +00:00
cmake -E make_directory ${{runner.workspace}}/build
2020-11-03 18:04:28 +00:00
2020-11-03 22:02:07 +00:00
- name: Configure
2020-11-03 18:04:28 +00:00
working-directory: ${{runner.workspace}}/build
2020-11-03 19:49:35 +00:00
env:
CXX: ${{matrix.cxx}}
CXXFLAGS: ${{matrix.cxxflags}}
2020-11-03 22:02:07 +00:00
run: |
cmake -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${{matrix.fuzz}} ${{matrix.shared}} \
2020-11-14 19:52:35 +00:00
-DCMAKE_CXX_STANDARD=${{matrix.std}} -DFMT_DOC=OFF \
-DCMAKE_CXX_VISIBILITY_PRESET=hidden -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON \
2020-11-14 19:52:35 +00:00
-DFMT_PEDANTIC=ON -DFMT_WERROR=ON $GITHUB_WORKSPACE
2020-11-03 18:04:28 +00:00
- name: Build
working-directory: ${{runner.workspace}}/build
run: |
threads=`nproc`
cmake --build . --config ${{matrix.build_type}} --parallel $threads
2020-11-03 18:04:28 +00:00
- name: Test
working-directory: ${{runner.workspace}}/build
2020-11-03 20:16:15 +00:00
run: ctest -C ${{matrix.build_type}}
env:
CTEST_OUTPUT_ON_FAILURE: True