1
0

unit-tests.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Unit tests
  2. on:
  3. push:
  4. branches: [ main ]
  5. paths:
  6. - '.github/workflows/unit-tests.yml'
  7. - 'src/**'
  8. - 'Cargo.*'
  9. - build.rs
  10. pull_request:
  11. branches: [ main ]
  12. paths:
  13. - '.github/workflows/unit-tests.yml'
  14. - 'src/**'
  15. - 'Cargo.*'
  16. - build.rs
  17. concurrency:
  18. group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
  19. cancel-in-progress: true
  20. env:
  21. CARGO_TERM_COLOR: always
  22. RUSTFLAGS: --deny warnings
  23. jobs:
  24. unit-tests:
  25. runs-on: ${{ matrix.os }}
  26. continue-on-error: ${{ matrix.rust == 'nightly' }}
  27. strategy:
  28. matrix:
  29. os: [ubuntu-latest, macos-latest, windows-latest]
  30. rust: [1.70.0, stable, beta, nightly]
  31. steps:
  32. - name: Checkout repository
  33. uses: actions/checkout@v4
  34. - run: rustup toolchain install ${{ matrix.rust }} --profile minimal
  35. - uses: Swatinem/rust-cache@v2
  36. - name: Install cargo-hack
  37. uses: nick-fields/retry@v3
  38. with:
  39. timeout_minutes: 5
  40. max_attempts: 5
  41. command: cargo install cargo-hack
  42. - name: Run rustfmt checks
  43. run: cargo fmt --check
  44. - name: Run clippy lints
  45. run: cargo clippy -- -D warnings
  46. - name: Run unit tests
  47. run: cargo hack test