From 2f6a61e6ae2f72957cd846c6512e819231dfdcc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20=22xq=22=20Quei=C3=9Fner?= Date: Thu, 4 Jan 2024 12:58:26 +0100 Subject: [PATCH] Fixes GitHub CI --- .github/workflows/build.yml | 46 ++++++++++++++++++------------------- tools/bundle.sh | 8 +++---- tools/create-package.sh | 2 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 720973f..e697a74 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,5 @@ -name: Build +name: Continuous Integration + on: push: branches: [main] @@ -6,33 +7,32 @@ on: branches: [main] jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - dir: - - all-platforms - - raspberrypi-rp2040 - - espressif-esp - - nxp-lpc - - microchip-atmega - - gigadevice-gd32 - - nordic-nrf5x - - stmicro-stm32 - os: - - windows-latest - - macos-latest - - ubuntu-latest + generate-packages: + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-tags: true # required for "git describe" + + - name: Fetch more data from git + run: | + # fetch everything back till the 0.11.0 tag. + # https://stackoverflow.com/a/58082274 + git fetch --shallow-exclude 0.11.0 + git fetch --deepen=2 - name: Setup Zig uses: goto-bus-stop/setup-zig@v2 with: version: 0.11.0 - - name: Build examples - working-directory: ${{ matrix.dir }} - run: zig build + - name: Generate and validate packages + run: | + ./tools/bundle.sh + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: packages + path: microzig-deploy/ diff --git a/tools/bundle.sh b/tools/bundle.sh index fbb61f6..3f19239 100755 --- a/tools/bundle.sh +++ b/tools/bundle.sh @@ -5,14 +5,14 @@ # Creates all packages into /microzig-deploy with the final folder structure. # -set -euo pipefail +set -eu all_files_dir=".data" # test for all required tools: which zig date find jq mkdir dirname realpath > /dev/null -[ "$(zig version)" == "0.11.0" ] +[ "$(zig version)" = "0.11.0" ] repo_root="$(dirname "$(dirname "$(realpath "$0")")")" [ -d "${repo_root}" ] @@ -32,7 +32,7 @@ git_description="$(git describe --match "*.*.*" --tags --abbrev=9)" version="" # render-version -function render_version() +render_version() { [ "$#" -eq 5 ] echo "$1.$2.$3-$4-$5" @@ -132,7 +132,7 @@ for dir in $(find -type f -name microzig-package.json -exec dirname '{}' ';'); d create_package "${dir}" "${out_path}" # get some required metadata - file_hash=($(sha256sum "${out_path}" | cut -f 1)) + file_hash="$(sha256sum "${out_path}" | cut -d " " -f 1)" file_size="$(stat --format="%s" "${out_path}")" pkg_info="$(archive_info ${out_path})" diff --git a/tools/create-package.sh b/tools/create-package.sh index 0dd9e82..1eaf96b 100755 --- a/tools/create-package.sh +++ b/tools/create-package.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -euo pipefail +set -eu # test for all required tools: which tar gzip jq basename dirname realpath > /dev/null