Debian Codegraph @

debian/rust-vendor/either/.github/workflows/ci.yml

raw
1 on:
2 push:
3 branches: [ main ]
4 pull_request:
5 merge_group:
6
7 name: CI
8
9 jobs:
10 ci:
11 runs-on: ubuntu-latest
12 strategy:
13 fail-fast: false
14 matrix:
15 rust:
16 - 1.63.0 # MSRV
17 - stable
18 - beta
19 - nightly
20 features:
21 - ""
22 - "serde"
23
24 steps:
25 - name: Checkout
26 uses: actions/checkout@v4
27
28 - name: Cache the registry
29 uses: actions/cache@v4
30 if: startsWith(matrix.rust, '1')
31 with:
32 path: ~/.cargo/registry/index
33 key: cargo-${{ matrix.rust }}-git-index
34
35 - name: Lock MSRV-compatible dependencies
36 if: startsWith(matrix.rust, '1')
37 env:
38 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
39 # Note that this uses the runner's pre-installed stable cargo
40 # Also, the resolver is still too greedy, pulling in too-new serde_derive:
41 # https://github.com/serde-rs/serde/issues/3088
42 run: |
43 cargo generate-lockfile
44 cargo update -p serde --precise 1.0.228
45
46 - name: Set up Rust
47 uses: dtolnay/rust-toolchain@master
48 with:
49 toolchain: ${{ matrix.rust }}
50
51 - name: Build (no_std)
52 run: cargo build --no-default-features --features "${{ matrix.features }}"
53
54 - name: Build
55 run: cargo build --features "${{ matrix.features }}"
56
57 - name: Test
58 run: cargo test --features "${{ matrix.features }}"
59
60 - name: Doc
61 run: cargo doc --features "${{ matrix.features }}"
62
63 clippy:
64 name: Rustfmt and Clippy
65 runs-on: ubuntu-latest
66 steps:
67 - name: Checkout
68 uses: actions/checkout@v4
69
70 - name: Set up nightly Rust
71 uses: dtolnay/rust-toolchain@nightly
72 with:
73 components: rustfmt, clippy
74
75 - name: Rustfmt
76 run: cargo fmt --all -- --check
77
78 - name: Clippy
79 run: cargo clippy # -- -D warnings
80
81 # One job that "summarizes" the success state of this pipeline. This can then be added to branch
82 # protection, rather than having to add each job separately.
83 success:
84 name: Success
85 runs-on: ubuntu-latest
86 needs: [ci, clippy]
87 # Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
88 # failed" as success. So we have to do some contortions to ensure the job fails if any of its
89 # dependencies fails.
90 if: always() # make sure this is never "skipped"
91 steps:
92 # Manually check the status of all dependencies. `if: failure()` does not work.
93 - name: check if any dependency failed
94 run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'