Skip to content

Commit

Permalink
Add cache for build artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
shamitha-shashidhara committed Nov 22, 2024
1 parent bf66fdc commit c00c716
Showing 1 changed file with 40 additions and 23 deletions.
63 changes: 40 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
name: CMake on a single platform
name: Build S32k and posix platform

on: [push, pull_request]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
run-command:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [posix, s32k148]

steps:
- uses: actions/checkout@v4
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.22.x'
- name: Configure CMake
run: cmake -B cmake-build-posix -S executables/referenceApp -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build cmake-build-posix --target app.referenceApp -j --config ${{env.BUILD_TYPE}}

- name: Test
# Execute tests defined by the CMake configuration.
run: |
cmake -B cmake-build-unit-tests -S executables/unitTest -DBUILD_UNIT_TESTS=ON
cmake --build cmake-build-unit-tests -j4
ctest --test-dir cmake-build-unit-tests -j4
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache CMake files
id: cache-cmake
uses: actions/cache@v3
with:
path: |
cmake-build-posix
cmake-build-s32k148
key: ${{ runner.os }}-cmake-${{ matrix.platform }}-${{ hashFiles('**/*.cpp', '**/*.h', '**/*.cmake', '**/*.txt', '**/*.c', '**/*.s', 'admin/cmake/ArmNoneEabi.cmake') }}
restore-keys: |
${{ runner.os }}-cmake-${{ matrix.platform }}-
- name: Set up CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.22.x'

- name: Set up ARM GCC
if: ${{ matrix.platform == 's32k148' }}
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '10.3-2021.10'

- name: Configure CMake for POSIX
if: ${{ matrix.platform == 'posix' && steps.cache-cmake.outputs.cache-hit != 'true' }}
run: cmake -B cmake-build-posix -S executables/referenceApp

- name: Configure CMake for S32K148
if: ${{ matrix.platform == 's32k148' && steps.cache-cmake.outputs.cache-hit != 'true' }}
run: cmake -B cmake-build-s32k148 -S executables/referenceApp -DBUILD_TARGET_PLATFORM="S32K148EVB" --toolchain ../../admin/cmake/ArmNoneEabi.cmake

- name: Build for ${{ matrix.platform }}
if: steps.cache-cmake.outputs.cache-hit != 'true'
run: cmake --build cmake-build-${{ matrix.platform }} --target app.referenceApp -j

0 comments on commit c00c716

Please sign in to comment.