Skip to content

Commit 1f14a02

Browse files
github: ci: Add deployment for the 3 major architectures
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
1 parent 8839bbd commit 1f14a02

1 file changed

Lines changed: 49 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
name: Cargo Build & Test
1+
name: Build, Test, and Release
22

33
on:
4-
push:
4+
workflow_dispatch:
55
pull_request:
6+
push:
67

7-
env:
8+
permissions:
9+
contents: write
10+
11+
env:
812
CARGO_TERM_COLOR: always
913

1014
jobs:
@@ -41,4 +45,46 @@ jobs:
4145
- run: cargo clippy --tests -- --deny warnings
4246
- run: cargo test --verbose
4347

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+
4490
# vim: ts=2 sw=2 expandtab

0 commit comments

Comments
 (0)