From 21ea646f5b3f188f55467f034af1631f3c39c40b Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 21 Aug 2026 20:06:58 -0400 Subject: [PATCH 1/2] add ci --- .github/workflows/stm32-ci.yml | 93 ++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/stm32-ci.yml diff --git a/.github/workflows/stm32-ci.yml b/.github/workflows/stm32-ci.yml new file mode 100644 index 0000000..1c9f5bf --- /dev/null +++ b/.github/workflows/stm32-ci.yml @@ -0,0 +1,93 @@ +name: STM32 Firmware CI/CD + +on: + push: + branches: [ "main" ] # Triggers on push to main + tags: [ "v*" ] # Triggers on version tags (e.g. v1.0.0) + pull_request: + branches: [ "main" ] + workflow_dispatch: # Allows manual trigger from GitHub UI + +jobs: + build: + name: Build STM32 Firmware + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + build_type: [Debug, Release] + + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + with: + submodules: recursive # Automatically pulls HAL, CMSIS, or FreeRTOS submodules + + - name: Set up Arm GNU Toolchain (GCC 13.2.1) + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '13.2.Rel1' # Explicitly uses GCC 13.2.1 + + - name: Install Build Tools + run: | + sudo apt-get update + sudo apt-get install -y cmake ninja-build + + - name: Configure CMake (${{ matrix.build_type }}) + run: | + cmake --preset ${{ matrix.build_type }} + + - name: Build Firmware + run: | + cmake --build build/${{ matrix.build_type }} --preset ${{ matrix.build_type }} --parallel + + - name: Stage Artifacts + run: | + mkdir -p artifacts + # Finds the compiled .elf and renames it cleanly for the artifact upload step + find build/${{ matrix.build_type }} -maxdepth 2 -name "*.elf" -exec cp {} artifacts/firmware-${{ matrix.build_type }}.elf \; + + - name: Upload Build Artifacts (${{ matrix.build_type }}) + uses: actions/upload-artifact@v7 + with: + name: stm32-firmware-${{ matrix.build_type }} + path: artifacts/firmware-${{ matrix.build_type }}.elf + archive: false + if-no-files-found: error + + release: + name: Make Releases + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag') + permissions: + contents: write + + steps: + - name: Download All Artifacts + uses: actions/download-artifact@v8 + with: + path: artifacts + pattern: firmware-* + merge-multiple: true + + - name: Release for Tag + if: github.ref_type == 'tag' + uses: softprops/action-gh-release@v3 + with: + working_directory: artifacts + generate_release_notes: true + files: | + firmware-Debug.elf + firmware-Release.elf + + - name: Release for Latest + if: github.ref == 'refs/heads/main' + uses: softprops/action-gh-release@v3 + with: + working_directory: artifacts + tag_name: latest + files: | + firmware-Debug.elf + firmware-Release.elf \ No newline at end of file From 883fb1d545bca127029e6ec58ffc8cebb3bb8bd3 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 23 Aug 2026 19:08:11 -0400 Subject: [PATCH 2/2] add repo name to artifacts --- .github/workflows/stm32-ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/stm32-ci.yml b/.github/workflows/stm32-ci.yml index 1c9f5bf..5268271 100644 --- a/.github/workflows/stm32-ci.yml +++ b/.github/workflows/stm32-ci.yml @@ -46,13 +46,13 @@ jobs: run: | mkdir -p artifacts # Finds the compiled .elf and renames it cleanly for the artifact upload step - find build/${{ matrix.build_type }} -maxdepth 2 -name "*.elf" -exec cp {} artifacts/firmware-${{ matrix.build_type }}.elf \; + find build/${{ matrix.build_type }} -maxdepth 2 -name "*.elf" -exec cp {} artifacts/${{ github.event.repository.name }}-firmware-${{ matrix.build_type }}.elf \; - name: Upload Build Artifacts (${{ matrix.build_type }}) uses: actions/upload-artifact@v7 with: name: stm32-firmware-${{ matrix.build_type }} - path: artifacts/firmware-${{ matrix.build_type }}.elf + path: artifacts/${{ github.event.repository.name }}-firmware-${{ matrix.build_type }}.elf archive: false if-no-files-found: error @@ -69,7 +69,7 @@ jobs: uses: actions/download-artifact@v8 with: path: artifacts - pattern: firmware-* + pattern: ${{ github.event.repository.name }}-firmware-* merge-multiple: true - name: Release for Tag @@ -79,8 +79,8 @@ jobs: working_directory: artifacts generate_release_notes: true files: | - firmware-Debug.elf - firmware-Release.elf + ${{ github.event.repository.name }}-firmware-Debug.elf + ${{ github.event.repository.name }}-firmware-Release.elf - name: Release for Latest if: github.ref == 'refs/heads/main' @@ -89,5 +89,5 @@ jobs: working_directory: artifacts tag_name: latest files: | - firmware-Debug.elf - firmware-Release.elf \ No newline at end of file + ${{ github.event.repository.name }}-firmware-Debug.elf + ${{ github.event.repository.name }}-firmware-Release.elf \ No newline at end of file