From fe1ed3f2846ee25d636bf1b8f2c299296d9905db Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 10 Aug 2022 15:33:42 -0500 Subject: [PATCH] Pico build in PR (#1617) * Pico build in PR * Missed refs * Update main_matrix.yml --- .github/workflows/main_matrix.yml | 59 +++++++++++++++++++++++++++++-- bin/build-rpi2040.sh | 36 +++++++++++++++++++ 2 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 bin/build-rpi2040.sh diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index bad04e9ec..29f491de3 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -41,6 +41,7 @@ jobs: - board: station-g1 - board: m5stack-core - board: m5stack-coreink + - board: pico runs-on: ubuntu-latest steps: @@ -125,7 +126,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -U platformio adafruit-nrfutil littlefs-python - pip install -U --pre meshtastic - name: Upgrade platformio run: | @@ -196,7 +196,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -U platformio adafruit-nrfutil - pip install -U --pre meshtastic - name: Upgrade platformio run: | @@ -218,6 +217,60 @@ jobs: release/*.elf retention-days: 90 + build-rpi2040: + strategy: + fail-fast: false + max-parallel: 2 + matrix: + include: + - board: pico + + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: "recursive" + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.x + + - name: Cache python libs + uses: actions/cache@v1 + id: cache-pip # needed in if test + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + + - name: Upgrade python tools + run: | + python -m pip install --upgrade pip + pip install -U platformio adafruit-nrfutil + + - name: Upgrade platformio + run: | + pio upgrade + + - name: Build Raspberry Pi 2040 + run: bin/build-rpi2040.sh ${{ matrix.board }} + + - name: Get release version string + run: echo "::set-output name=version::$(./bin/buildinfo.py long)" + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v2 + with: + name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip + path: | + release/*.uf2 + release/*.elf + retention-days: 90 + build-native: runs-on: ubuntu-latest steps: @@ -289,7 +342,7 @@ jobs: gather-artifacts: runs-on: ubuntu-latest - needs: [build-esp32, build-nrf52, build-native] + needs: [build-esp32, build-nrf52, build-native, build-rpi2040] steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/bin/build-rpi2040.sh b/bin/build-rpi2040.sh new file mode 100644 index 000000000..04fe7106b --- /dev/null +++ b/bin/build-rpi2040.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +set -e + +VERSION=`bin/buildinfo.py long` +SHORT_VERSION=`bin/buildinfo.py short` + +OUTDIR=release/ + +rm -f $OUTDIR/firmware* +rm -r $OUTDIR/* || true + +# Make sure our submodules are current +git submodule update + +# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale +platformio lib update + +echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS" +rm -f .pio/build/$1/firmware.* + +# The shell vars the build tool expects to find +export APP_VERSION=$VERSION + +basename=firmware-$1-$VERSION + +pio run --environment $1 # -v +SRCELF=.pio/build/$1/firmware.elf +cp $SRCELF $OUTDIR/$basename.elf + +echo "Copying uf2 file" +SRCBIN=.pio/build/$1/firmware.uf2 +cp $SRCBIN $OUTDIR/$basename.uf2 + +cp bin/device-install.* $OUTDIR +cp bin/device-update.* $OUTDIR