-
-
Notifications
You must be signed in to change notification settings - Fork 267
374 lines (322 loc) · 12.8 KB
/
ci.yml
File metadata and controls
374 lines (322 loc) · 12.8 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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# =========================================================================
# Ceedling - Test-Centered Build System for C
# ThrowTheSwitch.org
# Copyright (c) 2010-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
# -----------------------------------------------------------------------
# Continuous Integration Workflow
#
# Purpose:
# Run the full test suite and verify a clean gem build on every push.
# No releases are created here — publishing is handled by prerelease.yml
# and release.yml, which trigger only on intentional Git tags.
#
# Triggers:
# - Push to any branch
# - Pull request targeting master
# - Manual dispatch (workflow_dispatch)
#
# Skip-CI:
# Add any of the following to your commit message to skip this workflow:
# [skip ci] [ci skip] [no ci] [skip actions] [actions skip]
# Note: skip keywords have no effect on workflow_dispatch runs.
#
# Branch exclusions:
# To permanently exclude a branch pattern from CI, add a branches-ignore
# list under the push: trigger below (e.g. docs/**, wip/**).
# -----------------------------------------------------------------------
---
name: CI
# Triggers the workflow on push to any branch (tag pushes excluded — handled by
# prerelease.yml and release.yml), pull requests targeting master, or manual dispatch
on:
push:
branches:
- '**' # All branches; branches: ['**'] scopes push to refs/heads/ only,
# excluding refs/tags/ pushes — see Skip-CI above
pull_request:
branches: [master]
workflow_dispatch:
# Cancel any in-progress run on the same ref when a new push arrives,
# preventing stale run pile-up on active branches
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Job: Build MkDocs HTML documentation bundle for gem inclusion
generate-docs:
name: "Generate Local Docs Bundle for Gem Inclusion"
uses: ./.github/workflows/_generate-docs.yml
# Job: Linux unit test suite
tests-linux:
name: "Linux Test Suite"
needs: generate-docs
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']
steps:
# Use a cache for our tools to speed up testing
- uses: actions/cache@v4
with:
path: vendor/bundle
key: bundle-use-ruby-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
bundle-use-ruby-${{ runner.os }}-${{ matrix.ruby }}-
# Checks out repository under $GITHUB_WORKSPACE
- name: Checkout Latest Repo
uses: actions/checkout@v4
with:
submodules: recursive
# Set up Ruby to run test & build steps on multiple ruby versions
# This action installs Ruby and the Bundler gem using the version captured in Gemfile.lock
- name: Set Up Ruby with Version Matrix
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
# Workaround: Fix Ruby toolcache Gem directory permissions (Bundler exit 38)
# This is an environmental Ruby/toolcache issue, not a Bundler issue; the fix must
# run after setup-ruby (which populates the toolcache) but before bundle install.
# Issue: https://github.com/rubygems/rubygems/issues/7983
- name: Apply Workaround for Ruby toolcache Gem Directory Permissions
run: |
sudo chmod -R go-w /opt/hostedtoolcache/Ruby/**/**/lib/ruby/gems/**/gems || true
# Install Gem Dependencies
- name: Install Gem Dependencies
# Ensure local installation to prevent system directory permission problems
run: |
bundle install
# Install gdb for backtrace feature testing
- name: Install gdb for Backtrace Feature Testing
run: |
sudo apt-get update -qq
sudo apt-get install --assume-yes --quiet gdb
# Install valgrind for Valgrind plugin testing
- name: Install valgrind for Valgrind Feature Testing
run: |
sudo apt-get update -qq
sudo apt-get install --assume-yes --quiet valgrind
# Build cppcheck from source at a pinned version so all plugin options
# (including SARIF, which requires 2.16+) are available for testing.
# The installed binary is cached by version to avoid rebuilding on every run.
- name: Cache cppcheck binary and data files
id: cache-cppcheck
uses: actions/cache@v4
with:
path: |
/usr/local/bin/cppcheck
/usr/local/share/cppcheck
key: cppcheck-${{ env.CPPCHECK_VERSION }}-linux
env:
CPPCHECK_VERSION: '2.16.0'
- name: "Build and Install cppcheck for Tests of Ceedling Plugin: Cppcheck"
if: steps.cache-cppcheck.outputs.cache-hit != 'true'
env:
CPPCHECK_VERSION: '2.16.0'
run: |
sudo apt-get install --assume-yes --quiet cmake
wget -q https://github.com/danmar/cppcheck/archive/refs/tags/${CPPCHECK_VERSION}.tar.gz -O cppcheck.tar.gz
tar xzf cppcheck.tar.gz
cmake -S cppcheck-${CPPCHECK_VERSION} -B cppcheck-build -DCMAKE_BUILD_TYPE=Release -DUSE_MATCHCOMPILER=ON -DFILESDIR=/usr/local/share/cppcheck
cmake --build cppcheck-build --parallel $(nproc)
sudo cmake --install cppcheck-build
# --break-system-packages is required on Ubuntu 24.04+
# (PEP 668 prevents pip from installing to the system Python environment without explicit opt-in)
- name: "Install GCovr for Tests of Ceedling Plugin: Gcov"
run: |
pip install --break-system-packages gcovr
# Install ReportGenerator for Gcov plugin
# Fix PATH before tool installation
# https://stackoverflow.com/questions/59010890/github-action-how-to-restart-the-session
- name: "Install ReportGenerator for Tests of Ceedling Plugin: Gcov"
run: |
mkdir --parents $HOME/.dotnet/tools
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
dotnet tool install --global dotnet-reportgenerator-globaltool
# Download HTML docs bundle built by generate-docs job
- name: Download HTML Documentation Bundle
uses: actions/download-artifact@v4
with:
name: gem-docs-site-local
path: site-local/
# Run Tests
- name: Run All Self Tests
env:
# Set the RSpec formatter to condensed dots
CI_RSPEC_PROGRESS_FORMAT: true
run: |
rake ci
# Upload any system test failure logs on test job failure
- name: Upload system test failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: systest-failure-logs-${{ runner.os }}-ruby-${{ matrix.ruby }}
path: systest.*.fail.log
if-no-files-found: ignore
# Build & Install Ceedling Gem
# Plugin test suites (FFF, module_generator, dependencies) require the installed gem
- name: Build and Install Ceedling Gem
run: |
gem build ceedling.gemspec
gem install --local ceedling-*.gem
# Run FFF Plugin Tests
- name: "Run Tests on Ceedling Plugin: FFF"
run: |
cd plugins/fff
rake
cd ../..
# Run Module Generator Plugin Tests
- name: "Run Tests on Ceedling Plugin: Module Generator"
run: |
cd plugins/module_generator
rake
cd ../..
# Run Dependencies Plugin Tests
- name: "Run Tests on Ceedling Plugin: Dependencies"
run: |
cd plugins/dependencies
rake
cd ../..
# Job: Windows unit test suite
tests-windows:
name: "Windows Test Suite"
needs: generate-docs
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']
steps:
# Use a cache for our tools to speed up testing
- uses: actions/cache@v4
with:
path: vendor/bundle
key: bundle-use-ruby-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
bundle-use-ruby-${{ runner.os }}-${{ matrix.ruby }}-
# Checks out repository under $GITHUB_WORKSPACE
- name: Checkout Latest Repo
uses: actions/checkout@v4
with:
submodules: recursive
# Set up Ruby to run test & build steps on multiple ruby versions
# This action installs Ruby and the Bundler gem using the version captured in Gemfile.lock
- name: Set Up Ruby with Version Matrix
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
# Install Gem Dependencies
- name: Install Gem Dependencies
# Ensure local installation to prevent system directory permission problems
run: |
bundle install
# Install GCovr for Gcov plugin test
- name: "Install GCovr for Tests of Ceedling Plugin: Gcov"
run: |
pip install gcovr
# Install ReportGenerator for Gcov plugin test
- name: "Install ReportGenerator for Tests of Ceedling Plugin: Gcov"
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
# Install cppcheck via Chocolatey (installs the MSI to C:\Program Files\Cppcheck\).
# Add the real install directory to PATH ahead of the Chocolatey shim so that
# cppcheck can locate its cfg/ directory (needed for std.cfg library lookups).
- name: "Install cppcheck for Tests of Ceedling Plugin: Cppcheck"
run: |
choco upgrade cppcheck -y
echo "C:\Program Files\Cppcheck" >> $env:GITHUB_PATH
# Download HTML docs bundle built by generate-docs job
- name: Download HTML Documentation Bundle
uses: actions/download-artifact@v4
with:
name: gem-docs-site-local
path: site-local/
# Run Tests
- name: Run All Self Tests
env:
# Set the RSpec formatter to condensed dots
CI_RSPEC_PROGRESS_FORMAT: true
run: |
rake ci
# Upload any system test failure logs on test job failure
- name: Upload system test failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: systest-failure-logs-${{ runner.os }}-ruby-${{ matrix.ruby }}
path: systest.*.fail.log
if-no-files-found: ignore
# Build & Install Ceedling Gem
# Plugin test suites (FFF, module_generator, dependencies) require the installed gem
- name: Build and Install Ceedling Gem
run: |
gem build ceedling.gemspec
gem install --local ceedling-*.gem
# Run FFF Plugin Tests
- name: "Run Tests on Ceedling Plugin: FFF"
run: |
cd plugins/fff
rake
cd ../..
# Run Module Generator Plugin Tests
- name: "Run Tests on Ceedling Plugin: Module Generator"
run: |
cd plugins/module_generator
rake
cd ../..
# Run Dependencies Plugin Tests
- name: "Run Tests on Ceedling Plugin: Dependencies"
run: |
cd plugins/dependencies
rake
cd ../..
# Job: Build the Ceedling gem once all tests pass
# Verifies a clean gem build is possible; the built gem is uploaded as a
# downloadable workflow artifact. No release is created here.
build-gem:
name: "Build Ceedling Gem"
needs:
- tests-linux
- tests-windows
runs-on: ubuntu-latest
steps:
# Use a cache for our tools to speed up builds
# No matrix here; Ruby version is hardcoded to match the cache key format used by test jobs
- uses: actions/cache@v4
with:
path: vendor/bundle
key: bundle-use-ruby-${{ runner.os }}-3.3-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
bundle-use-ruby-${{ runner.os }}-3.3-
- name: Checkout Latest Repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Install Gem Dependencies
run: |
bundle install
# Download HTML docs bundle built by generate-docs job
- name: Download HTML Documentation Bundle
uses: actions/download-artifact@v4
with:
name: gem-docs-site-local
path: site-local/
- name: Build Ceedling Gem
run: |
gem build ceedling.gemspec
# Upload the built gem as a workflow artifact (downloadable from the Actions UI)
- name: Upload Built Gem Artifact
uses: actions/upload-artifact@v4
with:
name: ceedling-gem
path: ceedling-*.gem
if-no-files-found: error