Skip to content

build: use CPM for dependencies #1142

build: use CPM for dependencies

build: use CPM for dependencies #1142

Workflow file for this run

---
name: Build & Test
on:
push:
branches: [main]
tags:
- v**
merge_group:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
GTEST_COLOR: 1
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CPM_SOURCE_CACHE: ${{ github.workspace }}/.cpm
jobs:
build-in-devcontainer:
name: Devcontainer Build
runs-on: [ubuntu-latest]
container: ghcr.io/philips-software/amp-devcontainer-cpp:7.2.0@sha256:1afa82f415104fd36c8af65740872fd01685275c2e1620f8133c35b3fbff0590
strategy:
matrix:
target: [Host, Windows]
fail-fast: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- if: ${{ matrix.target == 'Windows' }}
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache-winsdk
with:
path: /winsdk
key: cache-winsdk-10.0.26100-14.43.17.13
- if: ${{ matrix.target == 'Windows' && steps.cache-winsdk.outputs.cache-hit != 'true' }}
run: ./get-winsdk.sh
- if: ${{ matrix.target == 'Windows' && steps.cache-winsdk.outputs.cache-hit != 'true' && github.event_name != 'pull_request' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: /winsdk
key: cache-winsdk-10.0.26100-14.43.17.13
- name: Restore CPM packages cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.CPM_SOURCE_CACHE }}
key: cpm-${{ hashFiles('cmake/dependencies.cpm.cmake', 'cmake/package-lock.cmake') }}
- uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
if: ${{ !startsWith(matrix.target, 'Windows') }}
with:
key: ${{ github.job }}-${{ matrix.target }}
max-size: 2G
save: ${{ !startsWith(github.ref, 'refs/tags/') }}
- uses: lukka/run-cmake@5d55ea7949e25f69f0ecb516d8d572297e03a956 # v10.9
with:
configurePreset: "${{ matrix.target}}"
buildPreset: "${{ matrix.target}}-Release"
- name: Save CPM packages cache
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.CPM_SOURCE_CACHE }}
key: cpm-${{ hashFiles('cmake/dependencies.cpm.cmake', 'cmake/package-lock.cmake') }}
test-linux:
name: Acceptance Test on Linux
runs-on: [ubuntu-latest]
permissions:
contents: read
issues: read
checks: write
pull-requests: write
container: ghcr.io/philips-software/amp-devcontainer-cpp:7.2.0@sha256:1afa82f415104fd36c8af65740872fd01685275c2e1620f8133c35b3fbff0590
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Build
uses: ./.github/actions/build
with:
cpm-source-cache: ${{ env.CPM_SOURCE_CACHE }}
use-ccache: ${{ !startsWith(matrix.os, 'windows') }}
ccache-key: ${{ github.job }}-${{ github.ref }}
configure-preset: "Host"
build-preset: "Host-Debug"
- run: |
bats --formatter junit cucumber_cpp/acceptance_test/test.bats | tee test-report.xml
- uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0
if: always()
with:
files: test-report.xml
host_build_test:
name: Host Build & Test
runs-on: ${{ matrix.os }}-${{ matrix.version}}
strategy:
matrix:
os: [macos, windows, ubuntu]
version: [latest]
type: [synchronous]
preset_suffix: ["", "-no-re2"]
fail-fast: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Build and test
uses: ./.github/actions/workflow
with:
cpm-source-cache: ${{ env.CPM_SOURCE_CACHE }}
use-ccache: ${{ !startsWith(matrix.os, 'windows') }}
ccache-key: ccache-${{ github.job }}-${{ matrix.os }}-${{ github.ref }}-${{ matrix.type }}${{ matrix.preset_suffix }}
workflow-preset: "${{ matrix.os }}-Debug-${{ matrix.type }}${{ matrix.preset_suffix }}"
- name: Upload test logs
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-logs
path: .build/${{ matrix.os }}-Debug-${{ matrix.type }}${{ matrix.preset_suffix }}/Testing/Temporary/