-
Notifications
You must be signed in to change notification settings - Fork 459
148 lines (131 loc) · 4.11 KB
/
test.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
137
138
139
140
141
142
143
144
145
146
147
148
name: test
on:
push:
branches:
- main
paths:
- '**.rs'
- '**.sh'
- '**.ps1'
- '**.yml'
- '**.toml'
- '!**.md'
- '!LICENSE-APACHE'
- '!LICENSE-MIT'
pull_request:
types: [opened, synchronize]
paths:
- '**.rs'
- '**.sh'
- '**.ps1'
- '**.yml'
- '**.toml'
- '!**.md'
- '!LICENSE-APACHE'
- '!LICENSE-MIT'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, ubuntu-22.04]
rust: [stable, 1.71.0]
test: ['std', 'no-std', 'examples']
include:
- cache: stable
rust: stable
- cache: 1-71-0
rust: 1.71.0
- coverage-flags: COVERAGE=1
rust: stable
test: std
os: ubuntu-22.04
- wgpu-flags: DISABLE_WGPU=1
rust: stable
test: std
os: macos-13
exclude:
# only need to check this once
- rust: 1.71.0
test: 'examples'
# only need to check this once
- os: macos-13
test: 'no-std'
steps:
- name: checkout
uses: actions/checkout@v4
- name: install rust
uses: dtolnay/rust-toolchain@master
with:
components: rustfmt, clippy
toolchain: ${{ matrix.rust }}
- name: caching
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-${{ matrix.cache }}-${{ matrix.test}}-${{ hashFiles('**/Cargo.toml') }}
prefix-key: "v5-rust"
- name: free disk space
if: runner.os == 'Linux'
run: |
df -h
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
df -h
cargo clean --package burn-tch
- name: install llvmpipe and 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: Run cargo clippy for stable version
if: matrix.rust == 'stable' && matrix.test == 'std' && runner.os == 'Linux'
uses: giraffate/clippy-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Run clippy for each workspace, targets, and featrues, considering
# warnings as errors
clippy_flags: --all-targets -- -Dwarnings
# Do not filter results
filter_mode: nofilter
# Report clippy annotations as snippets
reporter: github-pr-check
- name: Install grcov
if: matrix.rust == 'stable' && matrix.test == 'std' && runner.os == 'Linux'
env:
GRCOV_LINK: https://github.com/mozilla/grcov/releases/download
GRCOV_VERSION: v0.8.18
run: |
curl -L "$GRCOV_LINK/$GRCOV_VERSION/grcov-x86_64-unknown-linux-musl.tar.bz2" |
tar xj -C $HOME/.cargo/bin
- name: run checks & tests
run: ${{ matrix.coverage-flags }} ${{ matrix.wgpu-flags }} CI_RUN=1 cargo xtask run-checks ${{ matrix.test }}
- name: Codecov upload
if: matrix.rust == 'stable' && matrix.test == 'std' && runner.os == 'Linux'
uses: codecov/codecov-action@v3
with:
files: lcov.info
check-typos:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: caching
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-typos-${{ hashFiles('**/Cargo.toml') }}
prefix-key: "v5-rust"
- name: Install typos
env:
TYPOS_LINK: https://github.com/crate-ci/typos/releases/download
TYPOS_VERSION: v1.16.20
run: |
curl -L "$TYPOS_LINK/$TYPOS_VERSION/typos-$TYPOS_VERSION-x86_64-unknown-linux-musl.tar.gz" |
tar xz -C $HOME/.cargo/bin
- name: run spelling checks using typos
run: CI_RUN=1 cargo xtask run-checks typos