-
Notifications
You must be signed in to change notification settings - Fork 2
96 lines (77 loc) · 2.36 KB
/
rust-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
name: Rust CI
on:
push:
branches: ["main"]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Uninstall pre-installed tools
run: |
rm -f ~/.cargo/bin/rust-analyzer
rm -f ~/.cargo/bin/rustfmt
rm -f ~/.cargo/bin/cargo-fmt
- name: Update Rust toolchain and components
run: |
rustup update
rustup component add rustfmt
rustup component add clippy
- name: Build
run: RUSTFLAGS=-Dwarnings cargo build --all-features --all-targets --verbose
- name: Verify target directory exists
run: |
echo "Checking if target directory exists and is not empty"
ls -la target
- name: Run tests
run: cargo test --verbose
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets
- name: Check format
run: cargo fmt -- --check
- name: Build and test documentation
run: cargo doc --no-deps --verbose
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
docs:
permissions:
contents: write
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: ✅ Checkout
uses: actions/checkout@v4
- name: 🪨 Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: '0.4.40'
- name: 📓 Build website
run: mdbook build website
- name: 🚀 Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website/book
cname: alba.cardano-scaling.org