ci.yml 2.2 KB

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