|
| 1 | +--- |
| 2 | +name: Stackable Build Pipeline |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - staging |
| 9 | + - trying |
| 10 | + - "renovate/**" |
| 11 | + tags: |
| 12 | + - "*" |
| 13 | + pull_request: |
| 14 | + |
| 15 | +env: |
| 16 | + CARGO_TERM_COLOR: always |
| 17 | + CARGO_INCREMENTAL: '0' |
| 18 | + CARGO_PROFILE_DEV_DEBUG: '0' |
| 19 | + RUSTFLAGS: "-D warnings" |
| 20 | + RUSTDOCFLAGS: "-D warnings" |
| 21 | + RUST_LOG: "info" |
| 22 | + |
| 23 | +jobs: |
| 24 | + # Identify unused dependencies |
| 25 | + run_udeps: |
| 26 | + name: Run Cargo Udeps |
| 27 | + runs-on: ubuntu-latest |
| 28 | + env: |
| 29 | + RUSTC_BOOTSTRAP: 1 |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0 |
| 32 | + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7 |
| 33 | + with: |
| 34 | + profile: minimal |
| 35 | + toolchain: stable |
| 36 | + override: true |
| 37 | + - uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 # renovate: tag=v1.3.0 |
| 38 | + with: |
| 39 | + key: udeps |
| 40 | + - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3 |
| 41 | + with: |
| 42 | + command: install |
| 43 | + args: cargo-udeps --locked |
| 44 | + - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3 |
| 45 | + with: |
| 46 | + command: udeps |
| 47 | + args: --all-targets |
| 48 | + |
| 49 | + run_cargodeny: |
| 50 | + name: Run Cargo Deny |
| 51 | + runs-on: ubuntu-latest |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + checks: |
| 55 | + - advisories |
| 56 | + - bans licenses sources |
| 57 | + |
| 58 | + # Prevent sudden announcement of a new advisory from failing ci: |
| 59 | + continue-on-error: ${{ matrix.checks == 'advisories' }} |
| 60 | + |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0 |
| 63 | + - uses: EmbarkStudios/cargo-deny-action@8acbae97b5d01b0481ae14cee8fcd8f5aa9e374d # tag=v1.2.12 |
| 64 | + with: |
| 65 | + command: check ${{ matrix.checks }} |
| 66 | + |
| 67 | + run_rustfmt: |
| 68 | + name: Run Rustfmt |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0 |
| 72 | + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7 |
| 73 | + with: |
| 74 | + profile: minimal |
| 75 | + toolchain: stable |
| 76 | + components: rustfmt |
| 77 | + override: true |
| 78 | + - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3 |
| 79 | + with: |
| 80 | + command: fmt |
| 81 | + args: --all -- --check |
| 82 | + |
| 83 | + run_clippy: |
| 84 | + name: Run Clippy |
| 85 | + runs-on: ubuntu-latest |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0 |
| 88 | + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7 |
| 89 | + with: |
| 90 | + profile: minimal |
| 91 | + toolchain: stable |
| 92 | + components: clippy |
| 93 | + override: true |
| 94 | + - uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 # renovate: tag=v1.3.0 |
| 95 | + with: |
| 96 | + key: clippy |
| 97 | + - name: Run clippy action to produce annotations |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # renovate: tag=v1.0.7 |
| 101 | + if: env.GITHUB_TOKEN != null |
| 102 | + with: |
| 103 | + args: --all-targets -- -D warnings |
| 104 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 105 | + - name: Run clippy manually without annotations |
| 106 | + env: |
| 107 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 108 | + if: env.GITHUB_TOKEN == null |
| 109 | + run: cargo clippy --all-targets -- -D warnings |
| 110 | + |
| 111 | + run_rustdoc: |
| 112 | + name: Run RustDoc |
| 113 | + runs-on: ubuntu-latest |
| 114 | + steps: |
| 115 | + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0 |
| 116 | + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7 |
| 117 | + with: |
| 118 | + profile: minimal |
| 119 | + toolchain: stable |
| 120 | + components: rustfmt |
| 121 | + override: true |
| 122 | + - uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 # renovate: tag=v1.3.0 |
| 123 | + with: |
| 124 | + key: doc |
| 125 | + - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3 |
| 126 | + with: |
| 127 | + command: doc |
| 128 | + args: --document-private-items |
| 129 | + |
| 130 | + run_tests: |
| 131 | + name: Run Cargo Tests |
| 132 | + needs: |
| 133 | + - run_cargodeny |
| 134 | + - run_clippy |
| 135 | + - run_rustfmt |
| 136 | + - run_rustdoc |
| 137 | + runs-on: ubuntu-latest |
| 138 | + steps: |
| 139 | + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0 |
| 140 | + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7 |
| 141 | + with: |
| 142 | + profile: minimal |
| 143 | + toolchain: stable |
| 144 | + override: true |
| 145 | + - uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 # renovate: tag=v1.3.0 |
| 146 | + with: |
| 147 | + key: test |
| 148 | + - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3 |
| 149 | + with: |
| 150 | + command: test |
| 151 | + |
| 152 | + tests_passed: |
| 153 | + name: All tests passed |
| 154 | + needs: |
| 155 | + - run_udeps |
| 156 | + - run_tests |
| 157 | + runs-on: ubuntu-latest |
| 158 | + steps: |
| 159 | + - name: log |
| 160 | + run: echo All tests have passed! |
0 commit comments