ci.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. name: CI
  2. on:
  3. push:
  4. branches: ["master"]
  5. pull_request:
  6. branches: ["master"]
  7. env:
  8. CARGO_TERM_COLOR: always
  9. jobs:
  10. tests:
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. os: ["ubuntu-latest"]
  15. rust:
  16. - stable
  17. - beta
  18. - nightly
  19. runs-on: ${{ matrix.os }}
  20. steps:
  21. - uses: actions/checkout@v3
  22. - name: Restore cargo cache
  23. uses: actions/cache@v2.1.7
  24. with:
  25. path: |
  26. ~/.cargo/registry
  27. ~/.cargo/git
  28. target
  29. key: ${{ matrix.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }}
  30. - name: Toolchain
  31. uses: actions-rs/toolchain@v1
  32. with:
  33. profile: minimal
  34. toolchain: ${{ matrix.rust }}
  35. override: true
  36. - uses: isbang/compose-action@v1.1.0
  37. with:
  38. compose-file: ./docker-compose.test.yml
  39. down-flags: --volumes
  40. - name: Run tests
  41. uses: actions-rs/cargo@v1
  42. with:
  43. command: test
  44. args: --all-features --verbose
  45. clippy:
  46. name: clippy (ubuntu-latest, stable)
  47. runs-on: ubuntu-latest
  48. steps:
  49. - uses: actions/checkout@v3
  50. - name: Toolchain
  51. uses: actions-rs/toolchain@v1
  52. with:
  53. toolchain: stable
  54. override: true
  55. components: clippy
  56. - name: Restore cargo cache
  57. uses: actions/cache@v2.1.7
  58. with:
  59. path: |
  60. ~/.cargo/registry
  61. ~/.cargo/git
  62. target
  63. key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}
  64. - name: Check clippy
  65. uses: actions-rs/cargo@v1
  66. with:
  67. command: clippy
  68. args: -- -D warnings
  69. fmt:
  70. name: fmt (ubuntu-latest, stable)
  71. runs-on: ubuntu-latest
  72. steps:
  73. - uses: actions/checkout@v2
  74. - name: Toolchain
  75. uses: actions-rs/toolchain@v1
  76. with:
  77. toolchain: stable
  78. override: true
  79. components: rustfmt
  80. - name: Restore cargo cache
  81. uses: actions/cache@v2.1.7
  82. with:
  83. path: |
  84. ~/.cargo/registry
  85. ~/.cargo/git
  86. target
  87. key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}
  88. - name: Check format
  89. uses: actions-rs/cargo@v1
  90. with:
  91. command: fmt
  92. args: --all -- --check