From cbe87333c5a841bf053114c0ca24f24b97831594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Thu, 4 Dec 2025 11:58:39 -0300 Subject: [PATCH] github: ci: Add deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- .github/workflows/ci.yml | 80 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22a5501..2986540 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,14 @@ -name: Cargo Build & Test +name: Build, Test, and Release on: - push: + workflow_dispatch: pull_request: + push: + +permissions: + contents: write -env: +env: CARGO_TERM_COLOR: always jobs: @@ -41,4 +45,74 @@ jobs: - run: cargo clippy --tests -- --deny warnings - run: cargo test --verbose + release: + name: Build Release Binaries and Upload Artifacts + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + use_cross: true + ext: "" + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + use_cross: true + ext: "" + - os: ubuntu-latest + target: armv7-unknown-linux-gnueabihf + use_cross: true + ext: "" +# - os: macos-latest +# target: aarch64-apple-darwin +# use_cross: false +# ext: "" +# - os: macos-latest +# target: x86_64-apple-darwin +# use_cross: false +# ext: "" + - os: windows-latest + target: x86_64-pc-windows-msvc + use_cross: false + ext: ".exe" + steps: + - name: Check out source + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Install cross + if: matrix.use_cross + run: cargo install cross + + - name: Build release binary with cross + if: matrix.use_cross + run: cross build --release --target ${{ matrix.target }} + + - name: Build release binary with cargo + if: ${{ !matrix.use_cross }} + run: cargo build --release --target ${{ matrix.target }} + + - name: Upload build as workflow artifact + uses: actions/upload-artifact@v4 + with: + name: disktest-${{ matrix.target }}${{ matrix.ext }} + path: target/${{ matrix.target }}/release/disktest${{ matrix.ext }} + if-no-files-found: error + + - name: Rename artifact + shell: bash + run: mv target/${{ matrix.target }}/release/disktest${{ matrix.ext }} disktest-${{ matrix.target }}${{ matrix.ext }} + + - name: Attach artifacts to GitHub release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + with: + files: disktest-${{ matrix.target }}${{ matrix.ext }} + token: ${{ secrets.GITHUB_TOKEN }} + # vim: ts=2 sw=2 expandtab