-
Notifications
You must be signed in to change notification settings - Fork 5
75 lines (70 loc) · 2.98 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Tests
on: [push]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: docker build --tag caracal .
- name: Test Docker image
run: docker run caracal --help
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: cachix/cachix-action@v12
with:
name: ${{ secrets.CACHIX_NAME }}
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build flake
run: nix build
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.conan/data
key: ${{ runner.os }}-x86_64
- name: Install dependencies
run: |
sudo apt update
sudo apt install --yes build-essential cmake gcovr ninja-build python3-pip
pip3 install "conan<2.0"
- name: Configure project
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON
- name: Build tests
run: cmake --build build --target caracal-test
- name: Run tests
run: sudo --preserve-env=CI build/caracal-test --benchmark-warmup-time 0 --benchmark-samples 1
- name: Compute coverage
run: gcovr --exclude-unreachable-branches --exclude-throw-branches --exclude apps --exclude extern --exclude tests --output coverage.xml --xml
- uses: codecov/codecov-action@v3
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.conan/data
key: ${{ runner.os }}-x86_64
- name: Install dependencies
run: brew install cmake gcovr ninja
- name: Install Conan
run: pip3 install "conan<2.0"
- name: Configure project (try 1/2)
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON
continue-on-error: true
# For some unknown reasons bison fails to build on GitHub macOS 12 runners.
# However, if we call conan twice, it seems to work...¯\(◉‿◉)/¯
- name: Configure project (try 2/2)
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON
- name: Build tests
run: cmake --build build --target caracal-test
- name: Run tests
run: sudo --preserve-env=CI build/caracal-test --benchmark-warmup-time 0 --benchmark-samples 1
- name: Compute coverage
run: gcovr --exclude-unreachable-branches --exclude-throw-branches --exclude apps --exclude extern --exclude tests --output coverage.xml --xml
- uses: codecov/codecov-action@v3