|
1 | | -name: Cargo Build & Test |
| 1 | +name: Build, Test, and Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
| 4 | + workflow_dispatch: |
5 | 5 | pull_request: |
| 6 | + push: |
6 | 7 |
|
7 | | -env: |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +env: |
8 | 12 | CARGO_TERM_COLOR: always |
9 | 13 |
|
10 | 14 | jobs: |
|
41 | 45 | - run: cargo clippy --tests -- --deny warnings |
42 | 46 | - run: cargo test --verbose |
43 | 47 |
|
| 48 | + release: |
| 49 | + name: Build Release Binaries and Upload Artifacts |
| 50 | + runs-on: ubuntu-latest |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + include: |
| 55 | + - target: x86_64-unknown-linux-gnu |
| 56 | + - target: aarch64-unknown-linux-gnu |
| 57 | + - target: armv7-unknown-linux-gnueabihf |
| 58 | + steps: |
| 59 | + - name: Check out source |
| 60 | + uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - name: Install Rust toolchain |
| 63 | + uses: dtolnay/rust-toolchain@stable |
| 64 | + with: |
| 65 | + targets: ${{ matrix.target }} |
| 66 | + |
| 67 | + - name: Install cross |
| 68 | + run: cargo install cross |
| 69 | + |
| 70 | + - name: Build release binary with cross |
| 71 | + run: cross build --release --target ${{ matrix.target }} |
| 72 | + |
| 73 | + - name: Upload build as workflow artifact |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: disktest-${{ matrix.target }} |
| 77 | + path: target/${{ matrix.target }}/release/disktest |
| 78 | + if-no-files-found: error |
| 79 | + |
| 80 | + - name: Rename artifact |
| 81 | + run: mv target/${{ matrix.target }}/release/disktest disktest-${{ matrix.target }} |
| 82 | + |
| 83 | + - name: Attach artifacts to GitHub release |
| 84 | + if: startsWith(github.ref, 'refs/tags/') |
| 85 | + uses: softprops/action-gh-release@v2 |
| 86 | + with: |
| 87 | + files: disktest-${{ matrix.target }} |
| 88 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + |
44 | 90 | # vim: ts=2 sw=2 expandtab |
0 commit comments