| 1 |
name: ci |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
push: |
| 6 |
branches: [master] |
| 7 |
tags: ['**'] |
| 8 |
|
| 9 |
env: |
| 10 |
|
| 11 |
CARGO_NET_RETRY: 10 |
| 12 |
RUSTUP_MAX_RETRIES: 10 |
| 13 |
|
| 14 |
CARGO_INCREMENTAL: 0 |
| 15 |
RUST_BACKTRACE: full |
| 16 |
|
| 17 |
|
| 18 |
RUSTFLAGS: --deny warnings -Cdebuginfo=0 |
| 19 |
RUSTDOCFLAGS: --deny warnings |
| 20 |
|
| 21 |
jobs: |
| 22 |
rust-lint: |
| 23 |
runs-on: ubuntu-latest |
| 24 |
steps: |
| 25 |
- uses: actions/checkout@v2 |
| 26 |
- uses: actions-rs/toolchain@v1 |
| 27 |
with: |
| 28 |
toolchain: stable |
| 29 |
profile: minimal |
| 30 |
components: rustfmt, clippy |
| 31 |
|
| 32 |
- run: cargo clippy --workspace |
| 33 |
- run: cargo fmt --all -- --check |
| 34 |
|
| 35 |
rust-test: |
| 36 |
runs-on: ${{ matrix.os }} |
| 37 |
|
| 38 |
|
| 39 |
continue-on-error: ${{ matrix.toolchain != 'stable' }} |
| 40 |
|
| 41 |
strategy: |
| 42 |
matrix: |
| 43 |
os: [ubuntu-latest, windows-latest, macos-latest] |
| 44 |
toolchain: [stable] |
| 45 |
include: |
| 46 |
- { os: ubuntu-latest, toolchain: beta } |
| 47 |
- { os: ubuntu-latest, toolchain: nightly } |
| 48 |
|
| 49 |
steps: |
| 50 |
- uses: actions/checkout@v2 |
| 51 |
- uses: actions-rs/toolchain@v1 |
| 52 |
with: |
| 53 |
toolchain: ${{ matrix.toolchain }} |
| 54 |
profile: minimal |
| 55 |
|
| 56 |
- run: cargo +${{ matrix.toolchain }} build --workspace |
| 57 |
- run: cargo +${{ matrix.toolchain }} test --workspace --no-run |
| 58 |
- run: cargo +${{ matrix.toolchain }} test --workspace |
| 59 |
|
| 60 |
rust-publish-crate: |
| 61 |
|
| 62 |
if: startsWith(github.ref, 'refs/tags/') |
| 63 |
runs-on: ubuntu-latest |
| 64 |
|
| 65 |
needs: |
| 66 |
- rust-lint |
| 67 |
- rust-test |
| 68 |
steps: |
| 69 |
- uses: actions/checkout@v2 |
| 70 |
- uses: actions-rs/toolchain@v1 |
| 71 |
with: |
| 72 |
toolchain: stable |
| 73 |
profile: minimal |
| 74 |
- run: cargo publish --token ${{ secrets.CRATES_TOKEN }}) |