rust.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: Rust
  2. on:
  3. pull_request:
  4. branches: ["*"]
  5. push:
  6. branches: ["main", "dev"]
  7. concurrency:
  8. # Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
  9. # On main, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
  10. group: ${{ github.ref == 'refs/heads/main' && format('ci-main-{0}', github.sha) || format('ci-{0}', github.ref) }}
  11. cancel-in-progress: true
  12. env:
  13. CARGO_TERM_COLOR: always
  14. CARGO_INCREMENTAL: 0
  15. jobs:
  16. lints:
  17. name: Lints
  18. runs-on: ubuntu-latest
  19. steps:
  20. - uses: actions/checkout@v2
  21. - uses: actions-rs/toolchain@v1
  22. with:
  23. profile: minimal
  24. toolchain: stable
  25. components: clippy
  26. - uses: Swatinem/rust-cache@v1
  27. - name: Clippy
  28. run: cargo clippy -- -D warnings
  29. - name: Setup cargo-hack
  30. run: cargo install cargo-hack
  31. - name: Check all features
  32. run: cargo hack check --feature-powerset --no-dev-deps
  33. build:
  34. name: Build for ${{ matrix.target }}
  35. runs-on: ${{ matrix.os }}
  36. strategy:
  37. matrix:
  38. include:
  39. - os: ubuntu-latest
  40. exe: rathole
  41. target: x86_64-unknown-linux-gnu
  42. - os: windows-latest
  43. exe: rathole.exe
  44. target: x86_64-pc-windows-msvc
  45. - os: macos-latest
  46. exe: rathole
  47. target: x86_64-apple-darwin
  48. steps:
  49. - uses: actions/checkout@v2
  50. - uses: actions-rs/toolchain@v1
  51. with:
  52. profile: minimal
  53. toolchain: stable
  54. - uses: Swatinem/rust-cache@v1
  55. - name: Build
  56. run: cargo build
  57. - name: Run tests
  58. run: cargo test --verbose
  59. - uses: actions/upload-artifact@v2
  60. with:
  61. name: rathole-${{ matrix.target }}
  62. path: target/debug/${{ matrix.exe }}