-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (117 loc) · 3.67 KB
/
ccpp.yml
File metadata and controls
147 lines (117 loc) · 3.67 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: C/C++ CI
on: [push]
defaults:
run:
shell: bash
env:
# Use a recent stable vcpkg baseline from official Microsoft repo
VCPKG_COMMIT: de46587b4beaa638743916fe5674825cecfb48b3
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
MH_STUFF_COMPILE_LIBRARY: [true, false]
compiler:
# Modern compilers available on ubuntu-latest (Ubuntu 22.04/24.04)
- exe: g++-12
deps: g++-12
- exe: g++-13
deps: g++-13
- exe: clang++-14
deps: clang-14 libc++-14-dev libc++abi-14-dev
- exe: clang++-15
deps: clang-15 libc++-15-dev libc++abi-15-dev
steps:
- uses: actions/checkout@v4
- uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }}
- name: Install compilers and tools
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.compiler.deps }} ninja-build
pip3 install gcovr
echo "Ensuring programs work..."
${{ matrix.compiler.exe }} --version
ninja --version
gcovr --version
# - name: Run tests
# working-directory: ./test
# run: make -j`grep -c ^processor /proc/cpuinfo` ${{ matrix.compiler }}_test_output.txt
- name: Build
env:
CXX: ${{ matrix.compiler.exe }}
CXXFLAGS: -Wall -Wpedantic -Wextra -Werror
run: |
mkdir build
cd build
cmake --version
cmake -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
-DMH_STUFF_COMPILE_LIBRARY=${{ matrix.MH_STUFF_COMPILE_LIBRARY }} \
../
cmake --build .
- name: Run tests
env:
CXX: ${{ matrix.compiler.exe }}
run: |
cd build
ctest --version
ctest --output-on-failure
gcovr --version
gcovr --root "../" --exclude ".*/catch.hpp" --exclude ".*/test_compile_file/.*" --exclude ".*/test/.*" --sort-percentage --html-details "results_${{ matrix.compiler.exe }}.html" .
- name: Save test results
if: ${{ matrix.MH_STUFF_COMPILE_LIBRARY }}
uses: actions/upload-artifact@v4
with:
name: gcovr_results_${{ matrix.compiler.exe }}
path: build/results*.html
# build-windows:
# runs-on: windows-latest
# strategy:
# fail-fast: false
# matrix:
# MH_STUFF_COMPILE_LIBRARY: [true, false]
# steps:
# - uses: actions/checkout@v4
# - uses: lukka/run-vcpkg@v11
# with:
# vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }}
# - uses: seanmiddleditch/gha-setup-ninja@v5
# - name: Setup compiler paths
# uses: ilammy/msvc-dev-cmd@v1
# - name: Build
# run: |
# mkdir build
# cd build
# cmake -G Ninja \
# -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
# -DMH_STUFF_COMPILE_LIBRARY=${{ matrix.MH_STUFF_COMPILE_LIBRARY }} \
# ../
# cmake --build .
# - name: Run tests
# run: |
# cd build
# ctest --output-on-failure
# registry-update:
# needs: [build-linux]
# runs-on: ubuntu-latest
# steps:
# - uses: PazerOP/vcpkg-registry-update@HEAD
# with:
# port-name: mh-stuff
# workflow-pat: ${{ secrets.WORKFLOW_PAT }}
all-checks-passed:
if: always()
needs: [build-linux]
runs-on: ubuntu-latest
steps:
- name: Verify all checks passed
run: |
if [[ "${{ needs.build-linux.result }}" != "success" ]]; then
echo "build-linux failed: ${{ needs.build-linux.result }}"
exit 1
fi
echo "All checks passed!"