ci.yml 2.1 KB

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