mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 09:26:52 +00:00
Consolidate variant build steps (#4820)
* poc: consolidate variant build steps * use build-variant action * only checkout once and clean up after run * checkout before local action
This commit is contained in:
parent
c39d270f40
commit
b4c09ace23
95
.github/actions/build-variant/action.yml
vendored
Normal file
95
.github/actions/build-variant/action.yml
vendored
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
name: Setup Build Variant Composite Action
|
||||||
|
description: Variant build actions for Meshtastic Platform IO steps
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
board:
|
||||||
|
description: The board to build for
|
||||||
|
required: true
|
||||||
|
github_token:
|
||||||
|
description: GitHub token
|
||||||
|
required: true
|
||||||
|
build-script-path:
|
||||||
|
description: Path to the build script
|
||||||
|
required: true
|
||||||
|
remove-debug-flags:
|
||||||
|
description: A newline separated list of files to remove debug flags from
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
ota-firmware-source:
|
||||||
|
description: The OTA firmware file to pull
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
ota-firmware-target:
|
||||||
|
description: The target path to store the OTA firmware file
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
artifact-paths:
|
||||||
|
description: A newline separated list of paths to store as artifacts
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
include-web-ui:
|
||||||
|
description: Include the web UI in the build
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Build base
|
||||||
|
id: base
|
||||||
|
uses: ./.github/actions/setup-base
|
||||||
|
|
||||||
|
- name: Pull web ui
|
||||||
|
if: ${{ inputs.include-web-ui == "true" }}
|
||||||
|
uses: dsaltares/fetch-gh-release-asset@master
|
||||||
|
with:
|
||||||
|
repo: meshtastic/web
|
||||||
|
file: build.tar
|
||||||
|
target: build.tar
|
||||||
|
token: ${{ inputs.github_token }}
|
||||||
|
|
||||||
|
- name: Unpack web ui
|
||||||
|
if: ${{ inputs.include-web-ui == "true" }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
tar -xf build.tar -C data/static
|
||||||
|
rm build.tar
|
||||||
|
|
||||||
|
- name: Remove debug flags for release
|
||||||
|
shell: bash
|
||||||
|
if: ${{ inputs.remove-debug-flags != "" }}
|
||||||
|
run: |
|
||||||
|
for PATH in ${{ inputs.remove-debug-flags }}; do
|
||||||
|
sed -i '/DDEBUG_HEAP/d' ${PATH}
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Build ${{ inputs.board }}
|
||||||
|
shell: bash
|
||||||
|
run: ${{ inputs.build-script-path }} ${{ inputs.board }}
|
||||||
|
|
||||||
|
- name: Pull OTA Firmware
|
||||||
|
if: ${{ inputs.ota-firmware-source != "" && inputs.ota-firmware-target != "" }}
|
||||||
|
uses: dsaltares/fetch-gh-release-asset@master
|
||||||
|
with:
|
||||||
|
repo: meshtastic/firmware-ota
|
||||||
|
file: ${{ inputs.ota-firmware-source }}
|
||||||
|
target: ${{ inputs.ota-firmware-target }}
|
||||||
|
token: ${{ inputs.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@v4
|
||||||
|
with:
|
||||||
|
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
||||||
|
overwrite: true
|
||||||
|
path: |
|
||||||
|
${{ inputs.artifact-paths }}
|
||||||
|
|
||||||
|
- name: Clean up resources
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
rm -rf .
|
58
.github/workflows/build_esp32.yml
vendored
58
.github/workflows/build_esp32.yml
vendored
@ -12,52 +12,22 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- 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: Remove debug flags for release
|
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
||||||
run: |
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini
|
|
||||||
|
|
||||||
- name: Build ESP32
|
- name: Build ESP32
|
||||||
run: bin/build-esp32.sh ${{ inputs.board }}
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
- name: Pull OTA Firmware
|
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
|
||||||
with:
|
with:
|
||||||
repo: meshtastic/firmware-ota
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: firmware.bin
|
board: ${{ inputs.board }}
|
||||||
target: release/bleota.bin
|
remove-debug-flags: |
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
./arch/esp32/esp32.ini
|
||||||
|
./arch/esp32/esp32s2.ini
|
||||||
- name: Get release version string
|
./arch/esp32/esp32s3.ini
|
||||||
shell: bash
|
./arch/esp32/esp32c3.ini
|
||||||
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
build-script-path: bin/build-esp32.sh
|
||||||
id: version
|
ota-firmware-source: firmware.bin
|
||||||
|
ota-firmware-target: release/bleota.bin
|
||||||
- name: Store binaries as an artifact
|
artifact-paths: |
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
|
||||||
overwrite: true
|
|
||||||
path: |
|
|
||||||
release/*.bin
|
release/*.bin
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
include-web-ui: true
|
||||||
|
57
.github/workflows/build_esp32_c3.yml
vendored
57
.github/workflows/build_esp32_c3.yml
vendored
@ -14,50 +14,21 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Pull web ui
|
- name: Build ESP32-C3
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
with:
|
with:
|
||||||
repo: meshtastic/web
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: build.tar
|
board: ${{ inputs.board }}
|
||||||
target: build.tar
|
remove-debug-flags: |
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
./arch/esp32/esp32.ini
|
||||||
|
./arch/esp32/esp32s2.ini
|
||||||
- name: Unpack web ui
|
./arch/esp32/esp32s3.ini
|
||||||
run: |
|
./arch/esp32/esp32c3.ini
|
||||||
tar -xf build.tar -C data/static
|
build-script-path: bin/build-esp32.sh
|
||||||
rm build.tar
|
ota-firmware-source: firmware-c3.bin
|
||||||
- name: Remove debug flags for release
|
ota-firmware-target: release/bleota-c3.bin
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
artifact-paths: |
|
||||||
run: |
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini
|
|
||||||
- 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-c3.bin
|
|
||||||
target: release/bleota-c3.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@v4
|
|
||||||
with:
|
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
|
||||||
overwrite: true
|
|
||||||
path: |
|
|
||||||
release/*.bin
|
release/*.bin
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
58
.github/workflows/build_esp32_s3.yml
vendored
58
.github/workflows/build_esp32_s3.yml
vendored
@ -12,50 +12,22 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Pull web ui
|
- name: Build ESP32-S3
|
||||||
uses: dsaltares/fetch-gh-release-asset@master
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
with:
|
with:
|
||||||
repo: meshtastic/web
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: build.tar
|
board: ${{ inputs.board }}
|
||||||
target: build.tar
|
remove-debug-flags: |
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
./arch/esp32/esp32.ini
|
||||||
|
./arch/esp32/esp32s2.ini
|
||||||
- name: Unpack web ui
|
./arch/esp32/esp32s3.ini
|
||||||
run: |
|
./arch/esp32/esp32c3.ini
|
||||||
tar -xf build.tar -C data/static
|
build-script-path: bin/build-esp32.sh
|
||||||
rm build.tar
|
ota-firmware-source: firmware-s3.bin
|
||||||
- name: Remove debug flags for release
|
ota-firmware-target: release/bleota-s3.bin
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
artifact-paths: |
|
||||||
run: |
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s2.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32s3.ini
|
|
||||||
sed -i '/DDEBUG_HEAP/d' ./arch/esp32/esp32c3.ini
|
|
||||||
- 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-s3.bin
|
|
||||||
target: release/bleota-s3.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@v4
|
|
||||||
with:
|
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
|
||||||
overwrite: true
|
|
||||||
path: |
|
|
||||||
release/*.bin
|
release/*.bin
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
include-web-ui: true
|
||||||
|
20
.github/workflows/build_nrf52.yml
vendored
20
.github/workflows/build_nrf52.yml
vendored
@ -12,23 +12,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Build NRF52
|
- name: Build NRF52
|
||||||
run: bin/build-nrf52.sh ${{ inputs.board }}
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
- 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@v4
|
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
overwrite: true
|
board: ${{ inputs.board }}
|
||||||
path: |
|
build-script-path: bin/build-nrf52.sh
|
||||||
|
artifact-paths: |
|
||||||
release/*.hex
|
release/*.hex
|
||||||
release/*.uf2
|
release/*.uf2
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
20
.github/workflows/build_rpi2040.yml
vendored
20
.github/workflows/build_rpi2040.yml
vendored
@ -12,22 +12,14 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Build Raspberry Pi 2040
|
- name: Build Raspberry Pi 2040
|
||||||
run: ./bin/build-rpi2040.sh ${{ inputs.board }}
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
- 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@v4
|
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
overwrite: true
|
board: ${{ inputs.board }}
|
||||||
path: |
|
build-script-path: bin/build-rpi2040.sh
|
||||||
|
artifact-paths: |
|
||||||
release/*.uf2
|
release/*.uf2
|
||||||
release/*.elf
|
release/*.elf
|
||||||
|
22
.github/workflows/build_stm32.yml
vendored
22
.github/workflows/build_stm32.yml
vendored
@ -12,22 +12,14 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build base
|
|
||||||
id: base
|
|
||||||
uses: ./.github/actions/setup-base
|
|
||||||
|
|
||||||
- name: Build STM32
|
- name: Build Raspberry Pi 2040
|
||||||
run: bin/build-stm32.sh ${{ inputs.board }}
|
id: build
|
||||||
|
uses: ./.github/actions/build-variant
|
||||||
- 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@v4
|
|
||||||
with:
|
with:
|
||||||
name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
overwrite: true
|
board: ${{ inputs.board }}
|
||||||
path: |
|
build-script-path: bin/build-stm32.sh
|
||||||
|
artifact-paths: |
|
||||||
release/*.hex
|
release/*.hex
|
||||||
release/*.bin
|
release/*.bin
|
||||||
|
Loading…
Reference in New Issue
Block a user