ci.yml 2.0 KB

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