From 7e08dc84a0e12b95d106cc80e8aa7a0d3876b891 Mon Sep 17 00:00:00 2001 From: Jan Gleytenhoover Date: Fri, 16 Aug 2024 10:03:13 +0000 Subject: [PATCH] Update .gitea/workflows/build.yaml --- .gitea/workflows/build.yaml | 188 +++++++++--------------------------- 1 file changed, 45 insertions(+), 143 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 12bda5b..9fb2f5c 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,84 +1,46 @@ -on: +name: Build + +on: push: branches: - main -name: Build - jobs: build-left: runs-on: ubuntu-latest container: image: zmkfirmware/zmk-build-arm:stable - name: Build left steps: - - name: Install Dependencies + - name: Setup run: | apt-get update; - apt-get install --yes --no-install-recommends \ - nodejs \ - zstd \ - zip - - - name: Checkout + apt-get install --yes --no-install-recommends nodejs zstd zip + - name: Checkout code uses: actions/checkout@v4 - - - name: Hash west modules + - name: Compute hash for west modules id: hash-west run: | - FILE_PATH=zephyr/west.yml - FILES=$(find . -name build.yml -o -name west.yml -type f -exec sha256sum \; | sort) - HASH="$(echo -n $FILES | sha256sum | head -c 64)" + HASH=$(find . -name 'build.yml' -o -name 'west.yml' -exec sha256sum {} \; | sort | sha256sum | head -c 64) echo "hash=$HASH" >> "$GITHUB_OUTPUT" - echo "computed hash: $HASH" - - name: Cache west modules uses: actions/cache@v4 - env: - cache-name: cache-zephyr-modules with: path: | modules/ tools/ zephyr/ - bootloader/ - key: ${{ runner.os }}-build-left-${{ env.cache-name }}-${{ steps.hash-west.outputs.hash }} - restore-keys: | - ${{ runner.os }}-build-left-${{ env.cache-name }}- - ${{ runner.os }}-build-left- - ${{ runner.os }}- - timeout-minutes: 5 - continue-on-error: true - - - name: West Init - run: west init -l config - - - name: West Update - run: west update - - - name: West Zephyr export - run: west zephyr-export - - - name: West Build (Ferris Left) - run: west build -s zmk/app -b nice_nano_v2 -- -DSHIELD=cradio_left -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" - - - name: Ferris Left Kconfig file - run: cat build/zephyr/.config | grep -v "^#" | grep -v "^$" - - - name: Rename zmk.uf2 - run: cp build/zephyr/zmk.uf2 cradio_left_nice_nano_v2.uf2 - - - name: Hash west modules - id: hash-west + bootloader/ + key: ${{ runner.os }}-build-left-${{ steps.hash-west.outputs.hash }} + - name: Initialize and update West run: | - FILE_PATH=zephyr/west.yml - FILES=$(find . -name build.yml -o -name west.yml -type f -exec sha256sum \; | sort) - HASH="$(echo -n $FILES | sha256sum | head -c 64)" - echo "hash=$HASH" >> "$GITHUB_OUTPUT" - echo "computed hash: $HASH" - - - name: Upload Artifact (Left) - uses: actions/upload-artifact@v3 + west init -l config + west update + west zephyr-export + - name: Build Firmware (Left) + run: west build -s zmk/app -b nice_nano_v2 -- -DSHIELD=cradio_left -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" + - name: Rename and upload artifact (Left) + run: mv build/zephyr/zmk.uf2 cradio_left_nice_nano_v2.uf2 + - uses: actions/upload-artifact@v3 with: path: cradio_left_nice_nano_v2.uf2 name: left @@ -87,123 +49,63 @@ jobs: runs-on: ubuntu-latest container: image: zmkfirmware/zmk-build-arm:stable - name: Build right steps: - - name: Install Dependencies + - name: Setup run: | apt-get update; - apt-get install --yes --no-install-recommends \ - nodejs \ - zstd \ - zip - - - name: Checkout + apt-get install --yes --no-install-recommends nodejs zstd zip + - name: Checkout code uses: actions/checkout@v4 - - - name: Hash west modules + - name: Compute hash for west modules id: hash-west run: | - FILE_PATH=zephyr/west.yml - FILES=$(find . -name build.yml -o -name west.yml -type f -exec sha256sum \; | sort) - HASH="$(echo -n $FILES | sha256sum | head -c 64)" + HASH=$(find . -name 'build.yml' -o -name 'west.yml' -exec sha256sum {} \; | sort | sha256sum | head -c 64) echo "hash=$HASH" >> "$GITHUB_OUTPUT" - echo "computed hash: $HASH" - - name: Cache west modules uses: actions/cache@v4 - env: - cache-name: cache-zephyr-modules with: path: | modules/ tools/ zephyr/ - bootloader/ - key: ${{ runner.os }}-build-left-${{ env.cache-name }}-${{ steps.hash-west.outputs.hash }} - restore-keys: | - ${{ runner.os }}-build-left-${{ env.cache-name }}- - ${{ runner.os }}-build-left- - ${{ runner.os }}- - timeout-minutes: 5 - continue-on-error: true - - - name: West Init - run: west init -l config - - - name: West Update - run: west update - - - name: West Zephyr export - run: west zephyr-export - - - name: West Build (Ferris Right) - run: west build --pristine -s zmk/app -b nice_nano_v2 -- -DSHIELD=cradio_right -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" - - - name: Ferris Right Kconfig file - run: cat build/zephyr/.config | grep -v "^#" | grep -v "^$" - - - name: Rename zmk.uf2 - run: cp build/zephyr/zmk.uf2 cradio_right_nice_nano_v2.uf2 - - - name: Hash west modules - id: hash-west + bootloader/ + key: ${{ runner.os }}-build-right-${{ steps.hash-west.outputs.hash }} + - name: Initialize and update West run: | - FILE_PATH=zephyr/west.yml - FILES=$(find . -name build.yml -o -name west.yml -type f -exec sha256sum \; | sort) - HASH="$(echo -n $FILES | sha256sum | head -c 64)" - echo "hash=$HASH" >> "$GITHUB_OUTPUT" - echo "computed hash: $HASH" - - - name: Upload Artifact - uses: actions/upload-artifact@v3 + west init -l config + west update + west zephyr-export + - name: Build Firmware (Right) + run: west build --pristine -s zmk/app -b nice_nano_v2 -- -DSHIELD=cradio_right -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" + - name: Rename and upload artifact (Right) + run: mv build/zephyr/zmk.uf2 cradio_right_nice_nano_v2.uf2 + - uses: actions/upload-artifact@v3 with: path: cradio_right_nice_nano_v2.uf2 name: right - build: + combine: needs: - build-left - build-right runs-on: ubuntu-latest container: image: zmkfirmware/zmk-build-arm:stable - name: Build steps: - - name: Install Dependencies + - name: Setup run: | apt-get update; - apt-get install --yes --no-install-recommends \ - nodejs \ - zip - - - name: Download artifact (right) + apt-get install --yes --no-install-recommends nodejs zip + - name: Download artifacts uses: actions/download-artifact@v3 with: - path: cradio_right_nice_nano_v2.uf2 - name: right - - - name: Download artifact (left) - uses: actions/download-artifact@v3 - with: - path: cradio_left_nice_nano_v2.uf2 name: left - - - name: Move artifacts - run: | - mkdir firmware - mv cradio_left_nice_nano_v2.uf2 firmware/ - mv cradio_right_nice_nano_v2.uf2 firmware/ - - - name: Hash west modules - id: hash-west - run: | - FILE_PATH=zephyr/west.yml - FILES=$(find . -name build.yml -o -name west.yml -type f -exec sha256sum \; | sort) - HASH="$(echo -n $FILES | sha256sum | head -c 64)" - echo "hash=$HASH" >> "$GITHUB_OUTPUT" - echo "computed hash: $HASH" - - - name: Upload Artifact + path: firmware/ + - uses: actions/download-artifact@v3 + with: + name: right + path: firmware/ + - name: Upload combined firmware artifacts uses: actions/upload-artifact@v3 with: path: firmware/