From b769d9f8542d109f37922c9fad3d027265b0009d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 1 Oct 2024 13:14:51 +0200 Subject: [PATCH] change workflow to build one zip per processor arch --- .github/actions/build-variant/action.yml | 6 +- .github/workflows/build_esp32.yml | 1 + .github/workflows/build_esp32_c3.yml | 1 + .github/workflows/build_esp32_c6.yml | 1 + .github/workflows/build_esp32_s3.yml | 1 + .github/workflows/build_nrf52.yml | 1 + .github/workflows/build_rpi2040.yml | 1 + .github/workflows/build_stm32.yml | 2 + .github/workflows/main_matrix.yml | 174 ++++++++++++----------- 9 files changed, 102 insertions(+), 86 deletions(-) diff --git a/.github/actions/build-variant/action.yml b/.github/actions/build-variant/action.yml index f9410eb03..80d2a56bb 100644 --- a/.github/actions/build-variant/action.yml +++ b/.github/actions/build-variant/action.yml @@ -31,6 +31,10 @@ inputs: description: Include the web UI in the build required: false default: "false" + arch: + description: Processor arch name + required: true + default: "esp32" runs: using: composite @@ -84,7 +88,7 @@ runs: - name: Store binaries as an artifact uses: actions/upload-artifact@v4 with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + name: firmware-${{ inputs.arch }}-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip overwrite: true path: | ${{ inputs.artifact-paths }} diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 041191d34..7d069e3db 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -31,3 +31,4 @@ jobs: release/*.bin release/*.elf include-web-ui: true + arch: esp32 diff --git a/.github/workflows/build_esp32_c3.yml b/.github/workflows/build_esp32_c3.yml index ddc2e2859..5234dbe81 100644 --- a/.github/workflows/build_esp32_c3.yml +++ b/.github/workflows/build_esp32_c3.yml @@ -32,3 +32,4 @@ jobs: artifact-paths: | release/*.bin release/*.elf + arch: esp32c3 diff --git a/.github/workflows/build_esp32_c6.yml b/.github/workflows/build_esp32_c6.yml index 3be813afa..66f2764a6 100644 --- a/.github/workflows/build_esp32_c6.yml +++ b/.github/workflows/build_esp32_c6.yml @@ -33,3 +33,4 @@ jobs: artifact-paths: | release/*.bin release/*.elf + arch: esp32c6 diff --git a/.github/workflows/build_esp32_s3.yml b/.github/workflows/build_esp32_s3.yml index 29857ef17..554b37cef 100644 --- a/.github/workflows/build_esp32_s3.yml +++ b/.github/workflows/build_esp32_s3.yml @@ -31,3 +31,4 @@ jobs: release/*.bin release/*.elf include-web-ui: true + arch: esp32s3 diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index 606cb8a3e..ce26838f2 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -25,3 +25,4 @@ jobs: release/*.uf2 release/*.elf release/*.zip + arch: nrf52840 diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index b0508877d..492a1f010 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -23,3 +23,4 @@ jobs: artifact-paths: | release/*.uf2 release/*.elf + arch: rp2040 diff --git a/.github/workflows/build_stm32.yml b/.github/workflows/build_stm32.yml index e78178db3..b463bab71 100644 --- a/.github/workflows/build_stm32.yml +++ b/.github/workflows/build_stm32.yml @@ -23,3 +23,5 @@ jobs: artifact-paths: | release/*.hex release/*.bin + release/*.elf + arch: stm32 diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 277003a61..a69a105a0 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -2,9 +2,6 @@ name: CI concurrency: group: ci-${{ github.head_ref || github.run_id }} cancel-in-progress: true -#concurrency: -# group: ${{ github.ref }} -# cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} on: # # Triggers the workflow on push but only for the master branch push: @@ -155,8 +152,13 @@ jobs: permissions: contents: write pull-requests: write + strategy: + fail-fast: false + matrix: + arch: [esp32, esp32s3, esp32c3, esp32c6, nrf52840, rp2040, stm32] runs-on: ubuntu-latest - needs: [ + needs: + [ build-esp32, build-esp32-s3, build-esp32-c3, @@ -164,9 +166,6 @@ jobs: build-nrf52, build-rpi2040, build-stm32, - package-raspbian, - package-raspbian-armv7l, - # package-native, ] steps: - name: Checkout code @@ -178,6 +177,7 @@ jobs: - uses: actions/download-artifact@v4 with: path: ./ + pattern: firmware-${{matrix.arch}}-* merge-multiple: true - name: Display structure of downloaded files @@ -188,12 +188,12 @@ jobs: id: version - name: Move files up - run: mv -b -t ./ ./release/meshtasticd_linux_* ./bin/config-dist.yaml ./bin/device-*.sh ./bin/device-*.bat + run: mv -b -t ./ ./bin/device-*.sh ./bin/device-*.bat - name: Repackage in single firmware zip uses: actions/upload-artifact@v4 with: - name: firmware-${{ steps.version.outputs.version }} + name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }} overwrite: true path: | ./firmware-*.bin @@ -202,8 +202,6 @@ jobs: ./firmware-*-ota.zip ./device-*.sh ./device-*.bat - ./meshtasticd_linux_* - ./config-dist.yaml ./littlefs-*.bin ./bleota*bin ./Meshtastic_nRF52_factory_erase*.uf2 @@ -211,7 +209,7 @@ jobs: - uses: actions/download-artifact@v4 with: - name: firmware-${{ steps.version.outputs.version }} + name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }} merge-multiple: true path: ./output @@ -225,12 +223,12 @@ jobs: chmod +x ./output/device-update.sh - name: Zip firmware - run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output + run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./output - name: Repackage in single elfs zip uses: actions/upload-artifact@v4 with: - name: debug-elfs-${{ steps.version.outputs.version }}.zip + name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip overwrite: true path: ./*.elf retention-days: 30 @@ -238,14 +236,21 @@ jobs: - uses: scruplelesswizard/comment-artifact@main if: ${{ github.event_name == 'pull_request' }} with: - name: firmware-${{ steps.version.outputs.version }} - description: "Download firmware-${{ steps.version.outputs.version }}.zip. This artifact will be available for 90 days from creation" + name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }} + description: "Download firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip. This artifact will be available for 90 days from creation" github-token: ${{ secrets.GITHUB_TOKEN }} release-artifacts: runs-on: ubuntu-latest if: ${{ github.event_name == 'workflow_dispatch' }} - needs: [gather-artifacts] + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + needs: [ + gather-artifacts, + package-raspbian, + package-raspbian-armv7l, + # package-native, + ] steps: - name: Checkout uses: actions/checkout@v4 @@ -259,36 +264,6 @@ jobs: run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - - uses: actions/download-artifact@v4 - with: - name: firmware-${{ steps.version.outputs.version }} - merge-multiple: true - path: ./output - - - name: Display structure of downloaded files - run: ls -R - - - name: Device scripts permissions - run: | - chmod +x ./output/device-install.sh - chmod +x ./output/device-update.sh - - - name: Zip firmware - run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output -x meshtasticd_* - - - uses: actions/download-artifact@v4 - with: - name: debug-elfs-${{ steps.version.outputs.version }}.zip - merge-multiple: true - path: ./elfs - - - name: Zip Elfs - run: zip -j -9 -r ./debug-elfs-${{ steps.version.outputs.version }}.zip ./elfs - - # For diagnostics - - name: Show artifacts - run: ls -lR - - name: Create release uses: actions/create-release@v1 id: create_release @@ -302,32 +277,17 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - - name: Add bins to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./firmware-${{ steps.version.outputs.version }}.zip - asset_name: firmware-${{ steps.version.outputs.version }}.zip - asset_content_type: application/zip - - - name: Add debug elfs to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./debug-elfs-${{ steps.version.outputs.version }}.zip - asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip - asset_content_type: application/zip - - - uses: actions/download-artifact@v4 + - name: Download deb files + uses: actions/download-artifact@v4 with: pattern: meshtasticd_${{ steps.version.outputs.version }}_*.deb merge-multiple: true path: ./output + # For diagnostics + - name: Display structure of downloaded files + run: ls -lR + - name: Add raspbian aarch64 .deb uses: actions/upload-release-asset@v1 env: @@ -369,29 +329,73 @@ jobs: add-paths: | version.properties - - name: Checkout meshtastic/meshtastic.github.io + release-firmware: + strategy: + fail-fast: false + matrix: + arch: [esp32, esp32s3, esp32c3, esp32c6, nrf52840, rp2040, stm32] + runs-on: ubuntu-latest + if: ${{ github.event_name == 'workflow_dispatch' }} + needs: [release-artifacts] + steps: + - name: Checkout uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 with: - repository: meshtastic/meshtastic.github.io - token: ${{ secrets.ARTIFACTS_TOKEN }} - path: meshtastic.github.io + python-version: 3.x + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - uses: actions/download-artifact@v4 + with: + pattern: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }} + merge-multiple: true + path: ./output - name: Display structure of downloaded files - run: ls -R + run: ls -lR - - name: Extract firmware.zip + - name: Device scripts permissions run: | - unzip ./firmware-${{ steps.version.outputs.version }}.zip -d meshtastic.github.io/firmware-${{ steps.version.outputs.version }} + chmod +x ./output/device-install.sh + chmod +x ./output/device-update.sh + - name: Zip firmware + run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./output + + - uses: actions/download-artifact@v4 + with: + name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip + merge-multiple: true + path: ./elfs + + - name: Zip firmware + run: zip -j -9 -r ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip ./elfs + + # For diagnostics - name: Display structure of downloaded files - run: ls -R + run: ls -lR - - name: Commit and push changes - run: | - cd meshtastic.github.io - find . -type f -name 'meshtasticd_*' -exec rm -f {} + - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git add . - git commit -m "Add firmware version ${{ steps.version.outputs.version }}" - git push + - name: Add bins to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{needs.release-artifacts.outputs.upload_url}} + asset_path: ./firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip + asset_name: firmware-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip + asset_content_type: application/zip + + - name: Add debug elfs to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{needs.release-artifacts.outputs.upload_url}} + asset_path: ./debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip + asset_name: debug-elfs-${{matrix.arch}}-${{ steps.version.outputs.version }}.zip + asset_content_type: application/zip