-
Notifications
You must be signed in to change notification settings - Fork 179
224 lines (208 loc) · 6.34 KB
/
Copy pathci.yml
File metadata and controls
224 lines (208 loc) · 6.34 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
name: CI
on:
push:
branches: [main, zig-master]
pull_request:
branches: [main, zig-master]
workflow_dispatch:
jobs:
formatting-check:
name: Formatting check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Run zig fmt
run: zig fmt --check .
# Make sure that we are building examples and invoking tests for each port.
# Some may need to be skipped, but that's okay because then it's explicitly
# listed instead of forgotten.
validate-ports-checks:
name: Validate Port Checks
continue-on-error: true
runs-on: ubuntu-latest
steps:
- run: sudo apt install -y yq
- name: Checkout
uses: actions/checkout@v4
- run: |
set -e
find port -mindepth 2 -maxdepth 2 -type d | sed 's|^port/||' | sort > ports
yq -r '.jobs["unit-test"].steps[] | select(.run == "zig build test") | .["working-directory"]' .github/workflows/ports.yml | sed 's|^port/||' | sort > unit_tested_ports
yq -r '.jobs.build.steps[] | select(.run == "zig build -Doptimize=ReleaseSmall") | .["working-directory"]' .github/workflows/ports.yml | grep -v no_hal | sed 's|^examples/||' | sort > exampled_ports
comm -23 ports unit_tested_ports > missing_unit_tests
comm -23 ports exampled_ports > missing_examples
EXIT_CODE=0
if [ -s missing_unit_tests ]
then
EXIT_CODE=1
echo "These ports are not running unit tests in CI:" >&2
echo "" >&2
cat missing_unit_tests >&2
echo "" >&2
fi
if [ -s missing_examples ]
then
EXIT_CODE=1
echo "These ports are not building examples in CI:" >&2
echo "" >&2
cat missing_examples >&2
echo "" >&2
fi
exit $EXIT_CODE
unit-test-regz:
name: Unit Test Regz
continue-on-error: true
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Unit Test Regz
run: zig build test
working-directory: tools/regz
unit-test-uf2:
name: Unit Test UF2
continue-on-error: true
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Unit Test UF2
run: zig build test
working-directory: tools/uf2
unit-test-esp-image:
name: Unit Test ESP Image
continue-on-error: true
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Unit Test ESP Image
run: zig build test
working-directory: tools/esp-image
test-printer:
name: Test Printer
continue-on-error: true
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Build Printer
run: zig build
working-directory: tools/printer
- name: Test Printer
run: zig build test
working-directory: tools/printer
build-sorcerer:
name: Build Sorcerer
if: false # Temporarily disabled: Sorcerer dependency fetches are flaky on CI. https://github.com/ZigEmbeddedGroup/microzig/issues/949
continue-on-error: true
strategy:
matrix:
# Skip Ubuntu - sorcerer is a GUI tool with complex dependencies (SDL3, dvui)
# that are difficult to satisfy in headless CI environments
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Build Sorcerer
run: zig build
working-directory: tools/sorcerer
- name: Test Sorcerer
run: zig build test
working-directory: tools/sorcerer
stm32-gen-check:
name: Check that stm32 generated code is up to date
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Generate Code
run: zig build -Dgenerate
working-directory: port/stmicro/stm32
- name: Check for code diffs
run: |
if [[ $(git status --porcelain | grep -v '^??') ]]; then
echo "Code differences detected:"
git diff
echo "Please commit or fix these changes to proceed."
exit 1
else
echo "No code differences detected."
fi
build:
name: Build
continue-on-error: true
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Build
run: zig build -Doptimize=ReleaseSmall
validate-foundation-libc:
name: Test Foundation Libc
if: false # TODO: fix foundation libc
continue-on-error: true
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
- name: Generate and test packages
working-directory: modules/foundation-libc/test
run: |
zig build test
build-website:
name: Build Website
continue-on-error: true
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.17.0-dev.857+2b2b85c5f
- name: Build Website
run: zig build
working-directory: website