From dcfa226509d94c2514bb0f2d62c170e5ee2a9c06 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 15:42:08 -0600 Subject: [PATCH 01/33] Remove extra git submodule update --- bin/build-esp32.sh | 3 --- bin/build-native.sh | 3 --- bin/build-nrf52.sh | 3 --- bin/build-rpi2040.sh | 3 --- 4 files changed, 12 deletions(-) diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh index 12961864f..5a2044a35 100755 --- a/bin/build-esp32.sh +++ b/bin/build-esp32.sh @@ -10,9 +10,6 @@ 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 pkg update diff --git a/bin/build-native.sh b/bin/build-native.sh index b620a01d8..8bc262860 100755 --- a/bin/build-native.sh +++ b/bin/build-native.sh @@ -12,9 +12,6 @@ rm -f $OUTDIR/firmware* mkdir -p $OUTDIR/ 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 pkg update diff --git a/bin/build-nrf52.sh b/bin/build-nrf52.sh index 6c723e28f..a9980f486 100755 --- a/bin/build-nrf52.sh +++ b/bin/build-nrf52.sh @@ -10,9 +10,6 @@ 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 pkg update diff --git a/bin/build-rpi2040.sh b/bin/build-rpi2040.sh index 670f570f1..fe0725085 100755 --- a/bin/build-rpi2040.sh +++ b/bin/build-rpi2040.sh @@ -10,9 +10,6 @@ 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 pkg update From 35c50f074b2d26721ba628ef90499a7e0928c24d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 15:44:59 -0600 Subject: [PATCH 02/33] Build and push to docker hub --- .github/workflows/main_matrix.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index d9d6634ff..f58eccca7 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -333,6 +333,23 @@ jobs: release/device-*.sh release/device-*.bat retention-days: 30 + + - name: Docker login + uses: docker/login-action@v2 + with: + username: meshtastic + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Docker setup + uses: docker/setup-buildx-action@v2 + + - name: Docker build and push + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile + push: true + tags: meshtastic/device:simulator after-checks: runs-on: ubuntu-latest From a4d5f8c7173fdec2fe80c8c992b6dc12f07814eb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:03:55 -0600 Subject: [PATCH 03/33] Reusable workflow --- .github/workflows/build_esp32.yml | 77 +++++++++++++++++++++++++++++++ .github/workflows/main_matrix.yml | 67 ++------------------------- 2 files changed, 80 insertions(+), 64 deletions(-) create mode 100644 .github/workflows/build_esp32.yml diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml new file mode 100644 index 000000000..7b618604b --- /dev/null +++ b/.github/workflows/build_esp32.yml @@ -0,0 +1,77 @@ +name: Build ESP32 + +on: + workflow_call: + inputs: + board: + required: true + type: string + +jobs: + build-esp32: + 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@v4 + with: + python-version: 3.x + + - name: Cache python libs + uses: actions/cache@v3 + 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: Pull web ui + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: "meshtastic/web" + file: "build.tar" + target: "build.tar" + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Unpack web ui + run: | + tar -xf build.tar -C data/static + rm build.tar + + - name: Build ESP32 + run: bin/build-esp32.sh ${{ inputs.board }} + + - name: Pull OTA Firmware + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: "meshtastic/firmware-ota" + file: "firmware.bin" + target: "release/bleota.bin" + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v3 + with: + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + path: | + release/*.bin + release/*.elf + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index f58eccca7..b461d9d26 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -97,70 +97,9 @@ jobs: 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@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - 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: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: "meshtastic/web" - file: "build.tar" - target: "build.tar" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unpack web ui - run: | - tar -xf build.tar -C data/static - rm build.tar - - - name: Build ESP32 - run: bin/build-esp32.sh ${{ matrix.board }} - - - name: Pull OTA Firmware - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: "meshtastic/firmware-ota" - file: "firmware.bin" - target: "release/bleota.bin" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 - with: - name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip - path: | - release/*.bin - release/*.elf - retention-days: 30 + uses: ./.github/workflows/build_esp32.yml + with: + board: ${{ matrix.board }} build-nrf52: strategy: From fe00f0c369affb9844a7c415f95db43fe4856bb9 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:06:59 -0600 Subject: [PATCH 04/33] Uses block --- .github/workflows/main_matrix.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index b461d9d26..4cbe3f4bd 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -97,9 +97,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: ./.github/workflows/build_esp32.yml - with: - board: ${{ matrix.board }} + - uses: ./.github/workflows/build_esp32.yml + with: + board: ${{ matrix.board }} build-nrf52: strategy: From 8de79e8fb6a164831d2575c561f418189bd582b2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:08:11 -0600 Subject: [PATCH 05/33] Path --- .github/workflows/main_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 4cbe3f4bd..7665e0c2f 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -97,7 +97,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: ./.github/workflows/build_esp32.yml + - uses: .github/workflows/build_esp32.yml with: board: ${{ matrix.board }} From eb1f6c0de6bd7617c64b5b21473f05e2d815bac0 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:13:26 -0600 Subject: [PATCH 06/33] Root path? --- .github/workflows/main_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 7665e0c2f..06533b871 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -97,7 +97,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: .github/workflows/build_esp32.yml + - uses: /.github/workflows/build_esp32.yml with: board: ${{ matrix.board }} From eb34a95ab712ed94be71110d84475a622f2e8c13 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:23:09 -0600 Subject: [PATCH 07/33] Why fight me? --- .github/workflows/main_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 06533b871..4cbe3f4bd 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -97,7 +97,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: /.github/workflows/build_esp32.yml + - uses: ./.github/workflows/build_esp32.yml with: board: ${{ matrix.board }} From d2d2f278cf78c21ace92addfd56df1014ce4c2c2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:25:00 -0600 Subject: [PATCH 08/33] Apparently checkout before using a local workflow --- .github/workflows/build_esp32.yml | 7 ------- .github/workflows/main_matrix.yml | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 7b618604b..b3ce24ed8 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,13 +11,6 @@ jobs: build-esp32: 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@v4 with: diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 4cbe3f4bd..14616ca22 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -97,6 +97,13 @@ jobs: 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}} + - uses: ./.github/workflows/build_esp32.yml with: board: ${{ matrix.board }} From 0cc653263e33d3499c0df3fc4292972200fac823 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:39:05 -0600 Subject: [PATCH 09/33] Indent --- .github/workflows/main_matrix.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 14616ca22..257f96442 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -98,11 +98,11 @@ jobs: 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}} + uses: actions/checkout@v3 + with: + submodules: "recursive" + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} - uses: ./.github/workflows/build_esp32.yml with: From 9e914de9950d39440f016fcb9c69d0ae18884881 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:46:36 -0600 Subject: [PATCH 10/33] Try going up a dir --- .github/workflows/main_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 257f96442..d0edee63d 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -104,7 +104,7 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: ./.github/workflows/build_esp32.yml + - uses: ./../.github/workflows/build_esp32.yml with: board: ${{ matrix.board }} From 5ce7ffc8885f23fdc9933dda2c8c79c49200e27d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:51:33 -0600 Subject: [PATCH 11/33] Show contents --- .github/workflows/main_matrix.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index d0edee63d..af2518941 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -103,6 +103,9 @@ jobs: submodules: "recursive" ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Show contents # For diagnostics + run: ls -lR - uses: ./../.github/workflows/build_esp32.yml with: From 0533fd922796c29e3c8ac088dd86eccab2845ab2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 17:35:47 -0600 Subject: [PATCH 12/33] Uses --- .github/workflows/build_esp32.yml | 7 +++++++ .github/workflows/main_matrix.yml | 17 +++-------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index b3ce24ed8..7b618604b 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,6 +11,13 @@ jobs: build-esp32: 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@v4 with: diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index af2518941..962a8892d 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -96,20 +96,9 @@ jobs: - board: tbeam-s3-core 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: Show contents # For diagnostics - run: ls -lR - - - uses: ./../.github/workflows/build_esp32.yml - with: - board: ${{ matrix.board }} + uses: ./.github/workflows/build_esp32.yml + with: + board: ${{ matrix.board }} build-nrf52: strategy: From 1dcd411d00d27015c5a1a0051504d90fd7877dfb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 17:43:18 -0600 Subject: [PATCH 13/33] Fix indention --- .github/workflows/build_esp32.yml | 110 +++++++++++++++--------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 7b618604b..eb5ac428c 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -10,68 +10,68 @@ on: jobs: build-esp32: 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}} + 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@v4 - with: - python-version: 3.x + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.x - - name: Cache python libs - uses: actions/cache@v3 - id: cache-pip # needed in if test - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip + - name: Cache python libs + uses: actions/cache@v3 + 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 python tools + run: | + python -m pip install --upgrade pip + pip install -U platformio adafruit-nrfutil - - name: Upgrade platformio - run: | - pio upgrade + - name: Upgrade platformio + run: | + pio upgrade - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: "meshtastic/web" - file: "build.tar" - target: "build.tar" - token: ${{ secrets.GITHUB_TOKEN }} + - name: Pull web ui + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: "meshtastic/web" + file: "build.tar" + target: "build.tar" + token: ${{ secrets.GITHUB_TOKEN }} - - name: Unpack web ui - run: | - tar -xf build.tar -C data/static - rm build.tar + - name: Unpack web ui + run: | + tar -xf build.tar -C data/static + rm build.tar - - name: Build ESP32 - run: bin/build-esp32.sh ${{ inputs.board }} + - name: Build ESP32 + run: bin/build-esp32.sh ${{ inputs.board }} - - name: Pull OTA Firmware - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: "meshtastic/firmware-ota" - file: "firmware.bin" - target: "release/bleota.bin" - token: ${{ secrets.GITHUB_TOKEN }} + - name: Pull OTA Firmware + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: "meshtastic/firmware-ota" + file: "firmware.bin" + target: "release/bleota.bin" + token: ${{ secrets.GITHUB_TOKEN }} - - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version - - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 - with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip - path: | - release/*.bin - release/*.elf - retention-days: 30 \ No newline at end of file + - name: Store binaries as an artifact + uses: actions/upload-artifact@v3 + with: + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + path: | + release/*.bin + release/*.elf + retention-days: 30 From 10837ce549b875ae0947ebe0886a0943b4da0a1a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 17:45:33 -0600 Subject: [PATCH 14/33] With block --- .github/workflows/main_matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 962a8892d..c7b3b0b86 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -97,8 +97,8 @@ jobs: runs-on: ubuntu-latest uses: ./.github/workflows/build_esp32.yml - with: - board: ${{ matrix.board }} + with: + board: ${{ matrix.board }} build-nrf52: strategy: From 27401bb9b8e348c889f264cecf4bed0eb2b37576 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 17:48:01 -0600 Subject: [PATCH 15/33] Remove runs-on --- .github/workflows/main_matrix.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index c7b3b0b86..b27b8bfab 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -94,8 +94,6 @@ jobs: - board: m5stack-core - board: m5stack-coreink - board: tbeam-s3-core - - runs-on: ubuntu-latest uses: ./.github/workflows/build_esp32.yml with: board: ${{ matrix.board }} From 581076a5a1ec00805f709eb869636e7e1a38beca Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 18:07:07 -0600 Subject: [PATCH 16/33] Now let's take it further --- .github/workflows/build_base.yml | 44 +++++++++++++++++++++++++++++++ .github/workflows/build_esp32.yml | 36 +++---------------------- 2 files changed, 48 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/build_base.yml diff --git a/.github/workflows/build_base.yml b/.github/workflows/build_base.yml new file mode 100644 index 000000000..1474eb442 --- /dev/null +++ b/.github/workflows/build_base.yml @@ -0,0 +1,44 @@ +name: Build PlatformIO Base + +on: + workflow_call: + outputs: + version: + description: "Release version string" + value: ${{ jobs.build-base.outputs.version }} + +jobs: + build-base: + 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@v4 + with: + python-version: 3.x + + - name: Cache python libs + uses: actions/cache@v3 + 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: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version \ No newline at end of file diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index eb5ac428c..50ceb74ed 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,33 +11,9 @@ jobs: build-esp32: 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@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - 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 base + id: base + uses: ./.github/workflows/build_base.yml - name: Pull web ui uses: dsaltares/fetch-gh-release-asset@master @@ -63,14 +39,10 @@ jobs: target: "release/bleota.bin" token: ${{ secrets.GITHUB_TOKEN }} - - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - name: Store binaries as an artifact uses: actions/upload-artifact@v3 with: - name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + name: firmware-${{ inputs.board }}-${{ steps.base.outputs.version }}.zip path: | release/*.bin release/*.elf From 29cd7568f5ab1908fb7b76b9b8edcc29add5d8c5 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 18:30:43 -0600 Subject: [PATCH 17/33] Try a composite action instead --- .github/workflows/build_base.yml | 44 ---------------------- .github/workflows/build_esp32.yml | 2 +- .github/workflows/composite/build_base.yml | 42 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/build_base.yml create mode 100644 .github/workflows/composite/build_base.yml diff --git a/.github/workflows/build_base.yml b/.github/workflows/build_base.yml deleted file mode 100644 index 1474eb442..000000000 --- a/.github/workflows/build_base.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build PlatformIO Base - -on: - workflow_call: - outputs: - version: - description: "Release version string" - value: ${{ jobs.build-base.outputs.version }} - -jobs: - build-base: - 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@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - 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: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version \ No newline at end of file diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 50ceb74ed..8a109d2d1 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Build base id: base - uses: ./.github/workflows/build_base.yml + uses: ./.github/workflows/composite/build-base - name: Pull web ui uses: dsaltares/fetch-gh-release-asset@master diff --git a/.github/workflows/composite/build_base.yml b/.github/workflows/composite/build_base.yml new file mode 100644 index 000000000..4bd0cc89a --- /dev/null +++ b/.github/workflows/composite/build_base.yml @@ -0,0 +1,42 @@ +name: 'Build Base Composite Action' +description: 'Base build action for Meshtastic Platform IO steps' + +outputs: + version: + description: "Release version string" + value: ${{ steps.outputs.version }} + +runs: + using: "composite" + 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@v4 + with: + python-version: 3.x + + - name: Cache python libs + uses: actions/cache@v3 + 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: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version \ No newline at end of file From 57e2e75d249e19fca289ad44b3f806dca68496b9 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 18:35:00 -0600 Subject: [PATCH 18/33] Add shells --- .github/workflows/composite/build_base.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/composite/build_base.yml b/.github/workflows/composite/build_base.yml index 4bd0cc89a..5c57e506a 100644 --- a/.github/workflows/composite/build_base.yml +++ b/.github/workflows/composite/build_base.yml @@ -29,14 +29,17 @@ runs: key: ${{ runner.os }}-pip - name: Upgrade python tools + shell: bash run: | python -m pip install --upgrade pip pip install -U platformio adafruit-nrfutil - name: Upgrade platformio + shell: bash run: | pio upgrade - name: Get release version string + shell: bash run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version \ No newline at end of file From 8be65bb0ab4c04abe8298f3448e89da583e8f9cb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 18:40:17 -0600 Subject: [PATCH 19/33] Move the checkout --- .github/workflows/build_esp32.yml | 7 +++++++ .github/workflows/composite/build_base.yml | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 8a109d2d1..75ae97fc3 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,6 +11,13 @@ jobs: build-esp32: 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: Build base id: base uses: ./.github/workflows/composite/build-base diff --git a/.github/workflows/composite/build_base.yml b/.github/workflows/composite/build_base.yml index 5c57e506a..7c7e91c59 100644 --- a/.github/workflows/composite/build_base.yml +++ b/.github/workflows/composite/build_base.yml @@ -9,12 +9,6 @@ outputs: runs: using: "composite" 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@v4 From 23ea22c7410d52f09a85172d90fd4436216eeb10 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 18:42:27 -0600 Subject: [PATCH 20/33] Checkout master first --- .github/workflows/build_esp32.yml | 8 +------- .github/workflows/composite/build_base.yml | 6 ++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 75ae97fc3..7cb41aa88 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -11,13 +11,7 @@ jobs: build-esp32: 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}} - + - uses: actions/checkout@v3 - name: Build base id: base uses: ./.github/workflows/composite/build-base diff --git a/.github/workflows/composite/build_base.yml b/.github/workflows/composite/build_base.yml index 7c7e91c59..ea313ef73 100644 --- a/.github/workflows/composite/build_base.yml +++ b/.github/workflows/composite/build_base.yml @@ -9,6 +9,12 @@ outputs: runs: using: "composite" 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@v4 From f71cbb6f6e16d83f4a2c3937ba3b12effefac167 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 18:50:50 -0600 Subject: [PATCH 21/33] Move to actions folder --- .../{workflows/composite => actions}/build_base.yml | 10 +++++----- .github/workflows/build_esp32.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) rename .github/{workflows/composite => actions}/build_base.yml (81%) diff --git a/.github/workflows/composite/build_base.yml b/.github/actions/build_base.yml similarity index 81% rename from .github/workflows/composite/build_base.yml rename to .github/actions/build_base.yml index ea313ef73..5c57e506a 100644 --- a/.github/workflows/composite/build_base.yml +++ b/.github/actions/build_base.yml @@ -10,11 +10,11 @@ runs: using: "composite" 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}} + 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@v4 diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index 7cb41aa88..ff7590ada 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v3 - name: Build base id: base - uses: ./.github/workflows/composite/build-base + uses: ./.github/actions/build-base - name: Pull web ui uses: dsaltares/fetch-gh-release-asset@master From f3a6ed9d61310b04da94cb8c0a83687737aaa3f6 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 18:53:42 -0600 Subject: [PATCH 22/33] Rename to action --- .github/actions/{build_base.yml => action.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/actions/{build_base.yml => action.yml} (100%) diff --git a/.github/actions/build_base.yml b/.github/actions/action.yml similarity index 100% rename from .github/actions/build_base.yml rename to .github/actions/action.yml From 1e06b2d51ea89a65283adaa85d96535ef571e845 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 18:57:06 -0600 Subject: [PATCH 23/33] I think understand now --- .github/actions/{ => build-base}/action.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/actions/{ => build-base}/action.yml (100%) diff --git a/.github/actions/action.yml b/.github/actions/build-base/action.yml similarity index 100% rename from .github/actions/action.yml rename to .github/actions/build-base/action.yml From 1fac9ee1f29d529072525b65d6e64cd38f9a60bf Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 19:23:35 -0600 Subject: [PATCH 24/33] More reusable workflows --- .../{build-base => setup-base}/action.yml | 22 +-- .github/workflows/build_esp32.yml | 10 +- .github/workflows/build_nrf52.yml | 33 ++++ .github/workflows/build_rpi2040.yml | 32 ++++ .github/workflows/main_matrix.yml | 166 ++---------------- 5 files changed, 95 insertions(+), 168 deletions(-) rename .github/actions/{build-base => setup-base}/action.yml (68%) create mode 100644 .github/workflows/build_nrf52.yml create mode 100644 .github/workflows/build_rpi2040.yml diff --git a/.github/actions/build-base/action.yml b/.github/actions/setup-base/action.yml similarity index 68% rename from .github/actions/build-base/action.yml rename to .github/actions/setup-base/action.yml index 5c57e506a..1791f80ae 100644 --- a/.github/actions/build-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -1,10 +1,5 @@ -name: 'Build Base Composite Action' -description: 'Base build action for Meshtastic Platform IO steps' - -outputs: - version: - description: "Release version string" - value: ${{ steps.outputs.version }} +name: 'Setup Build Base Composite Action' +description: 'Base build actions for Meshtastic Platform IO steps' runs: using: "composite" @@ -15,6 +10,11 @@ runs: submodules: "recursive" ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Install cppcheck + shell: bash + run: | + sudo apt-get install -y cppcheck - name: Setup Python uses: actions/setup-python@v4 @@ -33,13 +33,9 @@ runs: run: | python -m pip install --upgrade pip pip install -U platformio adafruit-nrfutil + pip install -U meshtastic --pre - name: Upgrade platformio shell: bash run: | - pio upgrade - - - name: Get release version string - shell: bash - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version \ No newline at end of file + pio upgrade \ No newline at end of file diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml index ff7590ada..6d5dd9863 100644 --- a/.github/workflows/build_esp32.yml +++ b/.github/workflows/build_esp32.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v3 - name: Build base id: base - uses: ./.github/actions/build-base + uses: ./.github/actions/setup-base - name: Pull web ui uses: dsaltares/fetch-gh-release-asset@master @@ -39,12 +39,16 @@ jobs: file: "firmware.bin" target: "release/bleota.bin" token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get release version string + shell: bash + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version - name: Store binaries as an artifact uses: actions/upload-artifact@v3 with: - name: firmware-${{ inputs.board }}-${{ steps.base.outputs.version }}.zip + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | release/*.bin release/*.elf - retention-days: 30 diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml new file mode 100644 index 000000000..da279a5de --- /dev/null +++ b/.github/workflows/build_nrf52.yml @@ -0,0 +1,33 @@ +name: Build NRF52 + +on: + workflow_call: + inputs: + board: + required: true + type: string + +jobs: + build-nrf52: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build base + id: base + uses: ./.github/actions/setup-base + + - name: Build NRF52 + run: bin/build-nrf52.sh ${{ matrix.board }} + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v3 + with: + name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip + path: | + release/*.uf2 + release/*.elf + release/*.zip \ No newline at end of file diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml new file mode 100644 index 000000000..608918b95 --- /dev/null +++ b/.github/workflows/build_rpi2040.yml @@ -0,0 +1,32 @@ +name: Build RPI2040 + +on: + workflow_call: + inputs: + board: + required: true + type: string + +jobs: + build-rpi2040: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build base + id: base + uses: ./.github/actions/setup-base + + - name: Build Raspberry Pi 2040 + run: ./bin/build-rpi2040.sh ${{ matrix.board }} + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v3 + with: + name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip + path: | + release/*.uf2 + release/*.elf \ No newline at end of file diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index b27b8bfab..496cb2a53 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -35,37 +35,10 @@ jobs: 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: Install cppcheck - run: | - sudo apt-get install -y cppcheck - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - id: cache-pip # needed in if test - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip - - - name: Upgrade python tools and install platformio - run: | - python -m pip install --upgrade pip - pip install -U platformio - - - name: Upgrade platformio - run: | - pio upgrade + - uses: actions/checkout@v3 + - name: Build base + id: base + uses: ./.github/actions/setup-base - name: Check ${{ matrix.board }} run: bin/check-all.sh ${{ matrix.board }} @@ -109,53 +82,9 @@ jobs: - board: t-echo - board: pca10059_diy_eink - board: feather_diy - - 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@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - 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 NRF52 - run: bin/build-nrf52.sh ${{ matrix.board }} - - - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 - with: - name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip - path: | - release/*.uf2 - release/*.elf - release/*.zip - retention-days: 30 + uses: ./.github/workflows/build_nrf52.yml + with: + board: ${{ matrix.board }} build-rpi2040: strategy: @@ -164,84 +93,17 @@ jobs: 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@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - 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 "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 - with: - name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip - path: | - release/*.uf2 - release/*.elf - retention-days: 30 + uses: ./.github/workflows/build_rpi2040.yml + with: + board: ${{ matrix.board }} build-native: 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@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - 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 - pip install -U meshtastic --pre - - - name: Upgrade platformio - run: | - pio upgrade + - uses: actions/checkout@v3 + - name: Build base + id: base + uses: ./.github/actions/setup-base # We now run integration test before other build steps (to quickly see runtime failures) - name: Build for native From 6118a966a6724adcc105375c9f5392b1b245822b Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 19:30:19 -0600 Subject: [PATCH 25/33] Move em up --- .github/workflows/main_matrix.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 496cb2a53..9cf50130a 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -82,9 +82,9 @@ jobs: - board: t-echo - board: pca10059_diy_eink - board: feather_diy - uses: ./.github/workflows/build_nrf52.yml - with: - board: ${{ matrix.board }} + uses: ./.github/workflows/build_nrf52.yml + with: + board: ${{ matrix.board }} build-rpi2040: strategy: @@ -93,9 +93,9 @@ jobs: matrix: include: - board: pico - uses: ./.github/workflows/build_rpi2040.yml - with: - board: ${{ matrix.board }} + uses: ./.github/workflows/build_rpi2040.yml + with: + board: ${{ matrix.board }} build-native: runs-on: ubuntu-latest From 6299e5483b90f1e361764dc384223635bae1477f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 19:39:39 -0600 Subject: [PATCH 26/33] Input boards --- .github/workflows/build_nrf52.yml | 4 ++-- .github/workflows/build_rpi2040.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_nrf52.yml b/.github/workflows/build_nrf52.yml index da279a5de..cdf43c22e 100644 --- a/.github/workflows/build_nrf52.yml +++ b/.github/workflows/build_nrf52.yml @@ -17,7 +17,7 @@ jobs: uses: ./.github/actions/setup-base - name: Build NRF52 - run: bin/build-nrf52.sh ${{ matrix.board }} + run: bin/build-nrf52.sh ${{ inputs.board }} - name: Get release version string run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT @@ -26,7 +26,7 @@ jobs: - name: Store binaries as an artifact uses: actions/upload-artifact@v3 with: - name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | release/*.uf2 release/*.elf diff --git a/.github/workflows/build_rpi2040.yml b/.github/workflows/build_rpi2040.yml index 608918b95..fb7e3db5b 100644 --- a/.github/workflows/build_rpi2040.yml +++ b/.github/workflows/build_rpi2040.yml @@ -17,7 +17,7 @@ jobs: uses: ./.github/actions/setup-base - name: Build Raspberry Pi 2040 - run: ./bin/build-rpi2040.sh ${{ matrix.board }} + run: ./bin/build-rpi2040.sh ${{ inputs.board }} - name: Get release version string run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT @@ -26,7 +26,7 @@ jobs: - name: Store binaries as an artifact uses: actions/upload-artifact@v3 with: - name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip path: | release/*.uf2 release/*.elf \ No newline at end of file From 48ea54748f8a5f5e3e908485c6418e52f0d4d041 Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Sun, 20 Nov 2022 06:38:17 +0000 Subject: [PATCH 27/33] Fix build instructions link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6432803e4..5bae2f345 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This repository contains the device firmware for the Meshtastic project. -**[Building Instructions](https://meshtastic.org/docs/developers/Firmware/build)** +**[Building Instructions](https://meshtastic.org/docs/development/firmware/build)** **[Flashing Instructions](https://meshtastic.org/docs/getting-started/flashing-firmware/)** ## Stats From 0e04bea39e60a2efc5200a79833fd145899916b9 Mon Sep 17 00:00:00 2001 From: Dmitry Galenko Date: Sun, 20 Nov 2022 12:57:55 +0100 Subject: [PATCH 28/33] Fix for Dockerfile-related security defects and rewrite to follow best practices --- Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0ce4e3326..8e3cd2154 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,41 @@ FROM debian:bullseye-slim AS builder -RUN apt-get update -RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install wget python3 g++ zip python3-venv git vim -RUN wget https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py -O get-platformio.py; chmod +x get-platformio.py -RUN python3 get-platformio.py -RUN git clone https://github.com/meshtastic/firmware --recurse-submodules -RUN cd firmware -RUN chmod +x ./firmware/bin/build-native.sh -RUN . ~/.platformio/penv/bin/activate; cd firmware; sh ./bin/build-native.sh + +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Etc/UTC + +# http://bugs.python.org/issue19846 +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. +ENV LANG C.UTF-8 + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Install build deps +USER root +RUN apt-get update && \ + apt-get -y install wget python3 g++ zip python3-venv git vim ca-certificates + +# create a non-priveleged user & group +RUN groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 mesh + +USER mesh +RUN wget https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py -qO /tmp/get-platformio.py && \ + chmod +x /tmp/get-platformio.py && \ + python3 /tmp/get-platformio.py && \ + git clone https://github.com/meshtastic/firmware --recurse-submodules /tmp/firmware && \ + cd /tmp/firmware && \ + chmod +x /tmp/firmware/bin/build-native.sh && \ + source ~/.platformio/penv/bin/activate && \ + ./bin/build-native.sh FROM frolvlad/alpine-glibc -WORKDIR /root/ -COPY --from=builder /firmware/release/meshtasticd_linux_amd64 ./ -RUN apk --update add --no-cache g++ -CMD sh -cx "./meshtasticd_linux_amd64 --hwid '$RANDOM'" \ No newline at end of file + +RUN apk --update add --no-cache g++ shadow && \ + groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 mesh + +COPY --from=builder /tmp/firmware/release/meshtasticd_linux_amd64 /home/mesh/ + +USER mesh +WORKDIR /home/mesh +CMD sh -cx "./meshtasticd_linux_amd64 --hwid '$RANDOM'" + +HEALTHCHECK NONE From f4704181e90a65ed9ca5ca00cce09784fe71f060 Mon Sep 17 00:00:00 2001 From: Dmitry Galenko Date: Sun, 20 Nov 2022 13:12:51 +0100 Subject: [PATCH 29/33] Fix potential buffer clean issue --- src/mesh/compression/unishox2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/compression/unishox2.c b/src/mesh/compression/unishox2.c index e1f32ae05..2a8d35350 100644 --- a/src/mesh/compression/unishox2.c +++ b/src/mesh/compression/unishox2.c @@ -125,7 +125,7 @@ byte is_inited = 0; void init_coder() { if (is_inited) return; - memset(usx_code_94, '\0', sizeof(usx_code_94)); + memset_s(usx_code_94, '\0', sizeof(usx_code_94)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 28; j++) { byte c = usx_sets[i][j]; From 4ec3b025f0875aac4a01dfd3090932165e6eb7d8 Mon Sep 17 00:00:00 2001 From: Dmitry Galenko Date: Sun, 20 Nov 2022 13:19:47 +0100 Subject: [PATCH 30/33] look like https://sg.run/jkdn not hit us --- .semgrepignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .semgrepignore diff --git a/.semgrepignore b/.semgrepignore new file mode 100644 index 000000000..6ae867e8b --- /dev/null +++ b/.semgrepignore @@ -0,0 +1 @@ +.github/workflows/main_matrix.yml From 4392df06765524246dcae1d71aef7fd05455524d Mon Sep 17 00:00:00 2001 From: Dmitry Galenko Date: Sun, 20 Nov 2022 13:27:55 +0100 Subject: [PATCH 31/33] Missed STDC_LIB_EXT1 --- src/mesh/compression/unishox2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesh/compression/unishox2.c b/src/mesh/compression/unishox2.c index 2a8d35350..0700c1b36 100644 --- a/src/mesh/compression/unishox2.c +++ b/src/mesh/compression/unishox2.c @@ -25,6 +25,7 @@ * defined in unishox2.h */ +#define __STDC_WANT_LIB_EXT1__ 1 #include #include #include From ce16b50d5fb20dabe6c2f6782bdaa38ca51b3204 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 20 Nov 2022 07:05:49 -0600 Subject: [PATCH 32/33] Change docker push critera --- .github/workflows/main_matrix.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 9cf50130a..2440b2ed3 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -130,25 +130,27 @@ jobs: release/meshtasticd_linux_amd64 release/device-*.sh release/device-*.bat - retention-days: 30 - name: Docker login + if: ${{ github.event_name == 'workflow_dispatch' }} uses: docker/login-action@v2 with: username: meshtastic password: ${{ secrets.DOCKER_TOKEN }} - name: Docker setup + if: ${{ github.event_name == 'workflow_dispatch' }} uses: docker/setup-buildx-action@v2 - name: Docker build and push + if: ${{ github.event_name == 'workflow_dispatch' }} uses: docker/build-push-action@v3 with: context: . file: ./Dockerfile push: true - tags: meshtastic/device:simulator - + tags: meshtastic/device-simulator:latest + after-checks: runs-on: ubuntu-latest needs: [check] From 3187b5abda379c162e6507a41bdaa7838274d018 Mon Sep 17 00:00:00 2001 From: Dmitry Galenko Date: Sun, 20 Nov 2022 14:29:05 +0100 Subject: [PATCH 33/33] Revert "Missed STDC_LIB_EXT1" This reverts commit 4392df06765524246dcae1d71aef7fd05455524d. --- src/mesh/compression/unishox2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mesh/compression/unishox2.c b/src/mesh/compression/unishox2.c index 0700c1b36..e1f32ae05 100644 --- a/src/mesh/compression/unishox2.c +++ b/src/mesh/compression/unishox2.c @@ -25,7 +25,6 @@ * defined in unishox2.h */ -#define __STDC_WANT_LIB_EXT1__ 1 #include #include #include @@ -126,7 +125,7 @@ byte is_inited = 0; void init_coder() { if (is_inited) return; - memset_s(usx_code_94, '\0', sizeof(usx_code_94)); + memset(usx_code_94, '\0', sizeof(usx_code_94)); for (int i = 0; i < 3; i++) { for (int j = 0; j < 28; j++) { byte c = usx_sets[i][j];