1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
name: ci
on:
pull_request:
push:
branches: [master]
tags: ['**']
env:
# Just a reassurance to mitigate sudden network connection problems
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
# We don't need any debug symbols on ci, this also speeds up builds a bunch
RUSTFLAGS: --deny warnings -Cdebuginfo=0
RUSTDOCFLAGS: --deny warnings
jobs:
rust-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
- run: cargo clippy --workspace
- run: cargo fmt --all -- --check
rust-test:
runs-on: ${{ matrix.os }}
# We don't want unstable jobs to fail our cicd
continue-on-error: ${{ matrix.toolchain != 'stable' }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: [stable]
include:
- { os: ubuntu-latest, toolchain: beta }
- { os: ubuntu-latest, toolchain: nightly }
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
- run: cargo +${{ matrix.toolchain }} build --workspace
- run: cargo +${{ matrix.toolchain }} test --workspace --no-run
- run: cargo +${{ matrix.toolchain }} test --workspace
rust-publish-crate:
# Publishing goes when we create a new git tag on the repo
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
# XXX: this job must execute only if all checks pass!
needs:
- rust-lint
- rust-test
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- run: cargo publish --token ${{ secrets.CRATES_TOKEN }})
|