Repository navigation
411 lines (368 loc) · 16.8 KB
/
Copy pathconan-packages.yml
File metadata and controls
411 lines (368 loc) · 16.8 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
name: conan packages
on:
workflow_dispatch:
inputs:
conan_major_version:
description: 'Conan major version to build'
required: true
default: '1'
type: choice
options:
- '1'
- '2'
publish_dry_run:
description: 'Validate publish workflow without uploading packages'
required: true
default: true
type: boolean
schedule:
- cron: '25 6 * * 4' # 6:25am UTC every Thursday
- cron: '25 8 * * 4' # 8:25am UTC every Thursday, Conan 2
env:
conan1_version: 1.66.0
conan2_version: '>=2,<3'
# Pin the macOS/iOS toolchain so published binaries (and their LTO bitcode)
# stay linkable by downstream consumers instead of drifting with the runner
# image's default Xcode. Must match a version installed on the runner.
xcode_version: '16.4'
jobs:
generate-matrix:
name: generate build matrix
runs-on: ubuntu-latest
outputs:
matrix-json: ${{ steps.generate-matrix.outputs.matrix }}
conan_major_version: ${{ steps.select-conan-version.outputs.conan_major_version }}
steps:
- name: Select Conan version
id: select-conan-version
shell: pwsh
run: |
$ConanMajorVersion = '${{ inputs.conan_major_version }}'
if ([string]::IsNullOrWhiteSpace($ConanMajorVersion)) {
if ('${{ github.event_name }}' -eq 'schedule' -and '${{ github.event.schedule }}' -eq '25 8 * * 4') {
$ConanMajorVersion = '2'
} else {
$ConanMajorVersion = '1'
}
}
echo "conan_major_version=$ConanMajorVersion" >> $Env:GITHUB_OUTPUT
- name: create build matrix
id: generate-matrix
shell: pwsh
env:
CONAN_MAJOR_VERSION: ${{ steps.select-conan-version.outputs.conan_major_version }}
run: |
$Jobs = @()
if ($Env:CONAN_MAJOR_VERSION -eq '2') {
@('windows', 'macos', 'linux', 'ios', 'iossimulator', 'android') | Foreach-Object {
$Platform = $_
$Architectures = if ($Platform -Eq 'iossimulator') { @('arm64') } else { @('x86_64', 'aarch64') }
if ($Platform -Eq 'android') {
$Architectures += 'arm'
$Architectures += 'x86'
}
$Architectures | ForEach-Object {
$Architecture = $_
$BuildTypes = @('Debug', 'Release')
if ($Platform -Eq 'windows' -Or $Platform -Eq 'macos' -Or $Platform -Eq 'android') {
$BuildTypes += 'RelWithDebInfo'
}
$BuildTypes | ForEach-Object {
$BuildType = $_
$Job = @{
name = "[conan2-$Platform-$Architecture-$BuildType]"
arch = $Architecture
build_type = $BuildType
os = $Platform
runner = switch ($Platform) {
'windows' { 'windows-2022' }
{ @('macos', 'ios', 'iossimulator') -contains $_ } { 'macos-15' }
{ @('linux', 'android') -contains $_ } { 'ubuntu-22.04' }
}
}
if ($Platform -Eq 'macos' -And $Architecture -Eq 'x86_64') {
$Job.runner = 'macos-15-intel'
}
if ($Platform -Eq 'linux') {
@('ubuntu-20.04', 'ubuntu-18.04', 'ubuntu-22.04') | ForEach-Object {
$LinuxJob = $Job.Clone()
$LinuxJob['distro'] = $_
$LinuxJob['name'] = "[conan2-$($LinuxJob['distro'])-$Architecture-$BuildType]"
$Jobs += $LinuxJob
}
} else {
$Jobs += $Job
}
}
}
}
echo "matrix=$(ConvertTo-JSON -Compress -InputObject @($Jobs))" >> $Env:GITHUB_OUTPUT
return
}
@('windows', 'macos', 'linux', 'ios', 'iossimulator', 'android') | Foreach-Object {
$Platform = $_
$Architectures = if ($Platform -Eq 'iossimulator') { @('arm64') } else { @('x86_64', 'aarch64') }
if($Platform -Eq 'android') {
$Architectures += 'arm'
$Architectures += 'x86'
}
$Architectures | ForEach-Object {
$Architecture = $_
$BuildTypes = @('Debug', 'Release')
if ($Platform -Eq "windows" -Or $Platform -Eq "macos" -Or $Platform -Eq "Android") {
$BuildTypes += "RelWithDebInfo"
}
$BuildTypes | ForEach-Object {
$BuildType = $_
$Job = @{
name = "[$Platform-$Architecture-$BuildType]"
arch = $Architecture
build_type = $BuildType
os = $Platform
runner = switch ($Platform) {
"windows" { "windows-2022" }
{ @("macos", "ios", "iossimulator") -contains $_ } { "macos-15" }
{ @("linux", "android") -contains $_ } { "ubuntu-22.04" }
}
}
if ($Platform -Eq "macos" -And $Architecture -Eq "x86_64") {
$Job.runner = "macos-15-intel"
}
$Jobs += $Job
if ($Platform -Eq "linux") {
# default distro target
$Job["distro"] = "ubuntu-20.04"
$Job["name"] = "[$($Job["distro"])-$Architecture-$BuildType]"
$Job = $Job.Clone()
$Job["distro"] = "ubuntu-18.04"
$Job["name"] = "[$($Job["distro"])-$Architecture-$BuildType]"
$Jobs += $Job
$Job = $Job.Clone()
$Job["distro"] = "ubuntu-22.04"
$Job["name"] = "[$($Job["distro"])-$Architecture-$BuildType]"
$Jobs += $Job
}
}
}
}
echo "matrix=$(ConvertTo-JSON -Compress -InputObject @($Jobs))" >> $Env:GITHUB_OUTPUT
build:
name: ${{matrix.name}}
runs-on: ${{matrix.runner}}
needs: [generate-matrix]
concurrency:
group: conan-${{ needs.generate-matrix.outputs.conan_major_version }}-${{ github.ref }}-${{matrix.name}}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-matrix.outputs.matrix-json) }}
steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
with:
image: tonistiigi/binfmt:qemu-v7.0.0-28 # https://github.com/docker/setup-qemu-action/issues/198
if: runner.os == 'Linux'
- name: Set up docker buildx
uses: docker/setup-buildx-action@v4
if: runner.os == 'Linux'
- name: Configure Windows runner
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install --no-progress ninja
choco install --no-progress 7zip
choco install --no-progress python
choco install --no-progress vswhere
choco install --no-progress nasm
# https://github.com/actions/runner-images/issues/11926
choco install cmake --version 3.31.6 --force
echo "${Env:ProgramFiles}\NASM" | Out-File -FilePath $Env:GITHUB_PATH -Encoding UTF8 -Append
Invoke-WebRequest -Uri 'https://www.tortall.net/projects/yasm/releases/yasm-1.2.0-win64.exe' -OutFile 'yasm.exe'
Move-Item .\yasm.exe "${Env:ProgramFiles}\NASM\yasm.exe"
$SetupArgs = @{
VenvRoot = "$Env:RUNNER_TEMP\conan-venvs"
ShimDir = "$Env:RUNNER_TEMP\conan-bin"
NoUserPathUpdate = $true
}
if ('${{ needs.generate-matrix.outputs.conan_major_version }}' -eq '2') {
.\scripts\setup-conan-venvs.ps1 @SetupArgs -Conan2Version "${{ env.conan2_version }}" -SkipConan1
echo "CONAN_HOME=C:/tmp/.conan2" >> $Env:GITHUB_ENV
} else {
.\scripts\setup-conan-venvs.ps1 @SetupArgs -Conan1Version "${{ env.conan1_version }}" -SkipConan2
echo "CONAN_USER_HOME=C:/tmp" >> $Env:GITHUB_ENV
}
echo $PSVersionTable
- name: Configure macOS runner
if: runner.os == 'macOS'
uses: actions/setup-python@v6
with:
python-version: '3.10'
# Pin Xcode for every macOS job (device, simulator and x86_64) so the
# toolchain is deterministic. Silently falling back to the runner's
# default Xcode lets newer toolchains ship bitcode/SDKs that older
# consumers can't link (e.g. RelWithDebInfo LTO across mismatched
# Xcode versions), so fail loudly if the pinned version is missing.
- name: Select Xcode
if: runner.os == 'macOS'
run: |
XCODE_APP="/Applications/Xcode_${{ env.xcode_version }}.app"
if [ ! -d "$XCODE_APP" ]; then
echo "::error::$XCODE_APP is not installed on this runner. Installed Xcodes:"
ls -d /Applications/Xcode_*.app 2>/dev/null || true
exit 1
fi
sudo xcode-select --switch "$XCODE_APP"
xcodebuild -version
- name: Configure macOS runner
if: runner.os == 'macOS'
env:
CMAKE_OSX_DEPLOYMENT_TARGET: "10.12"
run: |
if brew help trust >/dev/null 2>&1; then
brew trust aws/tap azure/bicep || true
fi
brew install nasm yasm
if [ "${{ needs.generate-matrix.outputs.conan_major_version }}" = "2" ]; then
pwsh ./scripts/setup-conan-venvs.ps1 -Conan2Version "${{ env.conan2_version }}" -SkipConan1 -VenvRoot "$RUNNER_TEMP/conan-venvs" -ShimDir "$RUNNER_TEMP/conan-bin" -NoUserPathUpdate
echo "CONAN_HOME=/tmp/.conan2" >> $GITHUB_ENV
else
pwsh ./scripts/setup-conan-venvs.ps1 -Conan1Version "${{ env.conan1_version }}" -SkipConan2 -VenvRoot "$RUNNER_TEMP/conan-venvs" -ShimDir "$RUNNER_TEMP/conan-bin" -NoUserPathUpdate
echo "CONAN_USER_HOME=/tmp" >> $GITHUB_ENV
fi
sudo rm -rf /Library/Developer/CommandLineTools
- name: Configure Linux runner
if: runner.os == 'Linux'
run: |
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get install ninja-build xz-utils nasm yasm python3 python3-pip python3-venv python3-wget python3-setuptools
# https://github.com/actions/runner-images/issues/11926
sudo apt-get update
sudo apt-get install cmake=3.22.1-1ubuntu1.22.04.2
sudo ln -sf /usr/bin/cmake /usr/local/bin/cmake
if [ "${{ needs.generate-matrix.outputs.conan_major_version }}" = "2" ]; then
pwsh ./scripts/setup-conan-venvs.ps1 -Conan2Version "${{ env.conan2_version }}" -SkipConan1 -VenvRoot "$RUNNER_TEMP/conan-venvs" -ShimDir "$RUNNER_TEMP/conan-bin" -NoUserPathUpdate
echo "CONAN_HOME=/tmp/.conan2" >> $GITHUB_ENV
else
pwsh ./scripts/setup-conan-venvs.ps1 -Conan1Version "${{ env.conan1_version }}" -SkipConan2 -VenvRoot "$RUNNER_TEMP/conan-venvs" -ShimDir "$RUNNER_TEMP/conan-bin" -NoUserPathUpdate
echo "CONAN_USER_HOME=/tmp" >> $GITHUB_ENV
fi
- name: Setup LLVM
uses: Devolutions/actions-public/setup-llvm@v1
if: runner.os == 'linux'
with:
version: "18.1.8"
- name: Configure Android NDK
if: matrix.os == 'android'
run: |
## Pin the cmake version for now, libpng builds are failing on Android x86-64
## Probably related to cmake 3.25 setting LINUX
## https://gitlab.kitware.com/cmake/cmake/-/issues/24196
## https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7963
pip3 install cmake==3.24.2
cmake --version
- name: Configure conan environment
shell: pwsh
run: |
if ('${{ needs.generate-matrix.outputs.conan_major_version }}' -eq '2') {
conan2 profile detect --force
} else {
conan1 config init
conan1 config install ./settings
conan1 remote disable conancenter
}
$ConanManifestTime = $(git log -1 --pretty=format:%ct)
echo "CONAN_MANIFEST_TIME=$ConanManifestTime" >> $Env:GITHUB_ENV
- name: Build conan packages
shell: pwsh
run: |
if ('${{ needs.generate-matrix.outputs.conan_major_version }}' -eq '2') {
if ("${{ matrix.distro }}") {
./scripts/build-conan2.ps1 -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -BuildType ${{ matrix.build_type }} -Distribution ${{ matrix.distro }}
} else {
./scripts/build-conan2.ps1 -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -BuildType ${{ matrix.build_type }}
}
} else {
if ("${{ matrix.distro }}") {
./build.ps1 -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -BuildType ${{ matrix.build_type }} -Distribution ${{ matrix.distro }}
} else {
./build.ps1 -Platform ${{ matrix.os }} -Architecture ${{ matrix.arch }} -BuildType ${{ matrix.build_type }}
}
}
- name: Package conan cache
id: package-conan-cache
shell: pwsh
run: |
if ("${{ matrix.distro }}") {
$PACKAGE_NAME="conan${{ needs.generate-matrix.outputs.conan_major_version }}-${{ matrix.arch }}-${{ matrix.distro }}-${{ matrix.build_type }}"
} else {
$PACKAGE_NAME="conan${{ needs.generate-matrix.outputs.conan_major_version }}-${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.build_type }}"
}
if ('${{ needs.generate-matrix.outputs.conan_major_version }}' -eq '2') {
conan2 cache clean '*' --source --build --download --temp --backup-sources
$ConanHome = $Env:CONAN_HOME
if ([string]::IsNullOrWhiteSpace($ConanHome)) {
$ConanHome = Join-Path $HOME ".conan2"
}
$ConanHomeParent = Split-Path $ConanHome -Parent
$ConanHomeName = Split-Path $ConanHome -Leaf
tar -czf "${PACKAGE_NAME}.tar.gz" -C "$ConanHomeParent" "$ConanHomeName"
} else {
conan1 remove --locks
$CONAN_DATA = Join-Path $Env:CONAN_USER_HOME ".conan" "data"
$RemoveList = Get-ChildItem "${CONAN_DATA}" -Include @("build","source") -Directory -Depth 4 -Recurse -Name
$RemoveList | ForEach-Object { Remove-Item -Path "$CONAN_DATA/$_" -Recurse -Force }
$ConanManifests = Get-ChildItem $CONAN_DATA -Recurse -Include "conanmanifest.txt"
$ConanManifestTime = $Env:CONAN_MANIFEST_TIME
foreach ($ManifestFile in $ConanManifests) {
$Manifest = Get-Content $ManifestFile
$Manifest[0] = $ConanManifestTime
$Manifest | Out-File $ManifestFile
}
tar -czf "${PACKAGE_NAME}.tar.gz" -C "$Env:CONAN_USER_HOME" ".conan"
}
echo "package_name=$PACKAGE_NAME" >> $Env:GITHUB_OUTPUT
- name: Upload conan cache
uses: actions/upload-artifact@v7
with:
name: ${{ steps.package-conan-cache.outputs.package_name }}
path: ${{ steps.package-conan-cache.outputs.package_name }}.tar.gz
publish:
needs:
- generate-matrix
- build
if: github.event_name != 'schedule'
uses: ./.github/workflows/conan-publish.yml
with:
conan_major_version: ${{ needs.generate-matrix.outputs.conan_major_version }}
dry_run: ${{ inputs.publish_dry_run }}
secrets: inherit
notify:
name: Notify failure
runs-on: ubuntu-latest
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }}
needs:
- generate-matrix
- build
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ARCHITECTURE }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
steps:
- name: Send slack notification
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.repository }}* :fire::fire::fire::fire::fire: \n The scheduled build for *${{ github.repository }}* is <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|broken>"
}
}
]
}