Skip to content

Commit ac25218

Browse files
committed
feat: add GitHub Actions workflow for build and test on pull request target
1 parent 5eea664 commit ac25218

File tree

1 file changed

+146
-0
lines changed

1 file changed

+146
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
name: Build & Test on pull request target
3+
4+
on:
5+
push:
6+
branches: [main]
7+
tags:
8+
- v**
9+
merge_group:
10+
pull_request_target:
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: ${{ github.ref }}-${{ github.workflow }}
18+
cancel-in-progress: true
19+
20+
env:
21+
GTEST_COLOR: 1
22+
23+
jobs:
24+
build-windows:
25+
name: Windows Host Build
26+
runs-on: [ubuntu-latest]
27+
container: ghcr.io/philips-software/amp-devcontainer-cpp:5.6.2@sha256:a0804f7454d52564f07317f7e09a012261b6d9553dbe8854fcf265dce571cf86 # v5.6.2
28+
steps:
29+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
31+
id: cache-winsdk
32+
with:
33+
path: /winsdk
34+
key: cache-winsdk-10.0.26100-14.43.17.13
35+
- if: ${{ steps.cache-winsdk.outputs.cache-hit != 'true' }}
36+
run: ./get-winsdk.sh
37+
- uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
38+
with:
39+
key: ${{ github.job }}
40+
max-size: 2G
41+
- uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
42+
with:
43+
configurePreset: "Windows"
44+
buildPreset: "Windows-Release"
45+
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
46+
47+
build-linux:
48+
name: Linux Host Build
49+
runs-on: [ubuntu-24.04]
50+
steps:
51+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
52+
- uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
53+
with:
54+
key: ${{ github.job }}
55+
max-size: 2G
56+
- uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6
57+
- uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
58+
with:
59+
configurePreset: "Host"
60+
buildPreset: "Host-Release"
61+
testPreset: "Host-Release"
62+
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
63+
- name: Upload test logs
64+
if: ${{ failure() }}
65+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
66+
with:
67+
name: test-logs
68+
path: build/Host/Testing/Temporary/
69+
70+
build-linux-devcontainer:
71+
name: Linux Host Build in Devcontainer
72+
runs-on: [ubuntu-latest]
73+
container: ghcr.io/philips-software/amp-devcontainer-cpp:5.6.2@sha256:a0804f7454d52564f07317f7e09a012261b6d9553dbe8854fcf265dce571cf86 # v5.6.2
74+
steps:
75+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76+
- uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
77+
with:
78+
key: ${{ github.job }}
79+
max-size: 2G
80+
- uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
81+
with:
82+
configurePreset: "Host"
83+
buildPreset: "Host-Release"
84+
testPreset: "Host-Release"
85+
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
86+
- name: Upload test logs
87+
if: ${{ failure() }}
88+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
89+
with:
90+
name: test-logs
91+
path: build/Host/Testing/Temporary/
92+
93+
test-linux:
94+
name: Linux Host Test
95+
runs-on: [ubuntu-latest]
96+
permissions:
97+
contents: read
98+
issues: read
99+
checks: write
100+
pull-requests: write
101+
container: ghcr.io/philips-software/amp-devcontainer-cpp:5.6.2@sha256:a0804f7454d52564f07317f7e09a012261b6d9553dbe8854fcf265dce571cf86 # v5.6.2
102+
steps:
103+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
104+
- uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
105+
with:
106+
key: ${{ github.job }}
107+
max-size: 2G
108+
- uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
109+
with:
110+
configurePreset: "Host"
111+
buildPreset: "Host-Debug"
112+
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
113+
- run: |
114+
bats --formatter junit cucumber_cpp/acceptance_test/test.bats | tee test-report.xml
115+
- uses: EnricoMi/publish-unit-test-result-action@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6 # v2.20.0
116+
if: always()
117+
with:
118+
files: test-report.xml
119+
120+
host_build_test:
121+
name: Host Build & Test
122+
runs-on: ${{ matrix.os }}
123+
strategy:
124+
matrix:
125+
os: [macos-latest, windows-latest]
126+
steps:
127+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
128+
with:
129+
persist-credentials: false
130+
- uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
131+
with:
132+
key: ${{ github.job }}-${{ matrix.os }}
133+
max-size: 2G
134+
variant: sccache
135+
- uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
136+
with:
137+
configurePreset: "host-single-Debug"
138+
buildPreset: "host-single-Debug"
139+
testPreset: "host-single-Debug"
140+
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache']"
141+
- name: Upload test logs
142+
if: ${{ failure() }}
143+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
144+
with:
145+
name: test-logs
146+
path: build/host-single-Dbebug/Testing/Temporary/

0 commit comments

Comments
 (0)