rust.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. jobs:
  15. lints:
  16. name: Lints
  17. runs-on: ubuntu-latest
  18. steps:
  19. - uses: actions/checkout@v2
  20. - uses: actions-rs/toolchain@v1
  21. with:
  22. profile: minimal
  23. toolchain: stable
  24. components: clippy
  25. - uses: Swatinem/rust-cache@v1
  26. - name: Clippy
  27. run: cargo clippy -- -D warnings
  28. - name: Setup cargo-hack
  29. run: cargo install cargo-hack
  30. - name: Check all features
  31. run: >
  32. cargo hack check --feature-powerset --no-dev-deps
  33. --mutually-exclusive-features default,native-tls,websocket-native-tls,rustls,websocket-rustls
  34. build:
  35. name: Build for ${{ matrix.target }}
  36. runs-on: ${{ matrix.os }}
  37. strategy:
  38. matrix:
  39. include:
  40. - os: ubuntu-latest
  41. exe: rathole
  42. target: x86_64-unknown-linux-gnu
  43. - os: windows-latest
  44. exe: rathole.exe
  45. target: x86_64-pc-windows-msvc
  46. - os: macos-latest
  47. exe: rathole
  48. target: x86_64-apple-darwin
  49. - os: macos-latest
  50. exe: rathole
  51. target: aarch64-apple-darwin
  52. steps:
  53. - uses: actions/checkout@v2
  54. - uses: actions-rs/toolchain@v1
  55. with:
  56. profile: minimal
  57. toolchain: stable
  58. - uses: Swatinem/rust-cache@v1
  59. - name: Build
  60. run: cargo build
  61. - name: Run tests with native-tls
  62. run: cargo test --verbose
  63. - name: Run tests with rustls
  64. run: cargo test --verbose --no-default-features --features server,client,rustls,noise,websocket-rustls,hot-reload
  65. - uses: actions/upload-artifact@v2
  66. with:
  67. name: rathole-${{ matrix.target }}
  68. path: target/debug/${{ matrix.exe }}