rust.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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: cargo hack check --feature-powerset --no-dev-deps
  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-rs/toolchain@v1
  53. with:
  54. profile: minimal
  55. toolchain: stable
  56. - uses: Swatinem/rust-cache@v1
  57. - name: Build
  58. run: cargo build
  59. - name: Run tests
  60. run: cargo test --verbose
  61. - uses: actions/upload-artifact@v2
  62. with:
  63. name: rathole-${{ matrix.target }}
  64. path: target/debug/${{ matrix.exe }}