[fix]解决 git action的错误 #11
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: Build | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| build-gcc: | |
| name: Build with ARM GCC | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| config: | |
| - name: "Default (All OFF)" | |
| freertos: "OFF" | |
| lvgl: "OFF" | |
| thorvg: "OFF" | |
| - name: "FreeRTOS ON" | |
| freertos: "ON" | |
| lvgl: "OFF" | |
| thorvg: "OFF" | |
| - name: "LVGL ON" | |
| freertos: "OFF" | |
| lvgl: "ON" | |
| thorvg: "OFF" | |
| - name: "LVGL + ThorVG ON" | |
| freertos: "OFF" | |
| lvgl: "ON" | |
| thorvg: "ON" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ninja-build | |
| - name: Install ARM GCC Toolchain | |
| run: | | |
| sudo apt-get install -y gcc-arm-none-eabi | |
| - name: Verify toolchain installation | |
| run: | | |
| arm-none-eabi-gcc --version | |
| ninja --version | |
| cmake --version | |
| - name: Build with GCC - ${{ matrix.config.name }} | |
| run: | | |
| cmake -B build -G Ninja \ | |
| -DCMAKE_TOOLCHAIN_FILE="cmake/gcc-arm-none-eabi.cmake" \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DLINKER_SCRIPT="L1_MCU/STM32F429ZIT6_GCC/STM32F429XX_FLASH.ld" \ | |
| -DMCU_MODEL="STM32F429ZIT6_GCC" \ | |
| -DUSE_FREERTOS=${{ matrix.config.freertos }} \ | |
| -DUSE_FATFS=OFF \ | |
| -DUSE_LVGL=${{ matrix.config.lvgl }} \ | |
| -DUSE_LVGL_THORVG=${{ matrix.config.thorvg }} | |
| ninja -C build | |
| build-gcc-windows: | |
| name: Build with ARM GCC (Windows) | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| config: | |
| - name: "Default (All OFF)" | |
| freertos: "OFF" | |
| lvgl: "OFF" | |
| thorvg: "OFF" | |
| - name: "FreeRTOS ON" | |
| freertos: "ON" | |
| lvgl: "OFF" | |
| thorvg: "OFF" | |
| - name: "LVGL ON" | |
| freertos: "OFF" | |
| lvgl: "ON" | |
| thorvg: "OFF" | |
| - name: "LVGL + ThorVG ON" | |
| freertos: "OFF" | |
| lvgl: "ON" | |
| thorvg: "ON" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Install ARM GCC Toolchain | |
| shell: pwsh | |
| run: | | |
| # 下载并解压ARM GCC工具链 | |
| $url = "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-win32.zip" | |
| $output = "gcc-arm-none-eabi.zip" | |
| Invoke-WebRequest -Uri $url -OutFile $output | |
| Expand-Archive -Path $output -DestinationPath "C:\gcc-arm" | |
| # 添加到PATH | |
| $env:Path = "C:\gcc-arm\gcc-arm-none-eabi-10.3-2021.10\bin;" + $env:Path | |
| echo "C:\gcc-arm\gcc-arm-none-eabi-10.3-2021.10\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Verify toolchain installation | |
| shell: pwsh | |
| run: | | |
| arm-none-eabi-gcc --version | |
| ninja --version | |
| cmake --version | |
| - name: Build with GCC - ${{ matrix.config.name }} | |
| shell: pwsh | |
| run: | | |
| cmake -B build -G Ninja ` | |
| -DCMAKE_TOOLCHAIN_FILE="cmake/gcc-arm-none-eabi.cmake" ` | |
| -DCMAKE_BUILD_TYPE=Debug ` | |
| -DLINKER_SCRIPT="L1_MCU/STM32F429ZIT6_GCC/STM32F429XX_FLASH.ld" ` | |
| -DMCU_MODEL="STM32F429ZIT6_GCC" ` | |
| -DUSE_FREERTOS=${{ matrix.config.freertos }} ` | |
| -DUSE_FATFS=OFF ` | |
| -DUSE_LVGL=${{ matrix.config.lvgl }} ` | |
| -DUSE_LVGL_THORVG=${{ matrix.config.thorvg }} | |
| ninja -C build | |
| test: | |
| name: Run Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ninja-build gcc-multilib g++-multilib | |
| - name: Verify tools installation | |
| run: | | |
| ninja --version | |
| cmake --version | |
| gcc --version | |
| - name: Run tests | |
| run: | | |
| cd Test | |
| cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_FLAGS="-m32" \ | |
| -DCMAKE_CXX_FLAGS="-m32" | |
| cmake --build build --config Debug | |
| # 运行测试可执行文件 | |
| if [ -f "build/test" ]; then | |
| echo "Running test executable..." | |
| ./build/test | |
| else | |
| echo "Error: Test executable not found at build/test" | |
| ls -la build/ | |
| exit 1 | |
| fi | |
| test-windows: | |
| name: Run Unit Tests (Windows) | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Verify tools installation | |
| shell: pwsh | |
| run: | | |
| ninja --version | |
| cmake --version | |
| - name: Run tests | |
| shell: pwsh | |
| run: | | |
| cd Test | |
| cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug | |
| cmake --build build --config Debug | |
| # 运行测试可执行文件 | |
| if (Test-Path "build/test.exe") { | |
| Write-Host "Running test executable..." | |
| & .\build\test.exe | |
| } else { | |
| Write-Error "Test executable not found at build/test.exe" | |
| Get-ChildItem build | Select-Object Name, Length | |
| exit 1 | |
| } |