-
Notifications
You must be signed in to change notification settings - Fork 8
145 lines (137 loc) · 4.62 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: 'Build [CMake] 🛠️'
on:
workflow_dispatch:
inputs:
build-types:
required: true
# Note the string here contains a JSON array. This is later converted to an array using fromJson.
default: "[ 'Debug' ]"
type: string
description: 'The CMake build types (CMAKE_BUILD_TYPE) to run (must be encoded as a JSON array)'
analyze-codeql:
required: true
default: true
type: boolean
description: 'Peform static analysis with CodeQL'
build-arm64:
required: false
default: false
type: boolean
description: 'Build ARM64 architecture'
install:
required: true
default: false
type: boolean
description: 'Invoke CMake install for the project'
test:
required: false
default: false
type: boolean
description: 'Invoke CMake CTest for the project'
package:
required: true
default: false
type: boolean
description: 'Invoke CMake CPack for the project'
publish-artifacts:
required: true
default: false
type: boolean
description: 'Publish build artifacts'
preset-name:
required: false
type: string
default: 'dev'
description: 'The name of the CMake preset to use for all CMake operations (configure, build, test, install, package). Must be ''dev'', ''release'', or ''cicd''.'
workflow_call:
inputs:
build-types:
required: false
# Note the string here contains a JSON array. This is later converted to an array using fromJson.
default: "[ 'Debug' ]"
type: string
description: 'The CMake build type (CMAKE_BUILD_TYPE) to run.'
analyze-codeql:
required: false
default: true
type: boolean
description: 'Peform static analysis with CodeQL'
build-arm64:
required: false
default: false
type: boolean
description: 'Build ARM64 architecture'
install:
required: false
default: false
type: boolean
description: 'Invoke CMake install for the project'
test:
required: false
default: true
type: boolean
description: 'Invoke CMake CTest for the project'
package:
required: false
default: false
type: boolean
description: 'Invoke CMake CPack for the project'
publish-artifacts:
required: false
default: false
type: boolean
description: 'Publish build artifacts'
preset-name:
required: false
type: string
default: 'dev'
description: 'The name of the CMake preset to use for all CMake operations (configure, build, test, install, package). Must be ''dev'', ''release'', or ''cicd''.'
jobs:
build:
name: cmake build
permissions:
contents: read
actions: read
security-events: write
strategy:
fail-fast: false
matrix:
config:
- { os: windows-2022, os-name: 'windows' }
- { os: windows-2022, os-name: 'windows', arch: 'ARM64' }
- { os: ubuntu-24.04, os-name: 'linux' }
build-type: ${{ fromJson(inputs.build-types) }}
runs-on: ${{ matrix.config.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
if: inputs.analyze-codeql == true
uses: github/codeql-action/init@v3
with:
languages: 'cpp'
- name: Build Windows
if: ${{ contains(matrix.config.os-name, 'windows') }}
uses: ./.github/actions/build-with-host
with:
os: ${{ matrix.config.os-name }}
build-type: ${{ matrix.build-type }}
install: ${{ inputs.install }}
test: ${{ inputs.test }}
package: ${{ inputs.package }}
publish-artifacts: ${{ inputs.publish-artifacts }}
preset-name: ${{ inputs.preset-name }}
- name: Build Linux
if: ${{ contains(matrix.config.os-name, 'linux') }}
uses: ./.github/actions/build-with-host
with:
os: ${{ matrix.config.os-name }}
build-type: ${{ matrix.build-type }}
install: ${{ inputs.install }}
test: ${{ inputs.test }}
package: ${{ inputs.package }}
publish-artifacts: ${{ inputs.publish-artifacts }}
preset-name: ${{ inputs.preset-name }}
- name: Perform CodeQL Analysis
if: inputs.analyze-codeql == true
uses: github/codeql-action/analyze@v3