|
1 | | -name: CI |
| 1 | +name: Build and Test Rust Backend |
2 | 2 |
|
3 | | -on: |
4 | | - push: |
5 | | - branches: ["main"] |
6 | | - pull_request: |
7 | | - types: ["opened", "synchronize", "reopened"] |
8 | | - branches: ["main"] |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +permissions: |
| 6 | + contents: read |
9 | 7 |
|
10 | 8 | jobs: |
11 | | - test: |
12 | | - name: Sdk Tests |
| 9 | + ci: |
13 | 10 | runs-on: ubuntu-latest |
14 | 11 | steps: |
15 | 12 | - uses: actions/checkout@v4 |
16 | 13 |
|
17 | | - - name: Install the Rust toolchain |
18 | | - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 14 | + - uses: dtolnay/rust-toolchain@stable |
| 15 | + with: |
| 16 | + components: rustfmt, clippy |
19 | 17 |
|
20 | | - - name: Run tests |
21 | | - run: cargo test --verbose |
| 18 | + - uses: actions/cache@v4 |
| 19 | + with: |
| 20 | + path: | |
| 21 | + ~/.cargo/registry/index/ |
| 22 | + ~/.cargo/registry/cache/ |
| 23 | + ~/.cargo/git/db/ |
| 24 | + target/ |
| 25 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 26 | + restore-keys: ${{ runner.os }}-cargo- |
22 | 27 |
|
23 | | - fmt: |
24 | | - name: Rustfmt |
25 | | - runs-on: ubuntu-latest |
26 | | - steps: |
27 | | - - uses: actions/checkout@v4 |
| 28 | + - name: Format check |
| 29 | + run: cargo fmt --all -- --check |
28 | 30 |
|
29 | | - - name: Install the Rust toolchain |
30 | | - uses: actions-rust-lang/setup-rust-toolchain@v1 |
31 | | - with: |
32 | | - components: rustfmt |
33 | | - cache: false |
34 | | - |
35 | | - - name: Check formatting |
36 | | - run: cargo fmt --check |
37 | | - |
38 | | - # clippy: |
39 | | - # name: Clippy |
40 | | - # runs-on: ubuntu-latest |
41 | | - # steps: |
42 | | - # - uses: actions/checkout@v4 |
43 | | - |
44 | | - # - name: Install the Rust toolchain |
45 | | - # uses: actions-rust-lang/setup-rust-toolchain@v1 |
46 | | - # with: |
47 | | - # components: clippy |
48 | | - # cache: false |
49 | | - |
50 | | - # - name: Run clippy |
51 | | - # run: cargo clippy -- -D warnings |
| 31 | + # - name: Clippy |
| 32 | + # run: cargo clippy --all-targets -- -D warnings |
| 33 | + |
| 34 | + - name: Test |
| 35 | + run: cargo test |
| 36 | + |
| 37 | + - name: Build |
| 38 | + run: cargo build --release |
0 commit comments