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