|
3 | 3 | name: Rust
|
4 | 4 |
|
5 | 5 | 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 |
10 | 17 |
|
11 | 18 | jobs:
|
12 |
| - style: |
13 |
| - name: Check Style |
| 19 | + test-software-aes: |
14 | 20 | runs-on: ubuntu-latest
|
15 |
| - |
| 21 | + name: Test of Software Impl on ${{ inputs.target }} |
16 | 22 | steps:
|
17 |
| - - name: Checkout |
18 |
| - uses: actions/checkout@v3 |
| 23 | + - uses: actions/checkout@v3 |
19 | 24 |
|
20 |
| - - name: Install rust |
| 25 | + - name: Install Rust |
21 | 26 | uses: actions-rs/toolchain@v1
|
22 | 27 | with:
|
23 |
| - toolchain: stable |
24 |
| - components: rustfmt |
| 28 | + toolchain: ${{ inputs.channel }} |
| 29 | + target: ${{ inputs.target }} |
25 | 30 | profile: minimal
|
| 31 | + components: clippy |
26 | 32 | override: true
|
27 | 33 |
|
28 |
| - - name: Rustfmt check |
| 34 | + - name: Clippy |
29 | 35 | uses: actions-rs/cargo@v1
|
30 | 36 | with:
|
31 |
| - command: fmt |
32 |
| - args: --all --check |
| 37 | + command: clippy |
| 38 | + args: --target ${{ inputs.target }} |
33 | 39 |
|
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 }} |
36 | 46 |
|
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 }} |
104 | 53 |
|
| 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 }} |
105 | 59 | steps:
|
106 | 60 | - uses: actions/checkout@v3
|
107 | 61 |
|
108 | 62 | - name: Install Rust
|
109 | 63 | uses: actions-rs/toolchain@v1
|
110 | 64 | with:
|
111 |
| - toolchain: ${{ matrix.impl.channel }} |
112 |
| - target: ${{ matrix.impl.target.triple }} |
| 65 | + toolchain: ${{ inputs.channel }} |
| 66 | + target: ${{ inputs.target }} |
113 | 67 | profile: minimal
|
114 | 68 | components: clippy
|
115 | 69 | override: true
|
116 | 70 |
|
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) }} |
118 | 72 |
|
119 | 73 | - name: Clippy
|
120 | 74 | uses: actions-rs/cargo@v1
|
121 | 75 | with:
|
122 | 76 | command: clippy
|
123 |
| - args: ${{ format('--target {0} {1}', matrix.impl.target.triple, matrix.features || '') }} |
| 77 | + args: --target ${{ inputs.target }} |
124 | 78 |
|
125 | 79 | - name: Build
|
126 | 80 | uses: actions-rs/cargo@v1
|
127 | 81 | with:
|
128 | 82 | use-cross: true
|
129 | 83 | command: build --verbose
|
130 |
| - args: ${{ format('--target {0} {1}', matrix.impl.target.triple, matrix.features || '') }} |
| 84 | + args: --target ${{ inputs.target }} |
131 | 85 |
|
132 | 86 | - name: Test
|
133 | 87 | uses: actions-rs/cargo@v1
|
134 | 88 | with:
|
135 | 89 | use-cross: true
|
136 | 90 | 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