-
Notifications
You must be signed in to change notification settings - Fork 17
136 lines (136 loc) · 5.5 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: CI
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- "**"
paths-ignore:
- '**.md'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v4
- name: install toolchains
run: |
rustup set profile minimal
rustup toolchain install stable nightly --no-self-update
- name: build
run: cargo build --workspace --features serde,iris,mnist,neural-network --all-targets -v
- name: test
run: cargo test --workspace --no-default-features --features serde,mnist,neural-network -v
- name: test avx
env:
RUST_BUILD_RUSTFLAGS: -Ctarget-feature=+avx
run: cargo test --test=integration_tests --no-default-features --features neural-network --target ${{ matrix.target }} -v conv2_direct
- name: test fma
env:
RUST_BUILD_RUSTFLAGS: -Ctarget-feature=+fma
run: cargo test --test=integration_tests --no-default-features --features neural-network --target ${{ matrix.target }} -v conv2_direct
- name: install cargo-careful
# windows and mac too slow
if: ${{ matrix.os == 'ubuntu-latest' }}
run: cargo +nightly install cargo-careful
- name: careful test
if: ${{ matrix.os == 'ubuntu-latest' }}
run: cargo +nightly careful test --test=integration_tests --no-default-features --features neural-network -v
- name: careful test single-thread
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
RAYON_NUM_THREADS: 1
run: cargo +nightly careful test --test=integration_tests --no-default-features --features neural-network -v
- name: install wasm-pack
if: ${{ matrix.os == 'ubuntu-latest' }}
run: cargo install wasm-pack -vv
- name: wasm test
if: ${{ matrix.os == 'ubuntu-latest' }}
run: wasm-pack test --headless --firefox -- --no-default-features --features serde,neural-network -vv
env:
# conv_direct won't compile without optimization
RUSTFLAGS: --cfg run_in_browser -C opt-level=1
krnlc:
runs-on: ubuntu-latest
timeout-minutes: 10
# spirv tools install copied from https://github.com/EmbarkStudios/rust-gpu/blob/main/.github/workflows/ci.yaml
env:
spirv_tools_version: "20221024"
spirv_tools_linux_url: "https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1863/20221024-094528/install.tgz"
steps:
- uses: actions/checkout@v4
- name: install toolchains
run: |
rustup set profile minimal
rustup toolchain install nightly --no-self-update
rustup toolchain install nightly-2023-05-27 --component rust-src rustc-dev llvm-tools-preview --no-self-update
- name: install spirv-tools
run: |
sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
mkdir "${HOME}/spirv-tools"
curl -fL "$spirv_tools_linux_url" | tar -xz -C "${HOME}/spirv-tools"
echo "${HOME}/spirv-tools/install/bin" >> $GITHUB_PATH
- name: install krnlc
run: cargo +nightly-2023-05-27 install krnlc@0.1.0 --locked -v --no-default-features --features use-installed-tools
- name: krnlc
run: krnlc -p autograph -v --check
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: install toolchains
run: |
rustup set profile minimal
rustup toolchain install stable --component rustfmt clippy rust-docs --no-self-update
rustup toolchain install nightly --component rust-docs --no-self-update
rustup toolchain install nightly-2023-05-27 --component rustfmt clippy rust-src rustc-dev llvm-tools-preview --no-self-update
rustup toolchain install 1.70.0 --no-self-update
- name: fmt
run: cargo fmt --check
- name: install cargo-hack
run: cargo install cargo-hack -v
- name: clippy
env:
CARGO_ALIAS_CLIPPYALL: clippy --workspace
run: |
cargo hack --feature-powerset --skip default,learn,dataset,iris,mnist clippyall --all-targets -v -- -D warnings
cargo clippy --no-default-features --features iris,mnist --all-targets -v -- -D warnings
- name: rustdoc
run: |
cargo rustdoc -p autograph_derive -- -D warnings
cargo hack --feature-powerset --include-features device,serde,neural-network rustdoc -- --D warnings -A unexpected_cfgs
cargo rustdoc --all-features -- --D warnings -A unexpected_cfgs
cargo +nightly rustdoc --all-features -- --D warnings --cfg doc_cfg -A unexpected_cfgs
- name: msrv
run: |
cargo +nightly generate-lockfile -Zmsrv-policy --config "resolver.something-like-precedence='something-like-rust-version'"
cat Cargo.lock
cargo +1.70.0 check -p autograph -p neural-network-mnist-example --all-features --all-targets -v
cargo +1.70.0 check -p neural-network-benches --all-targets -v
deny:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1