ci.yml 2.1 KB

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