fix bms init #180
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Latest Release | |
| on: | |
| push: | |
| branches: [main] | |
| # Prevent concurrent releases from overlapping | |
| concurrency: | |
| group: latest-release | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project: [BMS, PCU, DASH, LVPDB, DART, DCU, DCU_Receiver, Sensor_Nodes_FRONT, Sensor_Nodes_REAR, UART, UART_TEST] | |
| name: Build ${{ matrix.project }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Resolve source dir | |
| id: resolve | |
| run: | | |
| case "${{ matrix.project }}" in | |
| Sensor_Nodes_FRONT|Sensor_Nodes_REAR) | |
| echo "src_dir=Sensor_Nodes" >> "$GITHUB_OUTPUT" | |
| ;; | |
| *) | |
| echo "src_dir=${{ matrix.project }}" >> "$GITHUB_OUTPUT" | |
| ;; | |
| esac | |
| - name: Check buildability | |
| id: check | |
| run: | | |
| SRC="${{ steps.resolve.outputs.src_dir }}" | |
| if [ ! -f "${SRC}/CMakeLists.txt" ] || [ ! -d "${SRC}/Core" ]; then | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| echo "::warning::${{ matrix.project }} skipped -- missing ${SRC}/CMakeLists.txt or ${SRC}/Core/." | |
| else | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install ARM GCC Toolchain | |
| if: steps.check.outputs.skip != 'true' | |
| uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
| with: | |
| release: '14.2.Rel1' | |
| - name: Install Ninja | |
| if: steps.check.outputs.skip != 'true' | |
| run: sudo apt-get install -y ninja-build | |
| - name: Configure CMake | |
| if: steps.check.outputs.skip != 'true' | |
| run: > | |
| cmake -S . -B build/${{ matrix.project }} | |
| -G Ninja | |
| -DCMAKE_BUILD_TYPE=Release | |
| -DCMAKE_TOOLCHAIN_FILE=cmake/gcc-arm-none-eabi.cmake | |
| - name: Build | |
| if: steps.check.outputs.skip != 'true' | |
| run: cmake --build build/${{ matrix.project }} --target ${{ matrix.project }} | |
| - name: Rename artifacts with commit SHA | |
| if: steps.check.outputs.skip != 'true' | |
| run: | | |
| SHORT_SHA="${GITHUB_SHA:0:7}" | |
| TIMESTAMP=$(TZ=America/Los_Angeles date +"%m-%d-%Y_%H-%M-%S") | |
| BUILD_DIR="build/${{ matrix.project }}/${{ steps.resolve.outputs.src_dir }}" | |
| cp "${BUILD_DIR}/${{ matrix.project }}.elf" "${BUILD_DIR}/${{ matrix.project }}-latest-${TIMESTAMP}-${SHORT_SHA}.elf" | |
| cp "${BUILD_DIR}/${{ matrix.project }}.bin" "${BUILD_DIR}/${{ matrix.project }}-latest-${TIMESTAMP}-${SHORT_SHA}.bin" | |
| cp "${BUILD_DIR}/${{ matrix.project }}.hex" "${BUILD_DIR}/${{ matrix.project }}-latest-${TIMESTAMP}-${SHORT_SHA}.hex" | |
| - name: Upload release artifacts | |
| if: steps.check.outputs.skip != 'true' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.project }}-latest | |
| path: | | |
| build/${{ matrix.project }}/${{ steps.resolve.outputs.src_dir }}/${{ matrix.project }}-latest-*.elf | |
| build/${{ matrix.project }}/${{ steps.resolve.outputs.src_dir }}/${{ matrix.project }}-latest-*.bin | |
| build/${{ matrix.project }}/${{ steps.resolve.outputs.src_dir }}/${{ matrix.project }}-latest-*.hex | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: release-artifacts | |
| - name: Organize artifacts by board | |
| run: | | |
| mkdir -p release-package | |
| for board in BMS PCU DASH LVPDB DART DCU DCU_Receiver Sensor_Nodes_FRONT Sensor_Nodes_REAR UART UART_TEST; do | |
| mkdir -p "release-package/$board" | |
| find release-artifacts -name "$board-*" -type f \( -name "*.elf" -o -name "*.bin" -o -name "*.hex" \) -exec cp {} "release-package/$board/" \; 2>/dev/null || true | |
| done | |
| cp scripts/flash.sh release-package/ | |
| chmod +x release-package/flash.sh | |
| echo "=== Release package structure ===" | |
| find release-package -type f | sort | |
| - name: Create README.txt | |
| run: | | |
| cat > release-package/README.txt << 'EOF' | |
| FEB Firmware Release | |
| ==================== | |
| Quick Start: | |
| 1. Extract this zip | |
| 2. Make flash.sh executable: chmod +x flash.sh | |
| 3. Run: ./flash.sh | |
| 4. Select the board you want to flash from the menu | |
| Manual Flashing: | |
| ./flash.sh -f BMS/BMS-latest-*.elf | |
| Requirements: | |
| - STM32CubeCLT (provides STM32_Programmer_CLI) | |
| - ST-Link or compatible SWD programmer | |
| For more information, visit: | |
| https://github.com/FormulaElectricBerkeley/FEB_FIRMWARE_SN5 | |
| EOF | |
| - name: Generate checksums | |
| run: | | |
| cd release-package | |
| echo "SHA256 Checksums" > SHA256SUMS.txt | |
| echo "================" >> SHA256SUMS.txt | |
| echo "" >> SHA256SUMS.txt | |
| find . -type f \( -name "*.elf" -o -name "*.bin" -o -name "*.hex" \) | sort | while read file; do | |
| sha256sum "$file" >> SHA256SUMS.txt | |
| done | |
| echo "" >> SHA256SUMS.txt | |
| echo "Generated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> SHA256SUMS.txt | |
| cat SHA256SUMS.txt | |
| - name: Create release zip | |
| run: | | |
| cd release-package | |
| zip -r ../FEB_Firmware_latest.zip . | |
| cd .. | |
| # Also generate checksum for the zip itself | |
| sha256sum FEB_Firmware_latest.zip > FEB_Firmware_latest.zip.sha256 | |
| ls -la FEB_Firmware_latest.zip* | |
| - name: Delete existing latest release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release delete latest --yes --cleanup-tag || true | |
| - name: Create latest release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| SHORT_SHA="${GITHUB_SHA:0:7}" | |
| gh release create latest \ | |
| --title "Latest Build (${SHORT_SHA})" \ | |
| --notes "Automated build from commit [\`${SHORT_SHA}\`](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}) | |
| **Branch:** main | |
| **Commit:** ${{ github.sha }} | |
| This is an automated pre-release containing the latest firmware binaries built from the main branch. For stable releases, see the tagged versions. | |
| ### Quick Start | |
| 1. Download \`FEB_Firmware_latest.zip\` | |
| 2. Extract the zip | |
| 3. Run: | |
| \`\`\` | |
| chmod +x flash.sh | |
| ./flash.sh | |
| \`\`\` | |
| 4. Select the board you want to flash from the menu | |
| ### Boards Included | |
| - BMS (Battery Management System) | |
| - PCU (Powertrain Control Unit) | |
| - DASH (Dashboard) | |
| - LVPDB (Low Voltage Power Distribution) | |
| - DART | |
| - DCU (Data Control Unit) | |
| - Sensor_Nodes_FRONT (front sensor node variant) | |
| - Sensor_Nodes_REAR (rear sensor node variant) | |
| - UART (UART Communication Board) | |
| - UART_TEST (UART/Console Test Board) | |
| ### Files | |
| Each board includes: | |
| - \`.elf\` - Debug symbols, use with GDB/IDE | |
| - \`.bin\` - Raw binary for flashing | |
| - \`.hex\` - Intel HEX format" \ | |
| --prerelease \ | |
| --target ${{ github.sha }} \ | |
| FEB_Firmware_latest.zip \ | |
| FEB_Firmware_latest.zip.sha256 |