From f664de898db047a14c5b7379f9bdfee38ba99898 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sat, 14 Dec 2024 22:51:47 +0100 Subject: [PATCH] Improved build scripting and CI (#123) - Simplified board ids/naming in all build scripting - Implemented archiving of build artifacts for all devices in pipelines (including symbols releases for debugging) - Implemented building and archiving of SDK for esp32 and esp32s3 in pipelines - Flattened SDK release folder structure - Renamed "Tactility-(ARCH)-SDK" to "TactilitySDK-(ARCH)" (aligns with "default" folder name, that's without the (ARCH)) --- .github/actions/build-firmware/action.yml | 22 +++++++----- .github/actions/build-sdk/action.yml | 34 +++++++++++++++++++ .github/workflows/build-firmware.yml | 12 +++---- .github/workflows/build-sdk.yml | 24 +++++++++++++ Buildscripts/build-and-release-all.sh | 20 +++++------ Buildscripts/build.sh | 2 +- Buildscripts/clean.sh | 1 - Buildscripts/release.sh | 7 ++-- ...lygo_tdeck => sdkconfig.board.lilygo-tdeck | 0 ...ack_core2 => sdkconfig.board.m5stack-core2 | 0 ...k_cores3 => sdkconfig.board.m5stack-cores3 | 0 ...llow_board => sdkconfig.board.yellow-board | 0 12 files changed, 90 insertions(+), 32 deletions(-) create mode 100644 .github/actions/build-sdk/action.yml create mode 100644 .github/workflows/build-sdk.yml rename sdkconfig.board.lilygo_tdeck => sdkconfig.board.lilygo-tdeck (100%) rename sdkconfig.board.m5stack_core2 => sdkconfig.board.m5stack-core2 (100%) rename sdkconfig.board.m5stack_cores3 => sdkconfig.board.m5stack-cores3 (100%) rename sdkconfig.board.yellow_board => sdkconfig.board.yellow-board (100%) diff --git a/.github/actions/build-firmware/action.yml b/.github/actions/build-firmware/action.yml index 3df7f648..a2de5016 100644 --- a/.github/actions/build-firmware/action.yml +++ b/.github/actions/build-firmware/action.yml @@ -1,10 +1,7 @@ name: Build inputs: - board-name: - description: The name of the board - required: true - sdkconfig: + board_id: description: The sdkconfig file to build required: true arch: @@ -19,16 +16,25 @@ runs: submodules: recursive - name: 'Board select' shell: bash - run: cp ${{ inputs.sdkconfig }} sdkconfig + run: cp sdkconfig.board.${{ inputs.board_id }} sdkconfig - name: 'Build' uses: espressif/esp-idf-ci-action@main with: esp_idf_version: v5.3.1 target: ${{ inputs.arch }} path: './' - - name: 'Upload Artifact' + - name: 'Release' + shell: bash + run: Buildscripts/release.sh ${{ inputs.board_id }} + - name: 'Upload Artifact: Release' uses: actions/upload-artifact@v4 with: - name: tactility-${{ inputs.board-name }} - path: build/Tactility.bin + name: tactility-${{ inputs.board_id }} + path: release/Tactility-${{ inputs.board_id }} + retention-days: 5 + - name: 'Upload Artifact: Release symbols' + uses: actions/upload-artifact@v4 + with: + name: tactility-${{ inputs.board_id }}-symbols + path: release/Tactility-${{ inputs.board_id }}-symbols retention-days: 5 diff --git a/.github/actions/build-sdk/action.yml b/.github/actions/build-sdk/action.yml new file mode 100644 index 00000000..4a4bc78d --- /dev/null +++ b/.github/actions/build-sdk/action.yml @@ -0,0 +1,34 @@ +name: Build + +inputs: + board_id: + description: The sdkconfig file to build + required: true + arch: + description: The ESP32 SOC variant + required: true + +runs: + using: "composite" + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: 'Board select' + shell: bash + run: cp sdkconfig.board.${{ inputs.board_id }} sdkconfig + - name: 'Build' + uses: espressif/esp-idf-ci-action@main + with: + esp_idf_version: v5.3.1 + target: ${{ inputs.arch }} + path: './' + - name: 'Release' + shell: bash + run: Buildscripts/release-sdk.sh release/TactilitySDK + - name: 'Upload Artifact' + uses: actions/upload-artifact@v4 + with: + name: TactilitySDK-${{ inputs.arch }} + path: release/TactilitySDK + retention-days: 5 diff --git a/.github/workflows/build-firmware.yml b/.github/workflows/build-firmware.yml index 240f0ad8..90697674 100644 --- a/.github/workflows/build-firmware.yml +++ b/.github/workflows/build-firmware.yml @@ -11,8 +11,7 @@ jobs: - name: "Build" uses: ./.github/actions/build-firmware with: - board-name: yellowboard - sdkconfig: sdkconfig.board.yellow_board + board_id: yellow-board arch: esp32 lilygo-tdeck: runs-on: ubuntu-latest @@ -21,8 +20,7 @@ jobs: - name: "Build" uses: ./.github/actions/build-firmware with: - board-name: lilygotdeck - sdkconfig: sdkconfig.board.lilygo_tdeck + board_id: lilygo-tdeck arch: esp32s3 m5stack-core2: runs-on: ubuntu-latest @@ -31,8 +29,7 @@ jobs: - name: "Build" uses: ./.github/actions/build-firmware with: - board-name: m5stackcore2 - sdkconfig: sdkconfig.board.m5stack_core2 + board_id: m5stack-core2 arch: esp32 m5stack-cores3: runs-on: ubuntu-latest @@ -41,6 +38,5 @@ jobs: - name: "Build" uses: ./.github/actions/build-firmware with: - board-name: m5stackcores3 - sdkconfig: sdkconfig.board.m5stack_cores3 + board_id: m5stack-cores3 arch: esp32s3 diff --git a/.github/workflows/build-sdk.yml b/.github/workflows/build-sdk.yml new file mode 100644 index 00000000..6f482bc4 --- /dev/null +++ b/.github/workflows/build-sdk.yml @@ -0,0 +1,24 @@ +name: Build SDK +on: [push] + +permissions: read-all + +jobs: + esp32: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: "Build" + uses: ./.github/actions/build-sdk + with: + board_id: yellow-board + arch: esp32 + esp32s3: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: "Build" + uses: ./.github/actions/build-sdk + with: + board_id: lilygo-tdeck + arch: esp32s3 diff --git a/Buildscripts/build-and-release-all.sh b/Buildscripts/build-and-release-all.sh index 878139b0..a7f257a8 100755 --- a/Buildscripts/build-and-release-all.sh +++ b/Buildscripts/build-and-release-all.sh @@ -14,21 +14,21 @@ function releaseSdk() { SECONDS=0 -build lilygo_tdeck -release lilygo_tdeck +build lilygo-tdeck +release lilygo-tdeck -releaseSdk release/Tactility-ESP32S3-SDK/TactilitySDK +releaseSdk release/TactilitySDK-esp32s3 -build yellow_board -release yellow_board +build yellow-board +release yellow-board -releaseSdk release/Tactility-ESP32-SDK/TactilitySDK +releaseSdk release/TactilitySDK-esp32 -build m5stack_core2 -release m5stack_core2 +build m5stack-core2 +release m5stack-core2 -build m5stack_cores3 -release m5stack_cores3 +build m5stack-cores3 +release m5stack-cores3 duration=$SECONDS diff --git a/Buildscripts/build.sh b/Buildscripts/build.sh index b8d42da5..65f476c7 100755 --- a/Buildscripts/build.sh +++ b/Buildscripts/build.sh @@ -2,7 +2,7 @@ # # Usage: build.sh [boardname] -# Example: build.sh lilygo_tdeck +# Example: build.sh lilygo-tdeck # Description: Makes a clean build for the specified board. # diff --git a/Buildscripts/clean.sh b/Buildscripts/clean.sh index 02e7eae3..5e06c99c 100755 --- a/Buildscripts/clean.sh +++ b/Buildscripts/clean.sh @@ -1,6 +1,5 @@ #!/bin/sh rm -rf build -rm -rf build-sim rm -rf cmake-* diff --git a/Buildscripts/release.sh b/Buildscripts/release.sh index b0a5a581..b9fd1783 100755 --- a/Buildscripts/release.sh +++ b/Buildscripts/release.sh @@ -2,7 +2,7 @@ # # Usage: release.sh [boardname] -# Example: release.sh lilygo_tdeck +# Example: release.sh lilygo-tdeck # Description: Releases the current build labeled as a release for the specified board name. # @@ -40,7 +40,6 @@ release() { } board=$1 -board_clean=${board/_/-} release_path=release if [ $# -lt 1 ]; then @@ -51,5 +50,5 @@ if [ ! -f $sdkconfig_file ]; then fatalError "Board not found: ${sdkconfig_file}" fi -release "${release_path}/Tactility-${board_clean}" -releaseSymbols "${release_path}/Tactility-${board_clean}-symbols" +release "${release_path}/Tactility-${board}" +releaseSymbols "${release_path}/Tactility-${board}-symbols" diff --git a/sdkconfig.board.lilygo_tdeck b/sdkconfig.board.lilygo-tdeck similarity index 100% rename from sdkconfig.board.lilygo_tdeck rename to sdkconfig.board.lilygo-tdeck diff --git a/sdkconfig.board.m5stack_core2 b/sdkconfig.board.m5stack-core2 similarity index 100% rename from sdkconfig.board.m5stack_core2 rename to sdkconfig.board.m5stack-core2 diff --git a/sdkconfig.board.m5stack_cores3 b/sdkconfig.board.m5stack-cores3 similarity index 100% rename from sdkconfig.board.m5stack_cores3 rename to sdkconfig.board.m5stack-cores3 diff --git a/sdkconfig.board.yellow_board b/sdkconfig.board.yellow-board similarity index 100% rename from sdkconfig.board.yellow_board rename to sdkconfig.board.yellow-board