๐๐จ Set up clang using llvm apt script #131
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [push, pull_request, workflow_dispatch] | |
env: | |
BUILD_TYPE: RelWithDebInfo | |
jobs: | |
build-test: | |
name: Tests (${{ matrix.compiler }} C++${{ matrix.std }} Coverage-${{ matrix.coverage }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [ GCC, Clang ] | |
coverage: [ OFF, ON ] | |
std: [20, 23] | |
exclude: | |
- coverage: ON | |
include: | |
- compiler: Clang | |
version: 15 | |
- compiler: GCC | |
version: latest | |
- std: 20 | |
test_with_cxx23: OFF | |
- std: 23 | |
test_with_cxx23: ON | |
- compiler: Clang | |
std: 23 | |
version: 15 | |
test_with_cxx23: ON | |
coverage: ON | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Clang | |
if: matrix.compiler == 'Clang' | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x ./llvm.sh | |
sudo ./llvm.sh ${{ matrix.version }} | |
sudo ln -f -s /usr/bin/clang /usr/local/bin/cc | |
sudo ln -f -s /usr/bin/clang++ /usr/local/bin/c++ | |
- name: Set up GCC | |
if: matrix.compiler == 'GCC' | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: ${{ matrix.version }} | |
cc: 1 | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCODE_COVERAGE=${{ matrix.coverage }} -DTEST_WITH_CXX23=${{ matrix.test_with_cxx23 }} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --parallel --config ${{env.BUILD_TYPE}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Coverage processing seems to be broken when run through ctest | |
# run: ctest -C ${{env.BUILD_TYPE}} | |
run: ./mays_tests --colour-mode ansi | |
- name: Process coverage data | |
if: matrix.coverage == 'ON' | |
working-directory: ${{github.workspace}}/build | |
run: | | |
llvm-profdata-${{ matrix.version }} merge -sparse default.profraw -o coverage.profdata | |
llvm-cov-${{ matrix.version }} show ./mays_tests -instr-profile=coverage.profdata > coverage.txt | |
- name: Upload coverage data to Codecov | |
uses: codecov/codecov-action@v2 | |
if: matrix.coverage == 'ON' | |
with: | |
files: ${{github.workspace}}/build/coverage.txt |