Skip to content

Commit b260b17

Browse files
committed
feat(ci): compile with gcc/clang
1 parent 2bc3499 commit b260b17

File tree

1 file changed

+55
-7
lines changed

1 file changed

+55
-7
lines changed

.github/workflows/ci.yml

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ on:
66
pull_request:
77
workflow_dispatch:
88

9+
env:
10+
COMMON_CFLAGS: >-
11+
-Wall
12+
-Werror
13+
-Wno-format-security
14+
-Wno-unused-but-set-variable
15+
-Wno-unused-const-variable
16+
-Wno-type-limits
17+
-Wno-uninitialized
18+
919
jobs:
1020
lint:
1121
runs-on: ubuntu-latest
@@ -161,6 +171,48 @@ jobs:
161171
run: |
162172
bazel run //:example
163173
174+
test-gcc-versions:
175+
runs-on: ubuntu-latest
176+
strategy:
177+
fail-fast: false
178+
matrix:
179+
version: [15, 14, 13, 12, 11, 10, 9]
180+
container:
181+
image: gcc:${{ matrix.version }}
182+
steps:
183+
- uses: actions/checkout@v4
184+
185+
- name: Build example with GCC ${{ matrix.version }}
186+
run: |
187+
gcc -std=c11 -O3 example/main.c dist/core.c \
188+
-I includes/ \
189+
${{ env.COMMON_CFLAGS }} \
190+
-o test-example
191+
192+
- name: Run example
193+
run: ./test-example
194+
195+
test-clang-versions:
196+
runs-on: ubuntu-latest
197+
strategy:
198+
fail-fast: false
199+
matrix:
200+
version: [19, 18, 17, 16, 15, 14, 13]
201+
container:
202+
image: silkeh/clang:${{ matrix.version }}
203+
steps:
204+
- uses: actions/checkout@v4
205+
206+
- name: Build example with Clang ${{ matrix.version }}
207+
run: |
208+
clang -std=c11 -O3 example/main.c dist/core.c \
209+
-I includes/ \
210+
${{ env.COMMON_CFLAGS }} \
211+
-o test-example
212+
213+
- name: Run example
214+
run: ./test-example
215+
164216
cross-compile:
165217
runs-on: ubuntu-latest
166218
strategy:
@@ -205,13 +257,7 @@ jobs:
205257
zig cc example/main.c dist/core.c \
206258
-I includes/ \
207259
-target ${{ matrix.target.arch }} \
208-
-Wall \
209-
-Werror \
210-
-Wno-format-security \
211-
-Wno-unused-but-set-variable \
212-
-Wno-unused-const-variable \
213-
-Wno-type-limits \
214-
-Wno-uninitialized \
260+
${{ env.COMMON_CFLAGS }} \
215261
-Wno-constant-conversion \
216262
-Wno-incompatible-pointer-types \
217263
-Wno-unused-function \
@@ -226,6 +272,8 @@ jobs:
226272
- build
227273
- test-build-cmake
228274
- test-build-bazel
275+
- test-gcc-versions
276+
- test-clang-versions
229277
- cross-compile
230278
steps:
231279
- uses: re-actors/alls-green@release/v1

0 commit comments

Comments
 (0)