1
0

rust.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: Rust
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. branches: [ main ]
  7. env:
  8. CARGO_TERM_COLOR: always
  9. jobs:
  10. build:
  11. name: Build for ${{ matrix.os }}
  12. runs-on: ${{ matrix.os }}
  13. strategy:
  14. matrix:
  15. include:
  16. - os: ubuntu-latest
  17. artifact_name: rathole
  18. asset_name: rathole-linux-amd64
  19. - os: windows-latest
  20. artifact_name: rathole.exe
  21. asset_name: rathole-windows-amd64.exe
  22. - os: macos-latest
  23. artifact_name: rathole
  24. asset_name: rathole-macos-amd64
  25. steps:
  26. - uses: actions/checkout@v2
  27. - uses: actions-rs/toolchain@v1
  28. with:
  29. profile: minimal
  30. toolchain: stable
  31. components: clippy
  32. - uses: Swatinem/rust-cache@v1
  33. - name: Clippy
  34. run: cargo clippy -- -D warnings
  35. - name: Build
  36. run: cargo build --verbose
  37. - name: Setup cargo-hack
  38. run: cargo install cargo-hack
  39. - name: Build with features
  40. run: cargo hack check --feature-powerset --no-dev-deps
  41. - name: Run tests
  42. run: cargo test --verbose
  43. - name: Build release
  44. run: cargo build --release
  45. - uses: actions/upload-artifact@v2
  46. with:
  47. name: ${{ matrix.asset_name }}
  48. path: target/release/${{ matrix.artifact_name }}
  49. - name: Release
  50. uses: svenstaro/upload-release-action@v2
  51. if: startsWith(github.ref, 'refs/tags/')
  52. with:
  53. repo_token: ${{ secrets.GITHUB_TOKEN }}
  54. file: target/release/${{ matrix.artifact_name }}
  55. asset_name: ${{ matrix.asset_name }}
  56. tag: ${{ github.ref }}