Skip to content

Commit 8398a6c

Browse files
committed
CI: Add Docker-based compiler tests workflow
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent 6d579fa commit 8398a6c

3 files changed

Lines changed: 299 additions & 85 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Copyright (c) The mlkem-native project authors
2+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
3+
4+
name: Compiler functional tests
5+
description: Run functional tests across C standard versions
6+
7+
inputs:
8+
cflags:
9+
description: Base CFLAGS (e.g. -O0, -Os, -O3)
10+
required: true
11+
opt:
12+
description: Whether to build opt/non-opt binaries or all (all | opt | no_opt)
13+
default: "all"
14+
examples:
15+
description: Determine whether to run examples or not
16+
default: "true"
17+
c17:
18+
description: Whether compiler supports C17
19+
default: "true"
20+
c23:
21+
description: Whether compiler supports C23
22+
default: "false"
23+
gh_token:
24+
description: Github access token to use
25+
required: true
26+
27+
runs:
28+
using: composite
29+
steps:
30+
- name: functest (${{ inputs.cflags }})
31+
uses: ./.github/actions/multi-functest
32+
with:
33+
nix-shell: ""
34+
gh_token: ${{ inputs.gh_token }}
35+
compile_mode: native
36+
func: true
37+
kat: false
38+
acvp: false
39+
examples: ${{ inputs.examples }}
40+
opt: ${{ inputs.opt }}
41+
cflags: "${{ inputs.cflags }} -DNTESTS_FUNC=10 -DNUM_RANDOM_TESTS=10 -DNUM_RANDOM_TESTS_REJ_UNIFORM=10"
42+
- name: functest (${{ inputs.cflags }}, C90)
43+
uses: ./.github/actions/multi-functest
44+
with:
45+
nix-shell: ""
46+
gh_token: ${{ inputs.gh_token }}
47+
compile_mode: native
48+
func: true
49+
kat: false
50+
acvp: false
51+
examples: ${{ inputs.examples }}
52+
opt: ${{ inputs.opt }}
53+
cflags: "-std=c90 ${{ inputs.cflags }} -DNTESTS_FUNC=10 -DNUM_RANDOM_TESTS=10 -DNUM_RANDOM_TESTS_REJ_UNIFORM=10"
54+
- name: functest (${{ inputs.cflags }}, C99)
55+
uses: ./.github/actions/multi-functest
56+
with:
57+
nix-shell: ""
58+
gh_token: ${{ inputs.gh_token }}
59+
compile_mode: native
60+
func: true
61+
kat: false
62+
acvp: false
63+
examples: ${{ inputs.examples }}
64+
opt: ${{ inputs.opt }}
65+
cflags: "-std=c99 ${{ inputs.cflags }} -DNTESTS_FUNC=10 -DNUM_RANDOM_TESTS=10 -DNUM_RANDOM_TESTS_REJ_UNIFORM=10"
66+
- name: functest (${{ inputs.cflags }}, C11)
67+
uses: ./.github/actions/multi-functest
68+
with:
69+
nix-shell: ""
70+
gh_token: ${{ inputs.gh_token }}
71+
compile_mode: native
72+
func: true
73+
kat: false
74+
acvp: false
75+
examples: ${{ inputs.examples }}
76+
opt: ${{ inputs.opt }}
77+
cflags: "-std=c11 ${{ inputs.cflags }} -DNTESTS_FUNC=10 -DNUM_RANDOM_TESTS=10 -DNUM_RANDOM_TESTS_REJ_UNIFORM=10"
78+
- name: functest (${{ inputs.cflags }}, C17)
79+
if: ${{ inputs.c17 == 'true' }}
80+
uses: ./.github/actions/multi-functest
81+
with:
82+
nix-shell: ""
83+
gh_token: ${{ inputs.gh_token }}
84+
compile_mode: native
85+
func: true
86+
kat: false
87+
acvp: false
88+
examples: ${{ inputs.examples }}
89+
opt: ${{ inputs.opt }}
90+
cflags: "-std=c17 ${{ inputs.cflags }} -DNTESTS_FUNC=10 -DNUM_RANDOM_TESTS=10 -DNUM_RANDOM_TESTS_REJ_UNIFORM=10"
91+
- name: functest (${{ inputs.cflags }}, C23)
92+
if: ${{ inputs.c23 == 'true' }}
93+
uses: ./.github/actions/multi-functest
94+
with:
95+
nix-shell: ""
96+
gh_token: ${{ inputs.gh_token }}
97+
compile_mode: native
98+
func: true
99+
kat: false
100+
acvp: false
101+
examples: ${{ inputs.examples }}
102+
opt: ${{ inputs.opt }}
103+
cflags: "-std=c23 ${{ inputs.cflags }} -DNTESTS_FUNC=10 -DNUM_RANDOM_TESTS=10 -DNUM_RANDOM_TESTS_REJ_UNIFORM=10"

.github/workflows/all.yml

Lines changed: 3 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -13,91 +13,9 @@ on:
1313
types: [ "opened", "synchronize" ]
1414

1515
jobs:
16-
base:
17-
name: Base
16+
compiler-tests:
17+
name: Compiler tests (Docker)
1818
permissions:
1919
contents: 'read'
20-
id-token: 'write'
21-
uses: ./.github/workflows/base.yml
22-
secrets: inherit
23-
lint-markdown:
24-
name: Lint Markdown
25-
permissions:
26-
contents: 'read'
27-
id-token: 'write'
28-
uses: ./.github/workflows/lint_markdown.yml
29-
nix:
30-
name: Nix
31-
permissions:
32-
actions: 'write'
33-
contents: 'read'
34-
id-token: 'write'
35-
uses: ./.github/workflows/nix.yml
36-
secrets: inherit
37-
ci:
38-
name: Extended
39-
permissions:
40-
contents: 'read'
41-
id-token: 'write'
42-
needs: [ base, nix ]
43-
uses: ./.github/workflows/ci.yml
44-
secrets: inherit
45-
cbmc:
46-
name: CBMC
47-
permissions:
48-
contents: 'read'
49-
id-token: 'write'
50-
pull-requests: 'write'
51-
needs: [ base, nix ]
52-
uses: ./.github/workflows/cbmc.yml
53-
secrets: inherit
54-
oqs_integration:
55-
name: libOQS
56-
permissions:
57-
contents: 'read'
58-
id-token: 'write'
59-
needs: [ base ]
60-
uses: ./.github/workflows/integration-liboqs.yml
61-
secrets: inherit
62-
opentitan_integration:
63-
name: OpenTitan
64-
permissions:
65-
contents: 'read'
66-
id-token: 'write'
67-
needs: [ base ]
68-
uses: ./.github/workflows/integration-opentitan.yml
69-
secrets: inherit
70-
awslc_integration:
71-
name: AWS-LC
72-
permissions:
73-
contents: 'read'
74-
id-token: 'write'
75-
needs: [ base ]
76-
uses: ./.github/workflows/integration-awslc.yml
77-
with:
78-
commit: v1.67.0
79-
secrets: inherit
80-
ct-test:
81-
name: Constant-time
82-
permissions:
83-
contents: 'read'
84-
id-token: 'write'
85-
needs: [ base, nix ]
86-
uses: ./.github/workflows/ct-tests.yml
87-
secrets: inherit
88-
slothy:
89-
name: SLOTHY
90-
permissions:
91-
contents: 'read'
92-
id-token: 'write'
93-
needs: [ base, nix ]
94-
uses: ./.github/workflows/slothy.yml
95-
secrets: inherit
96-
baremetal:
97-
name: Baremetal
98-
permissions:
99-
contents: 'read'
100-
id-token: 'write'
101-
needs: [ base ]
102-
uses: ./.github/workflows/baremetal.yml
20+
uses: ./.github/workflows/compiler-tests.yml
10321
secrets: inherit
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Copyright (c) The mlkem-native project authors
2+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
3+
4+
name: Compiler tests (Docker)
5+
permissions:
6+
contents: read
7+
on:
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
jobs:
12+
compiler_tests:
13+
name: Compiler tests (${{ matrix.compiler.name }}, ${{ matrix.target.name }})
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
target:
18+
- runner: ubuntu-24.04-arm
19+
name: 'aarch64'
20+
- runner: ubuntu-latest
21+
name: 'x86_64'
22+
compiler:
23+
# GCC compilers
24+
- name: gcc-4.8
25+
image: gcc:4.8
26+
cc: gcc
27+
c17: false
28+
c23: false
29+
opt: all
30+
examples: true
31+
x86_64_only: true
32+
- name: gcc-4.9
33+
image: gcc:4.9
34+
cc: gcc
35+
c17: false
36+
c23: false
37+
opt: all
38+
examples: true
39+
x86_64_only: true
40+
- name: gcc-8
41+
image: gcc:8
42+
cc: gcc
43+
c17: true
44+
c23: false
45+
opt: all
46+
examples: true
47+
x86_64_only: false
48+
- name: gcc-11
49+
image: gcc:11
50+
cc: gcc
51+
c17: true
52+
c23: false
53+
opt: all
54+
examples: true
55+
x86_64_only: false
56+
- name: gcc-12
57+
image: gcc:12
58+
cc: gcc
59+
c17: true
60+
c23: false
61+
opt: all
62+
examples: true
63+
x86_64_only: false
64+
- name: gcc-13
65+
image: gcc:13
66+
cc: gcc
67+
c17: true
68+
c23: false
69+
opt: all
70+
examples: true
71+
x86_64_only: false
72+
- name: gcc-14
73+
image: gcc:14
74+
cc: gcc
75+
c17: true
76+
c23: true
77+
opt: all
78+
examples: true
79+
x86_64_only: false
80+
- name: gcc-15
81+
image: gcc:15
82+
cc: gcc
83+
c17: true
84+
c23: true
85+
opt: all
86+
examples: true
87+
x86_64_only: false
88+
# Clang compilers
89+
- name: clang-14
90+
image: silkeh/clang:14
91+
cc: clang
92+
c17: true
93+
c23: false
94+
opt: all
95+
examples: true
96+
x86_64_only: false
97+
- name: clang-15
98+
image: silkeh/clang:15
99+
cc: clang
100+
c17: true
101+
c23: false
102+
opt: all
103+
examples: true
104+
x86_64_only: false
105+
- name: clang-16
106+
image: silkeh/clang:16
107+
cc: clang
108+
c17: true
109+
c23: false
110+
opt: all
111+
examples: true
112+
x86_64_only: false
113+
- name: clang-17
114+
image: silkeh/clang:17
115+
cc: clang
116+
c17: true
117+
c23: false
118+
opt: all
119+
examples: true
120+
x86_64_only: false
121+
- name: clang-18
122+
image: silkeh/clang:18
123+
cc: clang
124+
c17: true
125+
c23: true
126+
opt: all
127+
examples: true
128+
x86_64_only: false
129+
- name: clang-19
130+
image: silkeh/clang:19
131+
cc: clang
132+
c17: true
133+
c23: true
134+
opt: all
135+
examples: true
136+
x86_64_only: false
137+
- name: clang-20
138+
image: silkeh/clang:20
139+
cc: clang
140+
c17: true
141+
c23: true
142+
opt: all
143+
examples: true
144+
x86_64_only: false
145+
- name: clang-21
146+
image: silkeh/clang:21
147+
cc: clang
148+
c17: true
149+
c23: true
150+
opt: all
151+
examples: true
152+
x86_64_only: false
153+
exclude:
154+
# gcc-4.8 and gcc-4.9 Docker images are amd64 only
155+
- target: { name: 'aarch64' }
156+
compiler: { x86_64_only: true }
157+
runs-on: ${{ matrix.target.runner }}
158+
container: ${{ matrix.compiler.image }}
159+
env:
160+
CC: ${{ matrix.compiler.cc }}
161+
steps:
162+
- name: Install dependencies
163+
run: |
164+
apt-get update
165+
apt-get install -y python3 make
166+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
167+
- name: Tests (-O0)
168+
uses: ./.github/actions/compiler-functest
169+
with:
170+
cflags: "-O0"
171+
opt: ${{ matrix.compiler.opt }}
172+
examples: ${{ matrix.compiler.examples }}
173+
c17: ${{ matrix.compiler.c17 }}
174+
c23: ${{ matrix.compiler.c23 }}
175+
gh_token: ${{ secrets.GITHUB_TOKEN }}
176+
- name: Tests (-Os)
177+
uses: ./.github/actions/compiler-functest
178+
with:
179+
cflags: "-Os"
180+
opt: ${{ matrix.compiler.opt }}
181+
examples: ${{ matrix.compiler.examples }}
182+
c17: ${{ matrix.compiler.c17 }}
183+
c23: ${{ matrix.compiler.c23 }}
184+
gh_token: ${{ secrets.GITHUB_TOKEN }}
185+
- name: Tests (-O3)
186+
uses: ./.github/actions/compiler-functest
187+
with:
188+
cflags: "-O3"
189+
opt: ${{ matrix.compiler.opt }}
190+
examples: ${{ matrix.compiler.examples }}
191+
c17: ${{ matrix.compiler.c17 }}
192+
c23: ${{ matrix.compiler.c23 }}
193+
gh_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)