-
Notifications
You must be signed in to change notification settings - Fork 8
123 lines (102 loc) · 3.29 KB
/
rust.yaml
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
name: Rust CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: write
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
override: true
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
id: cargo-build-cache
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('./Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Cache Nextest installation
uses: actions/cache@v2
with:
path: ~/.cargo/bin/cargo-nextest
key: ${{ runner.os }}-cargo-nextest
- name: Install Nextest if not cached
run: |
if [ ! -f ~/.cargo/bin/cargo-nextest ]; then
cargo install cargo-nextest
fi
- name: Check no default features
run: cargo check --no-default-features
- name: Check formatting
run: cargo fmt -- --check
- name: Lint with Clippy
run: cargo clippy --workspace --all-features --bins --tests
- name: Build
if: steps.cargo-build-cache.outputs.cache-hit != 'true'
run: cargo build --release --workspace --all-features --verbose
- name: Run tests with Nextest
run: cargo nextest run --all-features --workspace --verbose
- name: Run docs
run: cargo doc --workspace --all-features --no-deps --document-private-items --verbose
- name: Cache mdbook installation
uses: actions/cache@v2
with:
path: ~/.cargo/bin/mdbook
key: ${{ runner.os }}-mdbook
- name: Cache mdbook-mermaid installation
uses: actions/cache@v2
with:
path: ~/.cargo/bin/mdbook
key: ${{ runner.os }}-mdbook-mermaid
- name: Install mdBook if not installed already
run: |
if [ ! -f ~/.cargo/bin/mdbook ]; then
cargo install mdbook
fi
- name: Install mdBook-mermaid if not installed already
run: |
if [ ! -f ~/.cargo/bin/mdbook-mermaid ]; then
cargo install mdbook-mermaid
fi
- name: Cache mdBook build
id: mdbook-build-cache
uses: actions/cache@v3
with:
path: ./docs/book/
key: ${{ runner.os }}-mdbook-${{ hashFiles('./docs/**') }}
restore-keys: |
${{ runner.os }}-mdbook-
- name: Build the book
if: steps.mdbook-build-cache.outputs.cache-hit != 'true'
run: mdbook build ./docs/
- name: Deploy book to GitHub Pages
if: github.ref == 'refs/heads/main' # Deploy only when PR is merged to main
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book/