rust.yml 1.8 KB

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