-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (71 loc) · 1.9 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
name: Rust
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
CACHE_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
jobs:
validity:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check source is valid
run: cargo check --workspace
formating:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting with rustfmt
run: cargo fmt --all --check
- uses: brndnmtthws/rust-action-cargo-binstall@v1
with:
packages: taplo-cli
- name: Check TOML formatting with taplo
run: |
taplo fmt --check **/*/Cargo.toml
tests:
needs: validity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run all tests
run: cargo test --workspace --verbose --all-features
clippy:
needs: validity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Lint code with clippy
run: cargo clippy
publish-ability:
runs-on: ubuntu-latest
if: false
steps:
- uses: actions/checkout@v4
- name: Check that it will publish to crates
run: |
cargo metadata --offline --format-version 1 --no-deps | jq -r ".workspace_members[]" | while read -r _n _v pathInfo ; do
cd ${pathInfo:13:-1}
cargo publish --no-verify --dry-run
done
shell: bash