Skip to content

Commit

Permalink
Refactor workflows to check if code compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaralo committed Jan 18, 2025
1 parent 6d5eb91 commit 2a12efb
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 389 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Project

on:
workflow_call:
inputs:
preset:
description: |
'CMake preset to build the project, run `cmake --build --list-presets' to see a complete list of options'
required: true
type: string
default: 'nucleo-debug'
outputs:
build-artifact:
description: 'Build result artifact id for later use'
value: ${{ jobs.build.outputs.build-artifact }}
workflow_dispatch:
inputs:
preset:
description: |
'CMake preset to build the project, run `cmake --build --list-presets' to see a complete list of options'
required: true
type: string
default: 'nucleo-debug'

jobs:
build:
name: Build Project
runs-on: ubuntu-24.04
outputs:
build-artifact: ${{ steps.upload-build-artifact.outputs.artifact-id }}
container:
image: jmaralo/hyperloop-upv-firmware:0.3.0
steps:
- name: Clone Project
uses: actions/checkout@v3
- name: Prepare submodules
run: |
git submodule init |
git submodule update
- name: Build
run: |
cmake --preset ${{ inputs.preset }} .
cmake --build --preset ${{ inputs.preset }}
- name: Upload Build
id: upload-build-artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.preset }}
path: out/build/latest.elf
retention-days: 7
compression-level: 0
if-no-files-found: error

34 changes: 0 additions & 34 deletions .github/workflows/c-cpp.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/compile-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Compile Checks

on:
push:

jobs:
compile-checks:
name: Check project compiles
runs-on: ubuntu-24.04
strategy:
matrix:
preset:
- nucleo-debug
- nucleo-release
- nucleo-relwithdebinfo
- nucleo-debug-eth
- nucleo-release-eth
- nucleo-relwithdebinfo-eth
- board-debug
- board-release
- board-relwithdebinfo
- board-debug-eth
- board-release-eth
- board-relwithdebinfo-eth
- simulator
steps:
- name: Build
uses: ./.github/workflows/build.yml
with:
preset: ${{ matrix.preset }}
71 changes: 69 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "mcu",
"hidden": true,
"generator": "Unix Makefiles",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"toolchainFile": "${sourceDir}/toolchains/stm32.cmake",
"installDir": "${sourceDir}/out/install/${presetName}",
Expand All @@ -16,7 +16,7 @@
{
"name": "sim",
"hidden": true,
"generator": "Unix Makefiles",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
Expand Down Expand Up @@ -165,5 +165,72 @@
"CMAKE_BUILD_TYPE": "Debug"
}
}
],
"buildPresets": [
{
"name": "nucleo-debug",
"displayName": "Nucleo [DBG]",
"configurePreset": "nucleo-debug"
},
{
"name": "nucleo-release",
"displayName": "Nucleo [REL]",
"configurePreset": "nucleo-release"
},
{
"name": "nucleo-relwithdebinfo",
"displayName": "Nucleo [RWD]",
"configurePreset": "nucleo-relwithdebinfo"
},
{
"name": "nucleo-debug-eth",
"displayName": "Nucleo [DBG] [ETH]",
"configurePreset": "nucleo-debug-eth"
},
{
"name": "nucleo-release-eth",
"displayName": "Nucleo [REL] [ETH]",
"configurePreset": "nucleo-release-eth"
},
{
"name": "nucleo-relwithdebinfo-eth",
"displayName": "Nucleo [RWD] [ETH]",
"configurePreset": "nucleo-relwithdebinfo-eth"
},
{
"name": "board-debug",
"displayName": "Board [DBG]",
"configurePreset": "board-debug"
},
{
"name": "board-release",
"displayName": "Board [REL]",
"configurePreset": "board-release"
},
{
"name": "board-relwithdebinfo",
"displayName": "Board [RWD]",
"configurePreset": "board-relwithdebinfo"
},
{
"name": "board-debug-eth",
"displayName": "Board [DBG] [ETH]",
"configurePreset": "board-debug-eth"
},
{
"name": "board-release-eth",
"displayName": "Board [REL] [ETH]",
"configurePreset": "board-release-eth"
},
{
"name": "board-relwithdebinfo-eth",
"displayName": "Board [RWD] [ETH]",
"configurePreset": "board-relwithdebinfo-eth"
},
{
"name": "simulator",
"displayName": "Simulator",
"configurePreset": "simulator"
}
]
}
2 changes: 1 addition & 1 deletion deps/ST-LIB
Submodule ST-LIB updated 65 files
+12 −1 .devcontainer/Dockerfile
+14 −9 .devcontainer/devcontainer.json
+24 −20 .github/workflows/c-cpp.yml
+2 −1 .vscode/settings.json
+22 −11 CMakeLists.txt
+1 −0 Inc/HALAL/HALAL.hpp
+41 −17 Inc/HALALMock/Models/PinModel/Pin.hpp
+4 −12 Inc/HALALMock/Services/ADC/ADC.hpp
+0 −7 Inc/HALALMock/Services/Communication/Ethernet/Ethernet.hpp
+22 −29 Inc/HALALMock/Services/Communication/Ethernet/TCP/ServerSocket.hpp
+11 −23 Inc/HALALMock/Services/Communication/Ethernet/TCP/Socket.hpp
+47 −49 Inc/HALALMock/Services/Communication/Ethernet/UDP/DatagramSocket.hpp
+8 −10 Inc/HALALMock/Services/Communication/FDCAN/FDCAN.hpp
+169 −140 Inc/HALALMock/Services/Communication/SPI/SPI.hpp
+14 −1 Inc/HALALMock/Services/EXTI/EXTI.hpp
+1 −1 Inc/HALALMock/Services/InputCapture/InputCapture.hpp
+146 −0 Inc/HALALMock/Services/Logger/Logger.hpp
+5 −1 Inc/HALALMock/Services/PWM/DualPWM/DualPWM.hpp
+16 −1 Inc/HALALMock/Services/PWM/PWM/PWM.hpp
+1 −0 Inc/HALALMock/Services/SharedMemory/SharedMemory.hpp
+0 −42 Inc/HALALMock/Tests/Time/test_time.hpp
+1 −0 Inc/ST-LIB_LOW/ErrorHandler/ErrorHandler.hpp
+2 −0 Inc/ST-LIB_LOW/Sensors/PWMSensor/PWMSensor.hpp
+1 −0 Inc/ST-LIB_LOW/Sensors/Sensor/Sensor.hpp
+4 −0 Inc/ST-LIB_LOW/StateMachine/StateMachine.hpp
+3 −2 README.md
+0 −1 Src/HALAL/HALAL.cpp
+1 −1 Src/HALAL/Services/Encoder/Encoder.cpp
+3 −2 Src/HALAL/Services/InputCapture/InputCapture.cpp
+11 −35 Src/HALALMock/Models/IPV4/IPV4.cpp
+30 −18 Src/HALALMock/Services/ADC/ADC.cpp
+1 −6 Src/HALALMock/Services/Communication/Ethernet/Ethernet.cpp
+139 −145 Src/HALALMock/Services/Communication/Ethernet/TCP/ServerSocket.cpp
+99 −134 Src/HALALMock/Services/Communication/Ethernet/TCP/Socket.cpp
+20 −10 Src/HALALMock/Services/Communication/Ethernet/UDP/DatagramSocket.cpp
+5 −5 Src/HALALMock/Services/Communication/FDCAN/FDCAN.cpp
+346 −113 Src/HALALMock/Services/Communication/SPI/SPI.cpp
+6 −0 Src/HALALMock/Services/DigitalInputService/DigitalInputService.cpp
+6 −0 Src/HALALMock/Services/DigitalOutputService/DigitalOutputService.cpp
+60 −14 Src/HALALMock/Services/EXTI/EXTI.cpp
+4 −1 Src/HALALMock/Services/Encoder/Encoder.cpp
+11 −6 Src/HALALMock/Services/InputCapture/InputCapture.cpp
+70 −0 Src/HALALMock/Services/Logger/Logger.cpp
+36 −8 Src/HALALMock/Services/PWM/DualPWM/DualPWM.cpp
+9 −8 Src/HALALMock/Services/PWM/PWM/PWM.cpp
+27 −13 Src/HALALMock/Services/SharedMemory/SharedMemory.cpp
+4 −0 Src/ST-LIB_LOW/ErrorHandler/ErrorHandler.cpp
+5 −0 Src/ST-LIB_LOW/Sensors/Sensor/Sensor.cpp
+6 −0 Src/ST-LIB_LOW/StateMachine/StateMachine.cpp
+136 −0 Tests/ADCTest.cpp
+13 −2 Tests/CMakeLists.txt
+134 −0 Tests/DigitalInTest.cpp
+138 −5 Tests/DigitalOutTest.cpp
+554 −0 Tests/DualPWMTest.cpp
+182 −0 Tests/EXTITest.cpp
+132 −0 Tests/EncoderTest.cpp
+0 −7 Tests/HelloTests.cpp
+144 −0 Tests/InputCaptureTest.cpp
+321 −0 Tests/PWMTest.cpp
+125 −2 Tests/Runes/SimRunes.cpp
+4 −5 Tests/Time/find_max_simulation_speed_example.cpp
+114 −0 Tests/Time/test_time.cpp
+21 −0 tools/build.sh
+4 −0 tools/run_sim_tests.sh
+18 −0 tools/tar_tests.sh
140 changes: 0 additions & 140 deletions tools/build.py

This file was deleted.

Loading

0 comments on commit 2a12efb

Please sign in to comment.