Skip to content

Commit a8b6b8b

Browse files
committed
Build and test in a matrix
Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
1 parent 68813c6 commit a8b6b8b

File tree

3 files changed

+51
-81
lines changed

3 files changed

+51
-81
lines changed

.github/actions/ci_script/action.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,46 @@ jobs:
3232
build:
3333
name: Execute CI script
3434
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
target:
38+
- armv7-unknown-linux-gnueabi
39+
- armv7-unknown-linux-gnueabihf
40+
- arm-unknown-linux-gnueabi
41+
- aarch64-unknown-linux-gnu
42+
- i686-unknown-linux-gnu
43+
- loongarch64-unknown-linux-gnu
44+
- powerpc64-unknown-linux-gnu
45+
- powerpc64le-unknown-linux-gnu
46+
- x86_64-pc-windows-msvc
47+
- x86_64-apple-darwin
48+
- aarch64-apple-darwin
49+
- x86_64-unknown-freebsd
50+
- riscv64gc-unknown-linux-gnu
51+
toolchain:
52+
- stable
53+
- "1.66.0" # MSRV
3554
steps:
3655
- uses: actions/checkout@v4
3756
- name: Setup Rust toolchain
3857
uses: actions-rs/toolchain@v1
3958
with:
40-
toolchain: stable
41-
- name: "Installs SoftHSM and execute tests"
42-
uses: ./.github/actions/ci_script
59+
toolchain: ${{ matrix.toolchain }}
60+
- name: Install SoftHSM
61+
run: |
62+
sudo apt-get update -y -qq &&
63+
sudo apt-get install -y -qq libsofthsm2 &&
64+
mkdir /tmp/tokens
65+
echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf
66+
- name: Install Rust target
67+
run: rustup target add ${{ matrix.target }}
68+
- name: Test script
69+
env:
70+
TEST_PKCS11_MODULE: /usr/lib/softhsm/libsofthsm2.so
71+
SOFTHSM2_CONF: /tmp/softhsm2.conf
72+
TARGET: ${{ matrix.target }}
73+
RUST_BACKTRACE: 1
74+
run: ./ci.sh
4375

4476
tests-kryoptic:
4577
name: Run tests against Kryoptic
@@ -58,27 +90,14 @@ jobs:
5890
RUST_BACKTRACE=1 cargo build --all-features &&
5991
RUST_BACKTRACE=1 cargo test
6092
61-
62-
build-msrv:
63-
name: MSRV - Execute CI script
64-
runs-on: ubuntu-latest
65-
steps:
66-
- uses: actions/checkout@v4
67-
- name: Setup Rust toolchain on MSRV
68-
uses: actions-rs/toolchain@v1
69-
with:
70-
toolchain: 1.66.0
71-
- name: "Installs SoftHSM and execute tests"
72-
uses: ./.github/actions/ci_script
73-
7493
links:
7594
name: Check links
7695
runs-on: ubuntu-latest
7796
steps:
78-
- uses: actions/checkout@v4
79-
- name: Link Checker
80-
uses: peter-evans/link-checker@v1
81-
with:
82-
args: -v -r *.md
83-
- name: Fail if there were link errors
84-
run: exit ${{ steps.lc.outputs.exit_code }}
97+
- uses: actions/checkout@v4
98+
- name: Link Checker
99+
uses: peter-evans/link-checker@v1
100+
with:
101+
args: -v -r *.md
102+
- name: Fail if there were link errors
103+
run: exit ${{ steps.lc.outputs.exit_code }}

ci.sh

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
# Continuous Integration test script
77

8-
set -euf -o pipefail
8+
set -euxf -o pipefail
99

1010
pushd cryptoki-sys
11-
RUST_BACKTRACE=1 cargo build --features generate-bindings
11+
cargo build --features generate-bindings
1212
popd
1313

1414
# check formatting before going through all the builds
@@ -19,22 +19,10 @@ if cargo clippy --version; then
1919
cargo clippy --all-targets -- -D clippy::all -D clippy::cargo
2020
fi
2121

22-
RUST_BACKTRACE=1 cargo build
23-
24-
RUST_BACKTRACE=1 cargo build --all-features
25-
26-
RUST_BACKTRACE=1 cargo build --target arm-unknown-linux-gnueabi
27-
RUST_BACKTRACE=1 cargo build --target armv7-unknown-linux-gnueabi
28-
RUST_BACKTRACE=1 cargo build --target armv7-unknown-linux-gnueabihf
29-
RUST_BACKTRACE=1 cargo build --target aarch64-unknown-linux-gnu
30-
RUST_BACKTRACE=1 cargo build --target i686-unknown-linux-gnu
31-
RUST_BACKTRACE=1 cargo build --target loongarch64-unknown-linux-gnu
32-
RUST_BACKTRACE=1 cargo build --target powerpc64-unknown-linux-gnu
33-
RUST_BACKTRACE=1 cargo build --target powerpc64le-unknown-linux-gnu
34-
RUST_BACKTRACE=1 cargo build --target riscv64gc-unknown-linux-gnu
35-
RUST_BACKTRACE=1 cargo build --target x86_64-pc-windows-msvc
36-
RUST_BACKTRACE=1 cargo build --target x86_64-apple-darwin
37-
RUST_BACKTRACE=1 cargo build --target aarch64-apple-darwin
38-
RUST_BACKTRACE=1 cargo build --target x86_64-unknown-freebsd
39-
40-
RUST_BACKTRACE=1 cargo test
22+
cargo build
23+
24+
cargo build --all-features
25+
26+
cargo build --target "$TARGET"
27+
28+
cargo test

0 commit comments

Comments
 (0)