ci.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. # We don't want unstable jobs to fail our cicd
  27. continue-on-error: ${{ matrix.toolchain != 'stable' }}
  28. strategy:
  29. matrix:
  30. os: [ubuntu-latest, windows-latest, macos-latest]
  31. toolchain: [stable]
  32. include:
  33. - { os: ubuntu-latest, toolchain: beta }
  34. - { os: ubuntu-latest, toolchain: nightly }
  35. steps:
  36. - uses: actions/checkout@v2
  37. - uses: actions-rs/toolchain@v1
  38. with:
  39. toolchain: ${{ matrix.toolchain }}
  40. profile: minimal
  41. - run: cargo +${{ matrix.toolchain }} build --workspace
  42. - run: cargo +${{ matrix.toolchain }} test --workspace --no-run
  43. - run: cargo +${{ matrix.toolchain }} test --workspace
  44. rust-publish-crates:
  45. # Publishing goes when we create a new git tag on the repo
  46. if: startsWith(github.ref, 'refs/tags/')
  47. runs-on: ubuntu-latest
  48. # XXX: this job must execute only if all checks pass!
  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 }}