From 26050cf552252fced37eb7f57171ab872553d681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sverre=20Johann=20Bj=C3=B8rke?= Date: Sat, 17 Feb 2024 10:12:54 +0100 Subject: [PATCH] add zigbuild action (#5) change zigbuild name try without caching and install zigbuild fix cargo install zigbuild try with caching cache zigbuild install --- .../workflows/build_and_release_zigbuild.yml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/build_and_release_zigbuild.yml diff --git a/.github/workflows/build_and_release_zigbuild.yml b/.github/workflows/build_and_release_zigbuild.yml new file mode 100644 index 0000000..618ae41 --- /dev/null +++ b/.github/workflows/build_and_release_zigbuild.yml @@ -0,0 +1,94 @@ +name: Build and release with Zigbuild + +on: + #push: + # tags: + # - 'v*' # Push events matching v*, i.e. v1.0, v20.15.10 + workflow_dispatch: + inputs: + dry_run: + type: boolean + description: 'Dry Run' + required: false + default: false + tag: + description: 'Tag' + required: true + default: 'v0.0.0' + +run-name: ${{ github.event.inputs.dry_run == 'true' && 'Dry run' || github.event.inputs.tag || github.ref }} + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Cache cargo bin + uses: actions/cache@v2 + with: + path: ~/.cargo/bin + key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo registry + uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo index + uses: actions/cache@v2 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo build + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + + + - uses: jethrodaniel/setup-zig@fix-caching + with: + version: 0.12.0-dev.903+7aa85691b + + - name: Install Arm compile target + run: rustup target add armv7-unknown-linux-gnueabihf + + - name: Install Zigbuild + run: | + if ! command -v cargo-zigbuild &> /dev/null + then + cargo install cargo-zigbuild + fi + + - name: Build + run: cargo zigbuild --target armv7-unknown-linux-gnueabihf --release + + - name: Create Release + if: ${{ !github.event.inputs.dry_run }} + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: actions/create-release@v1 + with: + tag_name: ${{ github.event.inputs.tag || github.ref }} + release_name: Release ${{ github.event.inputs.tag || github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset + if: ${{ !github.event.inputs.dry_run }} + id: upload-release-asset + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./target/armv7-unknown-linux-gnueabihf/release/infoskjerm + asset_name: infoskjerm + asset_content_type: application/zip