Skip to content

Commit d2b14a4

Browse files
authored
Merge pull request #15 from pq-code-package/ci-compiler-tests
Add extensive compiler tests in CI
2 parents a787322 + af2fde9 commit d2b14a4

File tree

6 files changed

+188
-2
lines changed

6 files changed

+188
-2
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
2+
3+
name: Functional tests
4+
description: Run functional tests
5+
6+
inputs:
7+
nix-shell:
8+
description: Run in the specified Nix environment if exists
9+
default: "ci"
10+
custom_shell:
11+
description: The shell to use. Only relevant if no nix-shell specified
12+
default: "bash"
13+
nix-cache:
14+
description: Determine whether to enable nix cache
15+
default: 'false'
16+
nix-verbose:
17+
description: Determine wether to suppress nix log or not
18+
default: 'false'
19+
gh_token:
20+
description: Github access token to use
21+
required: true
22+
cflags:
23+
description: CFLAGS to pass to compilation
24+
default: ""
25+
26+
runs:
27+
using: composite
28+
steps:
29+
- uses: ./.github/actions/setup-nix
30+
with:
31+
devShell: ${{ inputs.nix-shell }}
32+
cache: ${{ inputs.nix-cache }}
33+
verbose: ${{ inputs.nix-verbose }}
34+
gh_token: ${{ inputs.gh_token }}
35+
- name: Functional tests
36+
shell: ${{ env.SHELL }}
37+
run: |
38+
make clean
39+
CFLAGS="${{ inputs.cflags }}" make test
40+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
2+
3+
name: Multiple Functional tests
4+
description: Run functional tests
5+
6+
inputs:
7+
nix-shell:
8+
description: Run in the specified Nix environment if exists
9+
default: "ci"
10+
custom_shell:
11+
description: The shell to use. Only relevant if no nix-shell specified
12+
default: "bash"
13+
nix-cache:
14+
description: Determine whether to enable nix cache
15+
default: 'false'
16+
nix-verbose:
17+
description: Determine wether to suppress nix log or not
18+
default: 'false'
19+
gh_token:
20+
description: Github access token to use
21+
required: true
22+
cflags:
23+
description: CFLAGS to pass to compilation
24+
default: ""
25+
26+
runs:
27+
using: composite
28+
steps:
29+
- name: Native Tests
30+
uses: ./.github/actions/functest
31+
with:
32+
nix-shell: ${{ inputs.nix-shell }}
33+
nix-cache: ${{ inputs.nix-cache }}
34+
nix-verbose: ${{ inputs.nix-verbose }}
35+
gh_token: ${{ inputs.gh_token }}
36+
custom_shell: ${{ inputs.custom_shell }}
37+
cflags: ${{ inputs.cflags }}

.github/workflows/all.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ jobs:
2828
id-token: 'write'
2929
uses: ./.github/workflows/nix.yml
3030
secrets: inherit
31+
ci:
32+
name: Extended
33+
permissions:
34+
contents: 'read'
35+
id-token: 'write'
36+
needs: [ base, nix ]
37+
uses: ./.github/workflows/ci.yml
38+
secrets: inherit
3139
cbmc:
3240
name: CBMC
3341
permissions:

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
2+
3+
name: Extended
4+
permissions:
5+
contents: read
6+
on:
7+
workflow_call:
8+
workflow_dispatch:
9+
10+
jobs:
11+
compiler_tests:
12+
name: Compiler tests (${{ matrix.compiler.name }}, ${{ matrix.target.name }}, ${{ matrix.cflags }})
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
cflags: [ "-Os", "-O3" ]
17+
target:
18+
- runner: pqcp-arm64
19+
name: 'aarch64'
20+
archflags: ''
21+
- runner: ubuntu-latest
22+
name: 'x86_64'
23+
archflags: '-mavx2 -mbmi2 -mpopcnt -maes'
24+
- runner: macos-latest
25+
name: 'macos'
26+
archflags: ''
27+
compiler:
28+
- name: gcc-4.8
29+
shell: ci_gcc48
30+
darwin: False
31+
- name: gcc-4.9
32+
shell: ci_gcc49
33+
darwin: False
34+
- name: gcc-7
35+
shell: ci_gcc7
36+
darwin: False
37+
- name: gcc-11
38+
shell: ci_gcc11
39+
darwin: True
40+
- name: gcc-13
41+
shell: ci_gcc13
42+
darwin: True
43+
- name: gcc-14
44+
shell: ci_gcc14
45+
darwin: True
46+
- name: clang-18
47+
shell: ci_clang18
48+
darwin: True
49+
- name: clang-19
50+
shell: ci_clang19
51+
darwin: True
52+
- name: clang-20
53+
shell: ci_clang20
54+
darwin: True
55+
# CPU flags are not correctly passed to the zig assembler
56+
# https://github.com/ziglang/zig/issues/23576
57+
# We therefore only test the C backend
58+
#
59+
# We omit all examples since there is currently no way to run
60+
# only those examples not involving native code.
61+
# TODO: compiling with zig leads to test failures right now - needs to be revisited.
62+
#- name: zig-0.12
63+
# shell: ci_zig0_12
64+
# darwin: True
65+
#- name: zig-0.13
66+
# shell: ci_zig0_13
67+
# darwin: True
68+
#- name: zig-0.14
69+
# shell: ci_zig0_14
70+
# darwin: True
71+
exclude:
72+
# Exclude old GCC versions from macOS and aarch64 runners
73+
- target: { name: 'macos' }
74+
compiler: { darwin: False }
75+
- target: { name: 'aarch64' }
76+
compiler: { darwin: False }
77+
runs-on: ${{ matrix.target.runner }}
78+
steps:
79+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
80+
- name: build+functest (default)
81+
uses: ./.github/actions/multi-functest
82+
with:
83+
gh_token: ${{ secrets.GITHUB_TOKEN }}
84+
nix-shell: ${{ matrix.compiler.shell }}
85+
cflags: "${{ matrix.cflags }} ${{ matrix.target.archflags }}"
86+
- name: native build+functest (C90)
87+
uses: ./.github/actions/multi-functest
88+
with:
89+
gh_token: ${{ secrets.GITHUB_TOKEN }}
90+
nix-shell: ${{ matrix.compiler.shell }}
91+
cflags: "-std=c90 ${{ matrix.cflags }} ${{ matrix.target.archflags }}"
92+
- name: native build+functest (C99)
93+
uses: ./.github/actions/multi-functest
94+
with:
95+
gh_token: ${{ secrets.GITHUB_TOKEN }}
96+
nix-shell: ${{ matrix.compiler.shell }}
97+
cflags: "-std=c99 ${{ matrix.cflags }} ${{ matrix.target.archflags }}"

CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
2+
# Last matching pattern has precedence
3+
4+
* @pq-code-package/pqcp-slhdsa-c-admin

flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
44

55
{
6-
description = "mlkem-native";
6+
description = "slhdsa-c";
77

88
inputs = {
99
nixpkgs-2405.url = "github:NixOS/nixpkgs/nixos-24.05";
@@ -58,7 +58,7 @@
5858

5959
packages.linters = util.linters;
6060
packages.cbmc = util.cbmc_pkgs;
61-
61+
6262
packages.toolchains = util.toolchains;
6363
packages.toolchains_native = util.toolchains_native;
6464
packages.toolchain_x86_64 = util.toolchain_x86_64;

0 commit comments

Comments
 (0)