|
1 | | -name: CI (placeholder) |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
4 | 8 | workflow_dispatch: |
5 | 9 |
|
| 10 | +env: |
| 11 | + CARGO_TERM_COLOR: always |
| 12 | + RUST_BACKTRACE: 1 |
| 13 | + |
6 | 14 | jobs: |
7 | | - todo: |
| 15 | + test: |
| 16 | + name: Test |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install Rust toolchain |
| 23 | + uses: dtolnay/rust-toolchain@stable |
| 24 | + |
| 25 | + - name: Cache cargo registry |
| 26 | + uses: actions/cache@v4 |
| 27 | + with: |
| 28 | + path: ~/.cargo/registry |
| 29 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 30 | + |
| 31 | + - name: Cache cargo index |
| 32 | + uses: actions/cache@v4 |
| 33 | + with: |
| 34 | + path: ~/.cargo/git |
| 35 | + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} |
| 36 | + |
| 37 | + - name: Cache cargo build |
| 38 | + uses: actions/cache@v4 |
| 39 | + with: |
| 40 | + path: target |
| 41 | + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} |
| 42 | + |
| 43 | + - name: Run tests |
| 44 | + run: cargo test --all-features --workspace |
| 45 | + |
| 46 | + fmt: |
| 47 | + name: Format |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - name: Checkout code |
| 51 | + uses: actions/checkout@v4 |
| 52 | + |
| 53 | + - name: Install Rust toolchain |
| 54 | + uses: dtolnay/rust-toolchain@stable |
| 55 | + with: |
| 56 | + components: rustfmt |
| 57 | + |
| 58 | + - name: Check formatting |
| 59 | + run: cargo fmt --all -- --check |
| 60 | + |
| 61 | + clippy: |
| 62 | + name: Clippy |
8 | 63 | runs-on: ubuntu-latest |
9 | 64 | steps: |
10 | | - - run: echo "TODO: configure fmt, lint, test, deny, audit pipelines" |
| 65 | + - name: Checkout code |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Install Rust toolchain |
| 69 | + uses: dtolnay/rust-toolchain@stable |
| 70 | + with: |
| 71 | + components: clippy |
| 72 | + |
| 73 | + - name: Cache cargo registry |
| 74 | + uses: actions/cache@v4 |
| 75 | + with: |
| 76 | + path: ~/.cargo/registry |
| 77 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 78 | + |
| 79 | + - name: Cache cargo index |
| 80 | + uses: actions/cache@v4 |
| 81 | + with: |
| 82 | + path: ~/.cargo/git |
| 83 | + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} |
| 84 | + |
| 85 | + - name: Cache cargo build |
| 86 | + uses: actions/cache@v4 |
| 87 | + with: |
| 88 | + path: target |
| 89 | + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} |
| 90 | + |
| 91 | + - name: Run clippy |
| 92 | + run: cargo clippy --all-targets --all-features --workspace -- -D warnings |
| 93 | + |
| 94 | + build: |
| 95 | + name: Build |
| 96 | + runs-on: ${{ matrix.os }} |
| 97 | + strategy: |
| 98 | + matrix: |
| 99 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 100 | + steps: |
| 101 | + - name: Checkout code |
| 102 | + uses: actions/checkout@v4 |
| 103 | + |
| 104 | + - name: Install Rust toolchain |
| 105 | + uses: dtolnay/rust-toolchain@stable |
| 106 | + |
| 107 | + - name: Cache cargo registry |
| 108 | + uses: actions/cache@v4 |
| 109 | + with: |
| 110 | + path: ~/.cargo/registry |
| 111 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 112 | + |
| 113 | + - name: Cache cargo index |
| 114 | + uses: actions/cache@v4 |
| 115 | + with: |
| 116 | + path: ~/.cargo/git |
| 117 | + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} |
| 118 | + |
| 119 | + - name: Cache cargo build |
| 120 | + uses: actions/cache@v4 |
| 121 | + with: |
| 122 | + path: target |
| 123 | + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} |
| 124 | + |
| 125 | + - name: Build release binary |
| 126 | + run: cargo build --release --all-features --workspace |
0 commit comments