| 1 |
--- |
| 2 |
name: ci |
| 3 |
|
| 4 |
on: |
| 5 |
pull_request: |
| 6 |
push: |
| 7 |
branches: |
| 8 |
- main |
| 9 |
release: |
| 10 |
types: |
| 11 |
- created |
| 12 |
|
| 13 |
env: |
| 14 |
|
| 15 |
CARGO_NET_RETRY: 10 |
| 16 |
RUSTUP_MAX_RETRIES: 10 |
| 17 |
|
| 18 |
CARGO_INCREMENTAL: 0 |
| 19 |
RUST_BACKTRACE: full |
| 20 |
|
| 21 |
|
| 22 |
RUSTFLAGS: --deny warnings -Cdebuginfo=0 |
| 23 |
RUSTDOCFLAGS: --deny warnings |
| 24 |
|
| 25 |
jobs: |
| 26 |
rust-lint: |
| 27 |
runs-on: ubuntu-latest |
| 28 |
steps: |
| 29 |
- uses: actions/checkout@v5 |
| 30 |
- uses: actions-rs/toolchain@v1 |
| 31 |
with: |
| 32 |
toolchain: stable |
| 33 |
profile: minimal |
| 34 |
components: rustfmt, clippy |
| 35 |
|
| 36 |
- run: cargo clippy --workspace |
| 37 |
- run: cargo fmt --all -- --check |
| 38 |
|
| 39 |
rust-test: |
| 40 |
runs-on: ${{ matrix.os }} |
| 41 |
|
| 42 |
continue-on-error: ${{ matrix.toolchain != 'stable' }} |
| 43 |
|
| 44 |
strategy: |
| 45 |
matrix: |
| 46 |
os: |
| 47 |
- ubuntu-latest |
| 48 |
- windows-latest |
| 49 |
- macos-latest |
| 50 |
toolchain: |
| 51 |
- stable |
| 52 |
features: |
| 53 |
- "colors" |
| 54 |
- "threads" |
| 55 |
- "timestamps" |
| 56 |
- "stderr" |
| 57 |
exclude: |
| 58 |
- os: macos-latest |
| 59 |
toolchain: stable |
| 60 |
features: "timestamps" |
| 61 |
include: |
| 62 |
- os: ubuntu-latest |
| 63 |
toolchain: beta |
| 64 |
features: "colors,threads,timestamps" |
| 65 |
- os: ubuntu-latest |
| 66 |
toolchain: nightly |
| 67 |
features: "colors,threads,timestamps,nightly" |
| 68 |
|
| 69 |
steps: |
| 70 |
- uses: actions/checkout@v5 |
| 71 |
- uses: actions-rs/toolchain@v1 |
| 72 |
with: |
| 73 |
toolchain: ${{ matrix.toolchain }} |
| 74 |
profile: minimal |
| 75 |
- run: cargo +${{ matrix.toolchain }} build --no-default-features --features ${{ matrix.features }} |
| 76 |
- run: cargo +${{ matrix.toolchain }} test --no-default-features --features ${{ matrix.features }} |
| 77 |
|
| 78 |
rust-publish-crates: |
| 79 |
if: startsWith(github.ref, 'refs/tags/') |
| 80 |
runs-on: ubuntu-latest |
| 81 |
needs: |
| 82 |
- rust-lint |
| 83 |
- rust-test |
| 84 |
environment: release |
| 85 |
permissions: |
| 86 |
id-token: write |
| 87 |
steps: |
| 88 |
- id: checkout |
| 89 |
uses: actions/checkout@v5 |
| 90 |
- id: auth |
| 91 |
uses: rust-lang/crates-io-auth-action@v1 |
| 92 |
- id: publish |
| 93 |
run: cargo publish |
| 94 |
env: |
| 95 |
CARGO_REGISTRY_TOKEN: "${{ steps.auth.outputs.token }}" |