-
-
Notifications
You must be signed in to change notification settings - Fork 90
264 lines (218 loc) · 7.11 KB
/
cpp.yml
File metadata and controls
264 lines (218 loc) · 7.11 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
name: C++
on:
push:
branches: [main]
pull_request:
env:
CABIN_TERM_COLOR: always
permissions:
contents: read
jobs:
build-and-test:
name: "build & test (${{ matrix.cxx.name }} - ${{ matrix.build }}${{ matrix.coverage && ' - coverage' || '' }})"
runs-on: ${{ matrix.cxx.os }}
strategy:
fail-fast: false
matrix:
build: [dev, release]
coverage: [false]
cxx:
- name: "Linux - Clang 16"
cmd: clang++-16
os: ubuntu-24.04
- name: "Linux - Clang 17"
cmd: clang++-17
os: ubuntu-24.04
- name: "Linux - Clang 18"
cmd: clang++-18
os: ubuntu-24.04
- name: "Linux - Clang 19"
cmd: clang++-19
os: ubuntu-24.04
- name: "Linux - Clang 20"
cmd: clang++-20
os: ubuntu-24.04
- name: "Linux - GCC 12"
cmd: g++-12
os: ubuntu-24.04
- name: "Linux - GCC 13"
cmd: g++-13
os: ubuntu-24.04
- name: "Linux - GCC 14"
cmd: g++-14
os: ubuntu-24.04
- name: "macOS 13 - Apple Clang"
cmd: c++
os: macos-13
- name: "macOS 14 - Apple Clang"
cmd: c++
os: macos-14
- name: "macOS 15 - Apple Clang"
cmd: c++
os: macos-15
include:
# Coverage testing with GCC 14
- build: dev
coverage: true
cxx:
name: "Linux - GCC 14"
cmd: g++-14
os: ubuntu-24.04
env:
CXX: ${{ matrix.cxx.cmd }}
steps:
- uses: actions/checkout@v4
- name: Setup Clang
if: matrix.cxx.cmd == 'clang++-19' || matrix.cxx.cmd == 'clang++-20'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh "${CXX##*-}"
- name: Setup Ubuntu dependencies
if: runner.os == 'Linux'
uses: ./.github/actions/setup-ubuntu-deps
- name: Install lcov
if: matrix.coverage
run: sudo apt-get install -y lcov
- name: Setup macOS dependencies
if: runner.os == 'macOS'
uses: ./.github/actions/setup-macos-deps
- name: Setup Sharness
run: |
wget https://raw.githubusercontent.com/felipec/sharness/refs/tags/v1.2.1/sharness.sh
wget https://raw.githubusercontent.com/felipec/sharness/refs/tags/v1.2.1/lib-sharness/functions.sh
mv sharness.sh tests/
mkdir tests/lib-sharness
mv functions.sh tests/lib-sharness/
- name: Print versions
run: make versions
- name: Stage 1 - Build
run: make BUILD=${{ matrix.build }} -j4
- name: Stage 1 - Print version
run: ./build/cabin version --verbose
- name: Stage 1 - Test
run: make BUILD=${{ matrix.build }} test -j4
- name: Stage 1 - Integration Test
run: find tests -maxdepth 1 -name '[0-9]*.sh' -print0 | xargs -0 -I {} sh -c 'sh {} -v'
env:
CABIN_TERM_COLOR: auto
- name: Stage 2 - Build & Test
run: |
[[ '${{ matrix.build }}' == 'release' ]] && RELEASE='--release'
[[ '${{ matrix.coverage }}' == 'true' ]] && COVERAGE='--coverage'
# shellcheck disable=SC2086
./build/cabin --verbose run $RELEASE test --verbose $COVERAGE
- name: Stage 2 - Print version
run: ./cabin-out/${{ matrix.build }}/cabin version --verbose
- name: Stage 2 - Integration Test
run: find tests -maxdepth 1 -name '[0-9]*.sh' -print0 | xargs -0 -I {} sh -c 'sh {} -v'
env:
CABIN: ${{ github.workspace }}/cabin-out/${{ matrix.build }}/cabin
CABIN_TERM_COLOR: auto
- name: Print coverage
if: success() && matrix.coverage
run: |
lcov --capture --directory . --no-external \
--gcov-tool "gcov-${CXX##*-}" \
--output-file coverage.info
lcov --list coverage.info
package-test:
needs: build-and-test
runs-on: ubuntu-24.04
env:
CXX: g++-14
steps:
- uses: actions/checkout@v4
- name: Setup Ubuntu dependencies
uses: ./.github/actions/setup-ubuntu-deps
- name: Build cabin
run: make BUILD=release -j4
- name: Install nFPM
run: |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt-get update
sudo apt-get install -y nfpm
- name: Test DEB package creation
run: nfpm pkg --packager deb
env:
CABIN_VERSION: 0.0.0+${{ github.sha }}
- name: Test RPM package creation
run: nfpm pkg --packager rpm
env:
CABIN_VERSION: 0.0.0+${{ github.sha }}
- name: List created packages
run: ls -la ./*.deb ./*.rpm
- name: Verify package contents
run: |
dpkg-deb --contents ./*.deb | grep '/usr/bin/cabin'
rpm -qlp ./*.rpm | grep '/usr/bin/cabin'
- name: Test DEB package installation
run: sudo dpkg -i ./*.deb
- name: Create test project
run: cabin new test_pj
working-directory: ${{ runner.temp }}
- name: Test cabin functionality
run: cabin run | grep 'Hello, world!'
working-directory: ${{ runner.temp }}/test_pj
format:
needs: build-and-test
runs-on: ubuntu-24.04
env:
CXX: clang++-18
steps:
- uses: actions/checkout@v4
- name: Setup dependencies
uses: ./.github/actions/setup-ubuntu-deps
- name: Build Cabin
run: make BUILD=release -j4
- name: Install clang-format-20
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 20
sudo apt-get install -y clang-format-20
- name: cabin fmt
run: ./build/cabin fmt --check --verbose
env:
CABIN_FMT: clang-format-20
lint:
needs: build-and-test
runs-on: ubuntu-24.04
env:
CXX: clang++-18
steps:
- uses: actions/checkout@v4
- name: Setup dependencies
uses: ./.github/actions/setup-ubuntu-deps
- name: Build Cabin
run: make BUILD=release -j4
- uses: actions/setup-python@v5
with:
python-version: '3.*'
- name: Install cpplint
run: pip install cpplint
- name: Show cpplint version
run: cpplint --version
- name: cabin lint
run: ./build/cabin lint --verbose
clang-tidy:
needs: build-and-test
runs-on: ubuntu-24.04
env:
CXX: clang++-18
steps:
- uses: actions/checkout@v4
- name: Setup dependencies
uses: ./.github/actions/setup-ubuntu-deps
- name: Build Cabin
run: make BUILD=release -j4
- name: Install clang-tidy-20
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 20
sudo apt-get install -y clang-tidy-20
- name: cabin tidy
run: ./build/cabin tidy --verbose
env:
CABIN_TIDY: clang-tidy-20