-
Notifications
You must be signed in to change notification settings - Fork 166
99 lines (86 loc) · 3.59 KB
/
cmake.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: BuildAndTest
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
build-test:
strategy:
matrix:
platform: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
build-type: [ "Release", "Debug" ]
# Extra cmake flags. GitHub Actions matrix overloads `include` to mean
# 'add extra things to a job' and 'add jobs'. You can add extra things
# to a job by specifying things that exist in a job created from the
# matrix definition and adding things. You can specify extra jobs by
# specifying properties that don't match existing jobs. We use
# `cmake-flags` to add cmake flags to all jobs matching a pattern and
# `extra-cmake-flags` to specify a new job with custom CMake flags.
extra-cmake-flags: [ "" ]
include:
- platform: "ubuntu-latest"
cmake-flags: "-G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
dependencies: "sudo apt install ninja-build"
- platform: "ubuntu-latest"
variant: "GCC"
cmake-flags: "-G Ninja"
dependencies: "sudo apt install ninja-build"
- platform: "ubuntu-latest"
variant: "asan"
build-type: "Release"
cmake-flags: "-G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
extra-cmake-flags: "-DVERONA_SANITIZER=address"
dependencies: "sudo apt install ninja-build"
- platform: "ubuntu-latest"
variant: "ubsan"
build-type: "Debug"
cmake-flags: "-G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
extra-cmake-flags: "-DVERONA_SANITIZER=undefined"
dependencies: "sudo apt install ninja-build"
fail-fast: false
runs-on: ${{matrix.platform}}
name: ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.variant }}
steps:
- uses: actions/checkout@v3
- uses: mjp41/workaround8649@c8550b715ccdc17f89c8d5c28d7a48eeff9c94a8
with:
os: ${{ matrix.platform }}
- name: Install build dependencies
run: ${{ matrix.dependencies }}
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ${{matrix.cmake-flags}} ${{matrix.extra-cmake-flags}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build-type}} --target install
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{matrix.build-type}} --output-on-failure --timeout 400 --interactive-debug-mode 0
# Job to run clang-format and report errors
format:
runs-on: ubuntu-22.04
# We don't need to do the build for this job, but we need to configure it to get the clang-format target
steps:
- uses: actions/checkout@v3
- name: Install clang-tidy and clang-format
run: |
sudo apt update
sudo apt install clang-tidy-15 clang-format-15
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build
# Run the clang-format check and error if it generates a diff
- name: Run clang-format
working-directory: ${{github.workspace}}/build
run: |
set -eo pipefail
make clangformat
git diff --exit-code
all-checks:
needs: [format, build-test]
runs-on: ubuntu-latest
steps:
- name: Dummy step
run: true