|
1 | | -name: Build & Test |
| 1 | +# A few guiding principles. |
| 2 | +# |
| 3 | +# * Always use actions-rust-lang/setup-rust-toolchain for its built-in caching. |
| 4 | +# * Complexity lives in the justfile, this runner is as light as possible. |
| 5 | + |
| 6 | +name: CI |
2 | 7 |
|
| 8 | +# Run on direct commits to master, including merges, and any pull requests against master. |
3 | 9 | on: |
4 | 10 | push: |
5 | 11 | branches: |
6 | 12 | - master |
7 | 13 | pull_request: |
| 14 | + branches: |
| 15 | + - master |
8 | 16 |
|
9 | 17 | jobs: |
10 | | - build: |
| 18 | + # Quick canary of code as well as potential issues with upcoming toolchains. |
| 19 | + check: |
11 | 20 | strategy: |
12 | 21 | matrix: |
13 | | - platform: [ubuntu-latest, macos-latest, windows-latest] |
14 | 22 | toolchain: [stable, beta, nightly] |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + - uses: extractions/setup-just@v3 |
| 27 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 28 | + with: |
| 29 | + toolchain: ${{ matrix.toolchain }} |
| 30 | + components: clippy,rustfmt |
| 31 | + - run: just check |
| 32 | + # Build and test the code across platforms. |
| 33 | + test: |
| 34 | + strategy: |
| 35 | + matrix: |
| 36 | + platform: [ubuntu-latest, macos-latest, windows-latest] |
15 | 37 | runs-on: ${{ matrix.platform }} |
16 | 38 | steps: |
17 | | - - uses: actions/checkout@v3 |
18 | | - - name: Update Toolchain |
19 | | - run: | |
20 | | - rustup default ${{ matrix.toolchain }} |
21 | | - rustup component add --toolchain ${{ matrix.toolchain }} rustfmt |
22 | | - rustup component add --toolchain ${{ matrix.toolchain }} clippy |
23 | | - rustup update ${{ matrix.toolchain }} |
24 | | - - name: Lint all targets |
25 | | - run: cargo clippy --all-targets |
26 | | - - name: Format |
27 | | - run: cargo fmt -- --check |
28 | | - - name: Build with defeault features |
29 | | - run: cargo build --verbose |
30 | | - - name: Check release build on Rust ${{ matrix.toolchain }} |
31 | | - run: cargo check --release --verbose --color always |
32 | | - - name: Unit test |
33 | | - run: cargo test --verbose --lib |
34 | | - - name: Doc test |
35 | | - run: cargo test --verbose --doc |
36 | | - # Check that library code can be compiled with MSRV (1.63.0). |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + - uses: extractions/setup-just@v3 |
| 41 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 42 | + - run: just test unit |
| 43 | + features: |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + - uses: extractions/setup-just@v3 |
| 48 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 49 | + - run: just test features |
37 | 50 | msrv: |
38 | 51 | runs-on: ubuntu-latest |
39 | 52 | steps: |
40 | | - - uses: actions/checkout@v3 |
41 | | - # Modify build tools just for MSRV testing. This avoids us having |
42 | | - # to bump our MSRV just for tooling. Tooling doesn't effect consumers so not a risk. |
43 | | - - name: Prepare environment for MSRV toolchain |
44 | | - run: | |
45 | | - # Remove resolver = "3" line for MSRV compatibility. We use V3 to |
46 | | - # generate an MSRV-compliant lockfile, but this isn't necessary to |
47 | | - # check if library code is MSRV compliant. Any resolver can go |
48 | | - # and grab the versions specified in the committed lockfile. |
49 | | - # |
50 | | - # The V3 resolver is standard in rust 1.85. |
51 | | - sed -i '/resolver = "3"/d' Cargo.toml |
52 | | - - name: Install MSRV toolchain |
53 | | - run: | |
54 | | - rustup toolchain install 1.63.0 |
55 | | - rustup default 1.63.0 |
56 | | - - name: Build with MSRV compiler |
57 | | - run: cargo build --verbose |
58 | | - signet: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + - uses: extractions/setup-just@v3 |
| 55 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 56 | + - run: just test msrv |
| 57 | + sync: |
59 | 58 | runs-on: ubuntu-latest |
60 | 59 | steps: |
61 | | - - uses: actions/checkout@v3 |
62 | | - - name: Sync signet |
63 | | - run: cargo test --verbose signet_syncs |
64 | | - bitcoind: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + - uses: extractions/setup-just@v3 |
| 62 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 63 | + - run: just test sync |
| 64 | + integration: |
65 | 65 | runs-on: ubuntu-latest |
66 | 66 | steps: |
67 | | - - uses: actions/checkout@v3 |
68 | | - - name: Integration test |
69 | | - run: cargo test -- --test-threads 1 --skip signet_syncs --nocapture |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + - uses: extractions/setup-just@v3 |
| 69 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 70 | + - run: just test integration |
0 commit comments