Skip to content

Commit ffce298

Browse files
Port ci from travis to github actions (#352)
* Setup github actions with a reusable workflow * Change doc tests referring to packed_simd_2 * Skip examples * Fix target features for avx512 rotate tests * Manually list target and rustflags combinations * Disable position independent code on i586 and i686 to make verify tests pass * Add timeout to job * Reuse action for docs and benchmarks * actions-rs is unmaintained, switch to dtolnay/rust-toolchain * Remove ci jobs for mips since it lacks nightly support Co-authored-by: Jubilee <[email protected]> * Leave trailing newlines on .yml Co-authored-by: Jubilee <[email protected]>
1 parent d28356b commit ffce298

File tree

8 files changed

+362
-12
lines changed

8 files changed

+362
-12
lines changed

.github/workflows/benchmarks.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: benchmarks
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
x86_64-unknown-linux-gnu:
12+
uses: ./.github/workflows/run-ci-script.yml
13+
with:
14+
target: x86_64-unknown-linux-gnu
15+
setup_script: ci/setup_benchmarks.sh
16+
script: ci/benchmark.sh
17+
norun: 1
18+
verify: 1
19+
# FIXME: figure out how to add downloaded ispc to PATH
20+
# features: ispc
21+
x86_64-apple-darwin:
22+
uses: ./.github/workflows/run-ci-script.yml
23+
with:
24+
target: x86_64-apple-darwin
25+
runner: macos-latest
26+
setup_script: ci/setup_benchmarks.sh
27+
script: ci/benchmark.sh
28+
norun: 1
29+
verify: 1
30+
# FIXME: figure out how to add downloaded ispc to PATH
31+
# features: ispc

.github/workflows/ci.yml

+218
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: ci
2+
3+
# trigger for all PRs and changes to master
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
rustfmt:
12+
uses: ./.github/workflows/run-ci-script.yml
13+
with:
14+
script: ci/all.sh check_fmt || true
15+
x86_64-unknown-linux-android:
16+
uses: ./.github/workflows/run-ci-script.yml
17+
strategy:
18+
fail-fast: true
19+
with:
20+
target: x86_64-linux-android
21+
arm-linux-androideabi:
22+
uses: ./.github/workflows/run-ci-script.yml
23+
strategy:
24+
fail-fast: true
25+
with:
26+
target: arm-linux-androideabi
27+
aarch64-unknown-linux-android-NEON:
28+
uses: ./.github/workflows/run-ci-script.yml
29+
strategy:
30+
fail-fast: true
31+
with:
32+
target: aarch64-linux-android
33+
rustflags: -Ctarget-feature=+neon
34+
thumbv7neon-linux-androideabi:
35+
uses: ./.github/workflows/run-ci-script.yml
36+
strategy:
37+
fail-fast: false
38+
with:
39+
target: thumbv7neon-linux-androideabi
40+
i586-unknown-linux-gnu:
41+
uses: ./.github/workflows/run-ci-script.yml
42+
strategy:
43+
fail-fast: false
44+
with:
45+
target: i586-unknown-linux-gnu
46+
rustflags: -Crelocation-model=static
47+
i586-unknown-linux-gnu-SSE:
48+
uses: ./.github/workflows/run-ci-script.yml
49+
strategy:
50+
fail-fast: false
51+
with:
52+
target: i586-unknown-linux-gnu
53+
rustflags: -Crelocation-model=static -Ctarget-feature=+sse
54+
i586-unknown-linux-gnu-SSE2:
55+
uses: ./.github/workflows/run-ci-script.yml
56+
strategy:
57+
fail-fast: false
58+
with:
59+
target: i586-unknown-linux-gnu
60+
rustflags: -Crelocation-model=static -Ctarget-feature=+sse2
61+
i686-unknown-linux-gnu:
62+
uses: ./.github/workflows/run-ci-script.yml
63+
strategy:
64+
fail-fast: false
65+
with:
66+
target: i686-unknown-linux-gnu
67+
rustflags: -Crelocation-model=static
68+
i686-unknown-linux-gnu-SSE4_2:
69+
uses: ./.github/workflows/run-ci-script.yml
70+
strategy:
71+
fail-fast: false
72+
with:
73+
target: i686-unknown-linux-gnu
74+
rustflags: -Crelocation-model=static -Ctarget-feature=+sse4.2
75+
i686-unknown-linux-gnu-AVX2:
76+
uses: ./.github/workflows/run-ci-script.yml
77+
strategy:
78+
fail-fast: false
79+
with:
80+
target: i686-unknown-linux-gnu
81+
rustflags: -Crelocation-model=static -Ctarget-feature=+avx2
82+
x86_64-unknown-linux-gnu:
83+
uses: ./.github/workflows/run-ci-script.yml
84+
strategy:
85+
fail-fast: true
86+
with:
87+
target: x86_64-unknown-linux-gnu
88+
x86_64-unknown-linux-gnu-SSE4_2:
89+
uses: ./.github/workflows/run-ci-script.yml
90+
strategy:
91+
fail-fast: true
92+
with:
93+
target: x86_64-unknown-linux-gnu
94+
rustflags: -Ctarget-feature=+sse4.2
95+
x86_64-unknown-linux-gnu-AVX2:
96+
uses: ./.github/workflows/run-ci-script.yml
97+
strategy:
98+
fail-fast: true
99+
with:
100+
target: x86_64-unknown-linux-gnu
101+
rustflags: -Ctarget-feature=+avx2
102+
arm-unknown-linux-gnueabihf:
103+
uses: ./.github/workflows/run-ci-script.yml
104+
strategy:
105+
fail-fast: true
106+
with:
107+
target: arm-unknown-linux-gnueabihf
108+
armv7-unknown-linux-gnueabihf:
109+
uses: ./.github/workflows/run-ci-script.yml
110+
strategy:
111+
fail-fast: true
112+
with:
113+
target: armv7-unknown-linux-gnueabihf
114+
armv7-unknown-linux-gnueabihf-NEON:
115+
uses: ./.github/workflows/run-ci-script.yml
116+
strategy:
117+
fail-fast: true
118+
with:
119+
target: armv7-unknown-linux-gnueabihf
120+
rustflags: -Ctarget-feature=+neon
121+
thumbv7neon-unknown-linux-gnueabihf:
122+
uses: ./.github/workflows/run-ci-script.yml
123+
strategy:
124+
fail-fast: false
125+
with:
126+
target: thumbv7neon-unknown-linux-gnueabihf
127+
aarch64-unknown-linux-gnu-NEON:
128+
uses: ./.github/workflows/run-ci-script.yml
129+
strategy:
130+
fail-fast: true
131+
with:
132+
target: aarch64-unknown-linux-gnu
133+
rustflags: -Ctarget-feature=+neon
134+
powerpc-unknown-linux-gnu:
135+
uses: ./.github/workflows/run-ci-script.yml
136+
strategy:
137+
fail-fast: false
138+
with:
139+
target: powerpc-unknown-linux-gnu
140+
powerpc64-unknown-linux-gnu:
141+
uses: ./.github/workflows/run-ci-script.yml
142+
strategy:
143+
fail-fast: false
144+
with:
145+
target: powerpc64-unknown-linux-gnu
146+
powerpc64le-unknown-linux-gnu:
147+
uses: ./.github/workflows/run-ci-script.yml
148+
strategy:
149+
fail-fast: true
150+
with:
151+
target: powerpc64le-unknown-linux-gnu
152+
powerpc64le-unknown-linux-gnu-ALTIVEC:
153+
uses: ./.github/workflows/run-ci-script.yml
154+
strategy:
155+
fail-fast: true
156+
with:
157+
target: powerpc64le-unknown-linux-gnu
158+
rustflags: -Ctarget-feature=+altivec
159+
powerpc64le-unknown-linux-gnu-VSX:
160+
uses: ./.github/workflows/run-ci-script.yml
161+
strategy:
162+
fail-fast: true
163+
with:
164+
target: powerpc64le-unknown-linux-gnu
165+
rustflags: -Ctarget-feature=+vsx
166+
s390x-unknown-linux-gnu:
167+
uses: ./.github/workflows/run-ci-script.yml
168+
strategy:
169+
fail-fast: false
170+
with:
171+
target: s390x-unknown-linux-gnu
172+
sparc64-unknown-linux-gnu:
173+
uses: ./.github/workflows/run-ci-script.yml
174+
strategy:
175+
fail-fast: false
176+
with:
177+
target: sparc64-unknown-linux-gnu
178+
wasm32-unknown-unknown:
179+
uses: ./.github/workflows/run-ci-script.yml
180+
strategy:
181+
fail-fast: false
182+
with:
183+
target: wasm32-unknown-unknown
184+
x86_64-apple-darwin-SSE4_2:
185+
uses: ./.github/workflows/run-ci-script.yml
186+
strategy:
187+
fail-fast: true
188+
with:
189+
runner: macos-latest
190+
script: ci/run.sh
191+
target: x86_64-apple-darwin
192+
rustflags: -Ctarget-feature=+sse4.2
193+
x86_64-apple-darwin-AVX:
194+
uses: ./.github/workflows/run-ci-script.yml
195+
strategy:
196+
fail-fast: true
197+
with:
198+
runner: macos-latest
199+
script: ci/run.sh
200+
target: x86_64-apple-darwin
201+
rustflags: -Ctarget-feature=+avx
202+
x86_64-apple-ios:
203+
uses: ./.github/workflows/run-ci-script.yml
204+
strategy:
205+
fail-fast: true
206+
with:
207+
runner: macos-latest
208+
script: ci/run.sh
209+
target: x86_64-apple-ios
210+
aarch-apple-ios:
211+
uses: ./.github/workflows/run-ci-script.yml
212+
strategy:
213+
fail-fast: true
214+
with:
215+
runner: macos-latest
216+
script: ci/run.sh
217+
target: aarch-apple-ios
218+
rustflags: -Ctarget-feature=+neon

.github/workflows/docs.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
docs:
10+
uses: ./.github/workflows/run-ci-script.yml
11+
with:
12+
setup_script: cargo install mdbook
13+
script: ci/dox.sh

.github/workflows/run-ci-script.yml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: run-ci-script
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runner:
7+
required: false
8+
type: string
9+
default: ubuntu-latest
10+
target:
11+
required: false
12+
type: string
13+
default: ''
14+
rustflags:
15+
required: false
16+
type: string
17+
default: ''
18+
script:
19+
required: false
20+
type: string
21+
default: ci/run-docker.sh
22+
setup_script:
23+
required: false
24+
type: string
25+
norun:
26+
required: false
27+
type: string
28+
default: ''
29+
verify:
30+
required: false
31+
type: string
32+
default: ''
33+
features:
34+
required: false
35+
type: string
36+
default: ''
37+
38+
jobs:
39+
run-ci-script:
40+
runs-on: ${{ inputs.runner }}
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
- name: Init Rustup Cache
45+
uses: actions/cache@v2
46+
with:
47+
path: |
48+
~/.rustup/toolchains
49+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/rust-toolchain') }}
50+
- name: Install Toolchain
51+
uses: dtolnay/rust-toolchain@master
52+
with:
53+
# FIXME: change to nightly once https://github.com/rust-lang/packed_simd/pull/350 is merged
54+
# needs to be kept in sync with the toolchain files
55+
toolchain: nightly-2023-06-14
56+
targets: ${{ inputs.target }}
57+
components: rustfmt
58+
- name: Generate Lockfile
59+
run: cargo generate-lockfile
60+
- name: Init Cargo Cache
61+
uses: actions/cache@v2
62+
with:
63+
path: |
64+
~/.cargo/bin/
65+
~/.cargo/registry/index/
66+
~/.cargo/registry/cache/
67+
~/.cargo/git/db/
68+
target/
69+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
70+
- name: Setup
71+
if: ${{ inputs.setup_script != '' }}
72+
run: ${{ inputs.setup_script }}
73+
env:
74+
TARGET: ${{ inputs.target }}
75+
RUSTFLAGS: ${{ inputs.rustflags }}
76+
NORUN: ${{ inputs.norun }}
77+
VERIFY: ${{ inputs.verify }}
78+
FEATURES: ${{ inputs.features }}
79+
- name: Run CI Script
80+
timeout-minutes: 15
81+
run: ${{ inputs.script }}
82+
env:
83+
TARGET: ${{ inputs.target }}
84+
RUSTFLAGS: ${{ inputs.rustflags }}
85+
NORUN: ${{ inputs.norun }}
86+
VERIFY: ${{ inputs.verify }}
87+
FEATURES: ${{ inputs.features }}

ci/run.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,5 @@ if [[ "${NOVERIFY}" != "1" ]]; then
9595
cargo_test --release --manifest-path=target/verify/Cargo.toml
9696
fi
9797

98-
. ci/run_examples.sh
98+
# FIXME: Figure out which examples take too long to run and ignore or adjust those
99+
#. ci/run_examples.sh

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly
1+
nightly-2023-06-14

0 commit comments

Comments
 (0)