-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (127 loc) · 4.59 KB
/
validate.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
name: validate
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
rustfmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
components: rustfmt
- name: Run cargo fmt
run: cargo fmt -- --check
# - name: Run cargo clippy
# run: cargo clippy -- -D warnings
check-std:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [blaze/macos-14, ubuntu-latest, windows-latest]
rust: [stable]
backend: ["ndarray", "wgpu", "torch"]
include:
- cache: stable
rust: stable
exclude:
# windows can have CPU Vulkan but Burn doesn't select CPU well yet
- os: windows-latest
backend: "wgpu"
# ubuntu is throwing SIGSEGV
- os: ubuntu-latest
backend: "wgpu"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
toolchain: ${{ matrix.rust }}
matcher: ${{ runner.os == 'Linux' && matrix.rust == 'stable' && matrix.backend == 'ndarray' }}
rustflags: "" # Disable when we're ready
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ matrix.cache }}-${{ matrix.backend }}-${{ hashFiles('**/Cargo.toml') }}
- name: (Linux) Install llvmpipe, lavapipe
if: runner.os == 'Linux'
run: |-
sudo apt-get update -y -qq
sudo add-apt-repository ppa:kisak/kisak-mesa -y
sudo apt-get update
sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
- name: (Windows) Install warp
if: runner.os == 'Windows'
shell: bash
run: |-
set -e
curl.exe -L https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/1.0.7.1 -o warp.zip
7z.exe e warp.zip -owarp build/native/amd64/d3d10warp.dll
mkdir -p target/debug/deps
cp -v warp/d3d10warp.dll target/debug/
cp -v warp/d3d10warp.dll target/debug/deps
- name: (Windows) Install mesa
if: runner.os == 'Windows'
shell: bash
run: |-
set -e
curl.exe -L https://github.com/pal1000/mesa-dist-win/releases/download/23.2.1/mesa3d-23.2.1-release-msvc.7z -o mesa.7z
7z.exe e mesa.7z -omesa x64/{opengl32.dll,libgallium_wgl.dll,libglapi.dll,vulkan_lvp.dll,lvp_icd.x86_64.json}
mkdir -p target/debug/deps
cp -v mesa/* target/debug/
cp -v mesa/* target/debug/deps
echo "VK_DRIVER_FILES=$PWD/mesa/lvp_icd.x86_64.json" >> "$GITHUB_ENV"
echo "GALLIUM_DRIVER=llvmpipe" >> "$GITHUB_ENV"
- name: (Windows) Install dxc
if: runner.os == 'Windows'
uses: napokue/[email protected]
- name: Run tests
shell: bash
run: |-
echo "::group::${{ matrix.backend }}"
cargo test --features ${{ matrix.backend }}
echo "::endgroup::"
# test accelerate feature for ndarray on macOS
if [ "${{ matrix.backend }}" = "ndarray" ] && [ "${{ runner.os }}" = "macOS" ]; then
echo "::group::${{ matrix.backend }} with accelerate"
cargo test --features ${{ matrix.backend }} --features accelerate
echo "::endgroup::"
fi
check-no-std:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable]
target: ["wasm32-unknown-unknown", "thumbv7m-none-eabi"]
backend: ["ndarray"]
include:
- cache: stable
rust: stable
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
cache: false
matcher: false
rustflags: "" # Disable when we're ready
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ matrix.cache }}-${{ matrix.backend }}-${{ hashFiles('**/Cargo.toml') }}
- name: Run tests
run: cargo test --no-default-features --features ${{ matrix.backend }}
- name: Build ${{ matrix.target }}
run: cargo build --no-default-features --features ${{ matrix.backend }} --target ${{ matrix.target }}