Skip to content

Commit 1ee2493

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

3 files changed

Lines changed: 273 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: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
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 (installed via ubuntu-toolchain-r PPA)
24+
- name: gcc-9
25+
type: gcc
26+
version: '9'
27+
c17: true
28+
c23: false
29+
opt: all
30+
examples: true
31+
- name: gcc-10
32+
type: gcc
33+
version: '10'
34+
c17: true
35+
c23: false
36+
opt: all
37+
examples: true
38+
- name: gcc-11
39+
type: gcc
40+
version: '11'
41+
c17: true
42+
c23: false
43+
opt: all
44+
examples: true
45+
- name: gcc-12
46+
type: gcc
47+
version: '12'
48+
c17: true
49+
c23: false
50+
opt: all
51+
examples: true
52+
- name: gcc-13
53+
type: gcc
54+
version: '13'
55+
c17: true
56+
c23: false
57+
opt: all
58+
examples: true
59+
- name: gcc-14
60+
type: gcc
61+
version: '14'
62+
c17: true
63+
c23: true
64+
opt: all
65+
examples: true
66+
# Clang compilers (installed via install-llvm-action)
67+
- name: clang-14
68+
type: clang
69+
version: '14'
70+
c17: true
71+
c23: false
72+
opt: all
73+
examples: true
74+
- name: clang-15
75+
type: clang
76+
version: '15'
77+
c17: true
78+
c23: false
79+
opt: all
80+
examples: true
81+
- name: clang-16
82+
type: clang
83+
version: '16'
84+
c17: true
85+
c23: false
86+
opt: all
87+
examples: true
88+
- name: clang-17
89+
type: clang
90+
version: '17'
91+
c17: true
92+
c23: false
93+
opt: all
94+
examples: true
95+
- name: clang-18
96+
type: clang
97+
version: '18'
98+
c17: true
99+
c23: true
100+
opt: all
101+
examples: true
102+
- name: clang-19
103+
type: clang
104+
version: '19'
105+
c17: true
106+
c23: true
107+
opt: all
108+
examples: true
109+
- name: clang-20
110+
type: clang
111+
version: '20'
112+
c17: true
113+
c23: true
114+
opt: all
115+
examples: true
116+
- name: clang-21
117+
type: clang
118+
version: '21'
119+
c17: true
120+
c23: true
121+
opt: all
122+
examples: true
123+
runs-on: ${{ matrix.target.runner }}
124+
steps:
125+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
126+
- name: Setup GCC
127+
if: ${{ matrix.compiler.type == 'gcc' }}
128+
run: |
129+
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
130+
sudo apt-get update
131+
sudo apt-get install -y gcc-${{ matrix.compiler.version }}
132+
echo "CC=gcc-${{ matrix.compiler.version }}" >> $GITHUB_ENV
133+
- name: Setup Clang
134+
if: ${{ matrix.compiler.type == 'clang' }}
135+
uses: KyleMayes/install-llvm-action@v2
136+
with:
137+
version: ${{ matrix.compiler.version }}
138+
env: true
139+
- name: Compiler info
140+
run: ${{ env.CC }} --version
141+
- name: Tests (-O0)
142+
uses: ./.github/actions/compiler-functest
143+
with:
144+
cflags: "-O0"
145+
opt: ${{ matrix.compiler.opt }}
146+
examples: ${{ matrix.compiler.examples }}
147+
c17: ${{ matrix.compiler.c17 }}
148+
c23: ${{ matrix.compiler.c23 }}
149+
gh_token: ${{ secrets.GITHUB_TOKEN }}
150+
- name: Tests (-Os)
151+
uses: ./.github/actions/compiler-functest
152+
with:
153+
cflags: "-Os"
154+
opt: ${{ matrix.compiler.opt }}
155+
examples: ${{ matrix.compiler.examples }}
156+
c17: ${{ matrix.compiler.c17 }}
157+
c23: ${{ matrix.compiler.c23 }}
158+
gh_token: ${{ secrets.GITHUB_TOKEN }}
159+
- name: Tests (-O3)
160+
uses: ./.github/actions/compiler-functest
161+
with:
162+
cflags: "-O3"
163+
opt: ${{ matrix.compiler.opt }}
164+
examples: ${{ matrix.compiler.examples }}
165+
c17: ${{ matrix.compiler.c17 }}
166+
c23: ${{ matrix.compiler.c23 }}
167+
gh_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)