rust.yml 2.3 KB

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