ca13734bf0
Add kernel (Cortex-M0/M3/M4, Tricore, S32K, RISC-V ports), drivers, middleware (CAN stack, diagnostics, safety), applications, board support, build/test tooling, and documentation.
262 lines
8.0 KiB
YAML
262 lines
8.0 KiB
YAML
/**
|
|
* @file build.yml
|
|
* @brief Gitea workflow for building Automotive RTOS
|
|
*/
|
|
|
|
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches: [main, develop]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
PROJECT_NAME: automotive-rtos
|
|
BUILD_DIR: build
|
|
|
|
jobs:
|
|
# Build for STM32F407 Discovery
|
|
build-stm32f407:
|
|
name: Build STM32F407 Discovery
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/automotive-rtos/build-env:latest
|
|
options: --privileged
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Cache build artifacts
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
${{ env.BUILD_DIR }}/stm32f407_discovery
|
|
~/.cache
|
|
key: stm32f407-${{ runner.os }}-${{ hashFiles('**/*.c', '**/*.h', '**/Makefile', '**/CMakeLists.txt') }}
|
|
restore-keys: |
|
|
stm32f407-${{ runner.os }}-
|
|
|
|
- name: Setup build environment
|
|
run: |
|
|
echo "Setting up build environment..."
|
|
export PATH="/opt/arm-gcc/bin:$PATH"
|
|
arm-none-eabi-gcc --version
|
|
cmake --version
|
|
make --version
|
|
|
|
- name: Configure debug build
|
|
run: |
|
|
mkdir -p ${{ env.BUILD_DIR }}/stm32f407_discovery/debug
|
|
cd ${{ env.BUILD_DIR }}/stm32f407_discovery/debug
|
|
cmake ../../.. \
|
|
-DTARGET_BOARD=stm32f407_discovery \
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/toolchain-stm32f407_discovery.cmake \
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
|
|
- name: Build debug
|
|
run: |
|
|
cd ${{ env.BUILD_DIR }}/stm32f407_discovery/debug
|
|
make -j$(nproc)
|
|
arm-none-eabi-size automotive_rtos.elf
|
|
|
|
- name: Configure release build
|
|
run: |
|
|
mkdir -p ${{ env.BUILD_DIR }}/stm32f407_discovery/release
|
|
cd ${{ env.BUILD_DIR }}/stm32f407_discovery/release
|
|
cmake ../../.. \
|
|
-DTARGET_BOARD=stm32f407_discovery \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/toolchain-stm32f407_discovery.cmake \
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
|
|
- name: Build release
|
|
run: |
|
|
cd ${{ env.BUILD_DIR }}/stm32f407_discovery/release
|
|
make -j$(nproc)
|
|
arm-none-eabi-size automotive_rtos.elf
|
|
|
|
- name: Generate artifacts
|
|
run: |
|
|
cd ${{ env.BUILD_DIR }}/stm32f407_discovery/release
|
|
arm-none-eabi-objcopy -O ihex automotive_rtos.elf automotive_rtos.hex
|
|
arm-none-eabi-objcopy -O binary automotive_rtos.elf automotive_rtos.bin
|
|
arm-none-eabi-nm -n automotive_rtos.elf > automotive_rtos.map
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: stm32f407-firmware
|
|
path: |
|
|
${{ env.BUILD_DIR }}/stm32f407_discovery/release/automotive_rtos.elf
|
|
${{ env.BUILD_DIR }}/stm32f407_discovery/release/automotive_rtos.hex
|
|
${{ env.BUILD_DIR }}/stm32f407_discovery/release/automotive_rtos.bin
|
|
${{ env.BUILD_DIR }}/stm32f407_discovery/release/automotive_rtos.map
|
|
|
|
- name: Upload build logs
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: stm32f407-build-logs
|
|
path: |
|
|
${{ env.BUILD_DIR }}/stm32f407_discovery/**/*.log
|
|
${{ env.BUILD_DIR }}/stm32f407_discovery/**/compile_commands.json
|
|
|
|
# Build for NXP S32K144 EVB
|
|
build-s32k144:
|
|
name: Build NXP S32K144 EVB
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/automotive-rtos/build-env:latest
|
|
options: --privileged
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Cache build artifacts
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ env.BUILD_DIR }}/nxp_s32k144_evb
|
|
key: s32k144-${{ runner.os }}-${{ hashFiles('**/*.c', '**/*.h') }}
|
|
|
|
- name: Setup build environment
|
|
run: |
|
|
export PATH="/opt/arm-gcc/bin:$PATH"
|
|
arm-none-eabi-gcc --version
|
|
|
|
- name: Configure build
|
|
run: |
|
|
mkdir -p ${{ env.BUILD_DIR }}/nxp_s32k144_evb/debug
|
|
cd ${{ env.BUILD_DIR }}/nxp_s32k144_evb/debug
|
|
cmake ../../.. \
|
|
-DTARGET_BOARD=nxp_s32k144_evb \
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/toolchain-nxp_s32k144_evb.cmake
|
|
|
|
- name: Build
|
|
run: |
|
|
cd ${{ env.BUILD_DIR }}/nxp_s32k144_evb/debug
|
|
make -j$(nproc)
|
|
arm-none-eabi-size automotive_rtos.elf
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: s32k144-firmware
|
|
path: |
|
|
${{ env.BUILD_DIR }}/nxp_s32k144_evb/debug/automotive_rtos.elf
|
|
${{ env.BUILD_DIR }}/nxp_s32k144_evb/debug/automotive_rtos.hex
|
|
${{ env.BUILD_DIR }}/nxp_s32k144_evb/debug/automotive_rtos.bin
|
|
|
|
# Build for Custom ECU
|
|
build-custom-ecu:
|
|
name: Build Custom ECU
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/automotive-rtos/build-env:latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Setup build environment
|
|
run: |
|
|
export PATH="/opt/arm-gcc/bin:$PATH"
|
|
arm-none-eabi-gcc --version
|
|
|
|
- name: Configure build
|
|
run: |
|
|
mkdir -p ${{ env.BUILD_DIR }}/custom_ecu/release
|
|
cd ${{ env.BUILD_DIR }}/custom_ecu/release
|
|
cmake ../../.. \
|
|
-DTARGET_BOARD=custom_ecu \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=../../../cmake/toolchain-custom_ecu.cmake
|
|
|
|
- name: Build
|
|
run: |
|
|
cd ${{ env.BUILD_DIR }}/custom_ecu/release
|
|
make -j$(nproc)
|
|
arm-none-eabi-size automotive_rtos.elf
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: custom-ecu-firmware
|
|
path: |
|
|
${{ env.BUILD_DIR }}/custom_ecu/release/automotive_rtos.elf
|
|
${{ env.BUILD_DIR }}/custom_ecu/release/automotive_rtos.hex
|
|
${{ env.BUILD_DIR }}/custom_ecu/release/automotive_rtos.bin
|
|
|
|
# Create release
|
|
create-release:
|
|
name: Create Release
|
|
needs: [build-stm32f407, build-s32k144, build-custom-ecu]
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Create release archive
|
|
run: |
|
|
cd artifacts
|
|
tar -czf ../automotive-rtos-release.tar.gz .
|
|
sha256sum ../automotive-rtos-release.tar.gz > ../automotive-rtos-release.sha256
|
|
|
|
- name: Create GitHub Release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: Release ${{ github.ref }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload release assets
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./automotive-rtos-release.tar.gz
|
|
asset_name: automotive-rtos-release.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
# Notify on failure
|
|
notify-failure:
|
|
name: Notify on Failure
|
|
needs: [build-stm32f407, build-s32k144, build-custom-ecu]
|
|
if: failure()
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Send notification
|
|
run: |
|
|
echo "Build failed!"
|
|
echo "Branch: ${{ github.ref }}"
|
|
echo "Commit: ${{ github.sha }}"
|
|
echo "Author: ${{ github.actor }}"
|
|
|
|
# Send email notification
|
|
if [ -n "${{ secrets.NOTIFICATION_EMAIL }}" ]; then
|
|
echo "Sending email notification..."
|
|
fi
|