Skip to content

Commit a577064

Browse files
committed
fixing testing harness
1 parent f51a55f commit a577064

File tree

2 files changed

+168
-90
lines changed

2 files changed

+168
-90
lines changed

.github/workflows/common.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: common
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
style:
10+
name: Check Style
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Install rust
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
components: rustfmt
21+
profile: minimal
22+
override: true
23+
24+
- name: Rustfmt check
25+
uses: actions-rs/cargo@v1
26+
with:
27+
command: fmt
28+
args: --all --check
29+
30+
test:
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
target:
35+
- triple: x86_64-unknown-linux-gnu
36+
caps: X86_64_UNKNOWN_LINUX_GNU
37+
- triple: aarch64-unknown-linux-gnu
38+
caps: AARCH64_UNKNOWN_LINUX_GNU
39+
channel:
40+
- stable
41+
- beta
42+
- nightly
43+
uses: ./.github/workflows/rust.yml
44+
with:
45+
target: ${{ matrix.target.triple }}
46+
target-in-caps: ${{ matrix.target.caps }}
47+
channel: ${{ matrix.channel }}
48+
secrets: inherit

.github/workflows/rust.yml

+120-90
Original file line numberDiff line numberDiff line change
@@ -3,135 +3,165 @@
33
name: Rust
44

55
on:
6-
push:
7-
branches: [ "master" ]
8-
pull_request:
9-
branches: [ "master" ]
6+
workflow_call:
7+
inputs:
8+
target:
9+
required: true
10+
type: string
11+
target-in-caps:
12+
required: true
13+
type: string
14+
channel:
15+
required: true
16+
type: string
1017

1118
jobs:
12-
style:
13-
name: Check Style
19+
test-software-aes:
1420
runs-on: ubuntu-latest
15-
21+
name: Test of Software Impl on ${{ inputs.target }}
1622
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v3
23+
- uses: actions/checkout@v3
1924

20-
- name: Install rust
25+
- name: Install Rust
2126
uses: actions-rs/toolchain@v1
2227
with:
23-
toolchain: stable
24-
components: rustfmt
28+
toolchain: ${{ inputs.channel }}
29+
target: ${{ inputs.target }}
2530
profile: minimal
31+
components: clippy
2632
override: true
2733

28-
- name: Rustfmt check
34+
- name: Clippy
2935
uses: actions-rs/cargo@v1
3036
with:
31-
command: fmt
32-
args: --all --check
37+
command: clippy
38+
args: --target ${{ inputs.target }}
3339

34-
test:
35-
runs-on: ubuntu-latest
40+
- name: Build
41+
uses: actions-rs/cargo@v1
42+
with:
43+
use-cross: true
44+
command: build --verbose
45+
args: --target ${{ inputs.target }}
3646

37-
# TODO: add more platforms (all tier 1 and tier 2, tier 3 testing is optional)
38-
39-
strategy:
40-
matrix:
41-
impl:
42-
- name: AES-NI
43-
target:
44-
- triple: x86_64-unknown-linux-gnu
45-
caps: X86_64_UNKNOWN_LINUX_GNU
46-
- triple: x86_64-pc-windows-msvc
47-
caps: X86_64_UNKNOWN_PC_WINDOWS_MSVC
48-
rustflags: -C target-feature=+sse4.1,+aes
49-
channel:
50-
- stable
51-
- beta
52-
- nightly
53-
- name: AES-NI with VAES
54-
target:
55-
- triple: x86_64-unknown-linux-gnu
56-
caps: X86_64_UNKNOWN_LINUX_GNU
57-
- triple: x86_64-pc-windows-msvc
58-
caps: X86_64_UNKNOWN_PC_WINDOWS_MSVC
59-
rustflags: -C target-feature=+vaes
60-
channel: nightly
61-
- name: AES-NI with VAES and AVX-512
62-
target:
63-
- triple: x86_64-unknown-linux-gnu
64-
caps: X86_64_UNKNOWN_LINUX_GNU
65-
- triple: x86_64-pc-windows-msvc
66-
caps: X86_64_UNKNOWN_PC_WINDOWS_MSVC
67-
rustflags: -C target-feature=+vaes,+avx512f
68-
channel: nightly
69-
- name: Neon
70-
target:
71-
- triple: aarch64-unknown-linux-gnu
72-
caps: AARCH64_UNKNOWN_LINUX_GNU
73-
rustflags: -C target-feature=+aes
74-
channel:
75-
- stable
76-
- beta
77-
- nightly
78-
- name: Risc-V RV64
79-
target:
80-
- triple: riscv64gc-unknown-linux-gnu
81-
caps: RISCV64GC_UNKNOWN_LINUX_GNU
82-
rustflags: -C target-feature=+zkne,+zknd
83-
channel: nightly
84-
- name: Risc-V RV32
85-
target:
86-
- triple: riscv32i-unknown-none-elf
87-
caps: RISCV32I_UNKNOWN_NONE_ELF
88-
rustflags: -C target-feature=+zkne,+zknd
89-
channel: nightly
90-
- name: Software AES
91-
target:
92-
- triple: x86_64-unknown-linux-gnu
93-
caps: X86_64_UNKNOWN_LINUX_GNU
94-
rustflags: -C target-feature=
95-
channel:
96-
- stable
97-
- beta
98-
- nightly
99-
include:
100-
- channel: nightly
101-
features: --features=nightly
102-
103-
name: Test ${{ matrix.impl.name }} on ${{ matrix.impl.target.triple }}
47+
- name: Test
48+
uses: actions-rs/cargo@v1
49+
with:
50+
use-cross: true
51+
command: test --verbose
52+
args: --target ${{ inputs.target }}
10453

54+
test-aesni:
55+
# simple test for x86(64)
56+
if: contains(inputs.target, '86')
57+
runs-on: ubuntu-latest
58+
name: Test of AESNI on ${{ inputs.target }}
10559
steps:
10660
- uses: actions/checkout@v3
10761

10862
- name: Install Rust
10963
uses: actions-rs/toolchain@v1
11064
with:
111-
toolchain: ${{ matrix.impl.channel }}
112-
target: ${{ matrix.impl.target.triple }}
65+
toolchain: ${{ inputs.channel }}
66+
target: ${{ inputs.target }}
11367
profile: minimal
11468
components: clippy
11569
override: true
11670

117-
- run: ${{ format('echo "CROSS_TARGET_{0}_RUSTFLAGS={1}" >> $GITHUB_ENV', matrix.impl.target.caps, matrix.impl.rustflags) }}
71+
- run: ${{ format('echo "CROSS_TARGET_{0}_RUSTFLAGS=+sse4.1,+aes"', inputs.target-in-caps) }}
11872

11973
- name: Clippy
12074
uses: actions-rs/cargo@v1
12175
with:
12276
command: clippy
123-
args: ${{ format('--target {0} {1}', matrix.impl.target.triple, matrix.features || '') }}
77+
args: --target ${{ inputs.target }}
12478

12579
- name: Build
12680
uses: actions-rs/cargo@v1
12781
with:
12882
use-cross: true
12983
command: build --verbose
130-
args: ${{ format('--target {0} {1}', matrix.impl.target.triple, matrix.features || '') }}
84+
args: --target ${{ inputs.target }}
13185

13286
- name: Test
13387
uses: actions-rs/cargo@v1
13488
with:
13589
use-cross: true
13690
command: test --verbose
137-
args: ${{ format('--target {0} {1}', matrix.impl.target.triple, matrix.features || '') }}
91+
args: --target ${{ inputs.target }}
92+
93+
test-aesni-vaes:
94+
if: contains(inputs.target, '86') && inputs.channel == 'nightly'
95+
runs-on: ubuntu-latest
96+
name: Test of AESNI with VAES on ${{ inputs.target }}
97+
steps:
98+
- uses: actions/checkout@v3
99+
100+
- name: Install Rust
101+
uses: actions-rs/toolchain@v1
102+
with:
103+
toolchain: ${{ inputs.channel }}
104+
target: ${{ inputs.target }}
105+
profile: minimal
106+
components: clippy
107+
override: true
108+
109+
- run: ${{ format('echo "CROSS_TARGET_{0}_RUSTFLAGS=+vaes"', inputs.target-in-caps) }}
110+
111+
- name: Clippy
112+
uses: actions-rs/cargo@v1
113+
with:
114+
command: clippy
115+
args: --target ${{ inputs.target }} --features=nightly
116+
117+
- name: Build
118+
uses: actions-rs/cargo@v1
119+
with:
120+
use-cross: true
121+
command: build --verbose
122+
args: --target ${{ inputs.target }} --features=nightly
123+
124+
- name: Test
125+
uses: actions-rs/cargo@v1
126+
with:
127+
use-cross: true
128+
command: test
129+
args: --verbose --target ${{ inputs.target }} --features=nightly
130+
131+
test-aesni-vaes-avx512f:
132+
if: contains(inputs.target, '86') && inputs.channel == 'nightly'
133+
runs-on: ubuntu-latest
134+
name: Test of AESNI with VAES and AVX-512 on ${{ inputs.target }}
135+
steps:
136+
- uses: actions/checkout@v3
137+
138+
- name: Install Rust
139+
uses: actions-rs/toolchain@v1
140+
with:
141+
toolchain: ${{ inputs.channel }}
142+
target: ${{ inputs.target }}
143+
profile: minimal
144+
components: clippy
145+
override: true
146+
147+
- run: ${{ format('echo "CROSS_TARGET_{0}_RUSTFLAGS=+vaes,+avx512f"', inputs.target-in-caps) }}
148+
149+
- name: Clippy
150+
uses: actions-rs/cargo@v1
151+
with:
152+
command: clippy
153+
args: --target ${{ inputs.target }} --features=nightly
154+
155+
- name: Build
156+
uses: actions-rs/cargo@v1
157+
with:
158+
use-cross: true
159+
command: build
160+
args: --verbose --target ${{ inputs.target }} --features=nightly
161+
162+
- name: Test
163+
uses: actions-rs/cargo@v1
164+
with:
165+
use-cross: true
166+
command: test
167+
args: --verbose --target ${{ inputs.target }} --features=nightly

0 commit comments

Comments
 (0)