Rewored the thermostat tests #73
This file contains 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 for Host and Target | |
on: | |
push: | |
pull_request: | |
release: | |
types: [created] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up CMake | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: latestrc | |
ninjaVersion: latest | |
- name: Set up dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential | |
- name: Create build directory | |
run: mkdir -p build | |
- name: Configure CMake | |
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DON_TARGET=OFF | |
- name: Build with CMake | |
run: cmake --build build --config Release | |
- name: Run tests | |
working-directory: ${{github.workspace}}/build/test | |
shell: bash | |
run: | | |
ctest --output-on-failure --output-junit ${GITHUB_WORKSPACE}/test-results.xml | |
- name: Archive Test Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: test-results.xml | |
build_target: | |
name: ${{matrix.name}} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
name: Linux | |
cache-key: linux | |
cmake-args: '-DPIMORONI_PICO_PATH=$GITHUB_WORKSPACE/pimoroni-pico -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install' | |
apt-packages: clang-tidy gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib | |
runs-on: ${{matrix.os}} | |
permissions: | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
env: | |
PICO_SDK_PATH: $GITHUB_WORKSPACE/pico-sdk | |
PIMORONI_PICO_LIBS: $GITHUB_WORKSPACE/pimoroni-pico | |
RELEASE_FILE: ${{github.event.repository.name}}-${{github.event.release.tag_name}} | |
COMMIT_FILE: ${{github.event.repository.name}}-${{github.sha}} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
path: project | |
submodules: recursive | |
# Checkout the Pimoroni Pico Libraries | |
- name: Checkout Pimoroni Pico Libraries | |
uses: actions/checkout@v4 | |
with: | |
repository: pimoroni/pimoroni-pico | |
path: pimoroni-pico | |
# Checkout the Pico SDK | |
- name: Checkout Pico SDK | |
uses: actions/checkout@v4 | |
with: | |
repository: raspberrypi/pico-sdk | |
path: pico-sdk | |
submodules: true | |
# Linux deps | |
- name: Install deps | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt update && sudo apt install ${{matrix.apt-packages}} | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: cmake $GITHUB_WORKSPACE/project -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DON_TARGET=ON -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}} | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: | | |
cmake --build . --config $BUILD_TYPE -j 2 | |
- name: Debug Archive | |
working-directory: ${{github.workspace}}/build/src | |
shell: bash | |
run: | | |
ls -la | |
- name: Archive Build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.COMMIT_FILE}} | |
path: build/src/*.uf2 | |
- name: Build Release Packages | |
if: github.event_name == 'release' | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
run: | | |
cmake --build . --config $BUILD_TYPE --target package -j 2 | |
- name: Upload .zip | |
if: github.event_name == 'release' | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{github.workspace}}/build/${{env.RELEASE_FILE}}.zip | |
name: ${{env.RELEASE_FILE}}.zip | |
- name: Upload .tar.gz | |
if: github.event_name == 'release' | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{github.workspace}}/build/${{env.RELEASE_FILE}}.tar.gz | |
name: ${{env.RELEASE_FILE}}.tar.gz | |