-
Notifications
You must be signed in to change notification settings - Fork 68
107 lines (98 loc) · 2.99 KB
/
rust.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
name: Rust
on:
push:
branches: [main]
pull_request:
release:
types: [published]
env:
RUSTFLAGS: -D warnings
jobs:
complete:
if: always()
needs: [fmt, rust-analyzer-compat, build-and-test, docs]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: cargo fmt --all --check
rust-analyzer-compat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: rustup +nightly component add rust-analyzer
- name: Check if rust-analyzer encounters any errors parsing project
run: rustup run nightly rust-analyzer analysis-stats . 2>&1 | (! grep ERROR)
build-and-test:
strategy:
matrix:
sys:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.sys.os }}
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: rustup target add ${{ matrix.sys.target }}
- run: rustup target add wasm32-unknown-unknown
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-
- uses: actions/cache@v3
with:
path: target/
key: ${{ github.job }}-target-${{ strategy.job-index }}-${{ github.sha }}
restore-keys: |
${{ github.job }}-target-${{ strategy.job-index }}
${{ github.job }}-target-
- if: github.ref_protected
run: rm -fr target
- run: cargo install --locked --version 0.5.16 cargo-hack
- run: cargo hack build --target wasm32-unknown-unknown --profile release
- run: cargo hack --feature-powerset --exclude-features docs build --target ${{ matrix.sys.target }}
- run: cargo hack --feature-powerset --exclude-features docs test --target ${{ matrix.sys.target }}
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup install nightly
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-
- uses: actions/cache@v3
with:
path: target/
key: ${{ github.job }}-target-${{ github.sha }}
restore-keys: |
${{ github.job }}-target
${{ github.job }}-target-
- if: github.ref_protected
run: rm -fr target
- run: make doc
publish:
if: github.event_name == 'release'
needs: [complete]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: cargo install --locked --version 0.2.35 cargo-workspaces
- run: make publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}