-
Notifications
You must be signed in to change notification settings - Fork 247
301 lines (259 loc) · 8.66 KB
/
main.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
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
# =========================================================================
# Ceedling - Test-Centered Build System for C
# ThrowTheSwitch.org
# Copyright (c) 2010-24 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
---
# Continuous Integration Workflow
name: CI
# Triggers the workflow on push or pull request events for master & test branches
on:
push:
branches:
- 'master'
- 'test/**'
pull_request:
branches: [ master ]
workflow_dispatch:
# Needed by softprops/action-gh-release
permissions:
# Allow built gem file push to Github release
contents: write
jobs:
# Job: Linux unit test suite
unit-tests-linux:
name: "Linux Test Suite"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2']
steps:
# Use a cache for our tools to speed up testing
- uses: actions/cache@v4
with:
path: vendor/bundle
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-
# Checks out repository under $GITHUB_WORKSPACE
- name: Checkout Latest Repo
uses: actions/checkout@v4
with:
submodules: recursive
# Setup Ruby Testing Tools to do tests on multiple ruby version
- name: Setup Ruby Testing Tools
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
# Install Ruby Testing Tools (Bundler version should match the one in Gemfile.lock)
- name: Install Ruby Testing Tools
run: |
gem install rspec
gem install rubocop -v 0.57.2
gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"
bundle update
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 GCovr for Gcov plugin
- name: Install GCovr for Gcov Plugin Tests
run: |
sudo pip install 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 Gcov Plugin Tests
run: |
mkdir --parents $HOME/.dotnet/tools
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
dotnet tool install --global dotnet-reportgenerator-globaltool
# Run Tests
- name: Run All Self Tests
run: |
rake ci
# Build & Install Gem
- name: Build and Install Gem
run: |
gem build ceedling.gemspec
gem install --local ceedling-*.gem
# Run temp_sensor
- name: Run Tests on temp_sensor Project
run: |
cd examples/temp_sensor
ceedling test:all
cd ../..
# Run FFF Plugin Tests
- name: Run Tests on FFF Plugin
run: |
cd plugins/fff
rake
cd ../..
# Run Module Generator Plugin Tests
- name: Run Tests on Module Generator Plugin
run: |
cd plugins/module_generator
rake
cd ../..
# Run Dependencies Plugin Tests
- name: Run Tests on Dependencies Plugin
run: |
cd plugins/dependencies
rake
cd ../..
# Job: Windows unit test suite
unit-tests-windows:
name: "Windows Test Suite"
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2']
steps:
# Use a cache for our tools to speed up testing
- uses: actions/cache@v4
with:
path: vendor/bundle
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-
# Checks out repository under $GITHUB_WORKSPACE
- name: Checkout Latest Repo
uses: actions/checkout@v4
with:
submodules: recursive
# Setup Ruby Testing Tools to do tests on multiple ruby version
- name: Set Up Ruby Testing Tools
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
# Install Ruby Testing Tools
# Bundler version should match the one in Gemfile.lock
- name: Install Ruby Testing Tools
shell: bash
run: |
gem install rspec
gem install rubocop -v 0.57.2
gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"
bundle update
bundle install
# Install GCovr for Gcov plugin test
- name: Install GCovr for Gcov Plugin Tests
run: |
pip install gcovr
# Install ReportGenerator for Gcov plugin test
- name: Install ReportGenerator for Gcov Plugin Tests
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
# Run Tests
- name: Run All Self Tests
run: |
rake ci
# Build & Install Gem
- name: Build and Install Gem
run: |
gem build ceedling.gemspec
gem install --local ceedling-*.gem
# Run temp_sensor example project
- name: Run Tests on temp_sensor Project
run: |
cd examples/temp_sensor
ceedling test:all
cd ../..
# Run FFF Plugin Tests
- name: Run Tests on FFF Plugin
run: |
cd plugins/fff
rake
cd ../..
# Run Module Generator Plugin Tests
- name: Run Tests on Module Generator Plugin
run: |
cd plugins/module_generator
rake
cd ../..
# Run Dependencies Plugin Tests
- name: Run Tests on Dependencies Plugin
run: |
cd plugins/dependencies
rake
cd ../..
# Job: Automatic Minor Release
auto-release:
name: "Automatic Minor Release"
needs:
- unit-tests-linux
- unit-tests-windows
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [3.2]
steps:
# Checks out repository under $GITHUB_WORKSPACE
- name: Checkout Latest Repo
uses: actions/checkout@v4
with:
submodules: recursive
# Set Up Ruby Tools
- name: Set Up Ruby Tools
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
# Capture the SHA string
- name: Git commit short SHA as environment variable
shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Ceedling tag as environment variable
shell: bash
run: |
echo "ceedling_tag=$(ruby ./lib/version.rb)" >> $GITHUB_ENV
- name: Ceedling build string as environment variable
shell: bash
run: |
echo "ceedling_build=${{ env.ceedling_tag }}-${{ env.sha_short }}" >> $GITHUB_ENV
# Create Git Commit SHA file in root of checkout
- name: Git Commit SHA file
shell: bash
run: |
echo "${{ env.sha_short }}" > ${{ github.workspace }}/GIT_COMMIT_SHA
# Build Gem
- name: Build Gem
run: |
gem build ceedling.gemspec
# Create Unofficial Release
- name: Create Pre-Release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: true
release_name: ${{ env.ceedling_build }}
tag_name: ${{ env.ceedling_build }}
body: "Automatic pre-release for ${{ env.ceedling_build }}"
env:
GITHUB_TOKEN: ${{ github.token }}
# Post Gem to Unofficial Release
- name: Upload Pre-Release Gem
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ceedling-${{ env.ceedling_tag }}.gem
asset_name: ceedling-${{ env.ceedling_build }}.gem
asset_content_type: test/x-gemfile
# - name: Upload Pre-Release Gem
# uses: softprops/action-gh-release@v2
# with:
# # repo_token: "${{ secrets.GITHUB_TOKEN }}"
# body: |
# [Release Notes](${{ github.workspace }}/docs/ReleaseNotes.md)
# name: ${{ env.full_ver }}
# prerelease: true
# files: |
# *.gem