-
Notifications
You must be signed in to change notification settings - Fork 3
216 lines (190 loc) · 8.27 KB
/
conan-packages.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
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
name: conan packages
on:
workflow_dispatch:
schedule:
- cron: '25 6 * * 4' # 6:25am UTC every Thursday
env:
conan-version: 1.60.0
jobs:
generate-matrix:
name: generate build matrix
runs-on: ubuntu-latest
outputs:
matrix-json: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: create build matrix
id: generate-matrix
shell: pwsh
run: |
$json = '[{"arch": "aarch64","runner": "ubuntu-20.04","os": "linux","name": "[lin-ubuntu-22.04-aarch64-Release]","distro": "ubuntu-22.04","build_type": "Release"}]'
echo "matrix=$json" >> $Env:GITHUB_OUTPUT
# - name: create build matrix
# id: generate-matrix
# shell: pwsh
# run: |
# $Jobs = @()
# @('windows', 'macos', 'linux', 'ios', 'android') | Foreach-Object {
# $Platform = $_
# $Architectures = @('x86_64', 'aarch64')
# if($Platform -Eq 'ios' -Or $Platform -Eq 'android') {
# $Architectures += 'arm'
# }
# if($Platform -Eq 'android') {
# $Architectures += 'x86'
# }
# $Architectures | ForEach-Object {
# $Architecture = $_
# $BuildTypes = @('Debug', 'Release')
# if ($Platform -Eq "macos" -Or $Platform -Eq "Android") {
# $BuildTypes += "RelWithDebInfo"
# }
# $BuildTypes | ForEach-Object {
# $BuildType = $_
# $Job = @{
# name = "[$($Platform.Substring(0, 3))-$Architecture-$BuildType]"
# arch = $Architecture
# build_type = $BuildType
# os = $Platform
# runner = switch ($Platform) {
# "windows" { "windows-2019" }
# { @("macos", "ios") -contains $_ } { "macos-latest" }
# { @("linux", "android") -contains $_ } { "ubuntu-20.04" }
# }
# }
# $Jobs += $Job
# if ($Platform -Eq "linux") {
# $Job = $Job.Clone()
# $Job["distro"] = "ubuntu-22.04"
# $Job["name"] = "[$($Platform.Substring(0, 3))-$($Job["distro"])-$Architecture-$BuildType]"
# $Jobs += $Job
# }
# }
# }
# }
# echo "matrix=$($Jobs | ConvertTo-JSON -Compress)" >> $Env:GITHUB_OUTPUT
build:
name: ${{matrix.name}}
runs-on: ${{matrix.runner}}
needs: [generate-matrix]
concurrency:
group: conan-${{ 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@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: runner.os == 'Linux'
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
if: runner.os == 'Linux'
- name: Configure Windows runner
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install --no-progress ninja
choco install --no-progress cmake
choco install --no-progress 7zip
choco install --no-progress python
choco install --no-progress vswhere
choco install --no-progress nasm
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"
pip install conan==${{ env.conan-version }} invoke Jinja2 urllib3 chardet requests --upgrade
echo $PSVersionTable
echo "CONAN_USER_HOME=C:/tmp" >> $Env:GITHUB_ENV
- name: Configure macOS runner
if: runner.os == 'macOS'
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Configure macOS runner
if: runner.os == 'macOS'
env:
CMAKE_OSX_DEPLOYMENT_TARGET: "10.12"
run: |
brew install ninja
brew install cmake
brew install python
brew install nasm yasm
pip3 install conan==${{ env.conan-version }} invoke Jinja2 urllib3 chardet requests --upgrade
sudo rm -rf /Library/Developer/CommandLineTools
echo "CONAN_USER_HOME=/tmp" >> $GITHUB_ENV
- name: Configure Linux runner
if: runner.os == 'Linux'
run: |
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get install ninja-build cmake xz-utils nasm yasm python3 python3-pip python3-wget python3-setuptools
pip3 install conan==${{ env.conan-version }} invoke Jinja2 urllib3 chardet requests --upgrade
echo "CONAN_USER_HOME=/tmp" >> $GITHUB_ENV
- name: Install clang+llvm
if: runner.os == 'Linux'
run: |
CLANG_LLVM_OS="ubuntu-$(lsb_release -rs)"
CLANG_LLVM_BASE_URL="https://github.com/awakecoding/llvm-prebuilt/releases/download/v2021.2.4"
CLANG_LLVM_NAME="clang+llvm-12.0.1-x86_64-${CLANG_LLVM_OS}"
wget -q "${CLANG_LLVM_BASE_URL}/${CLANG_LLVM_NAME}.tar.xz"
tar -xf "${CLANG_LLVM_NAME}.tar.xz" -C /tmp
sudo mv "/tmp/${CLANG_LLVM_NAME}" /opt/llvm
echo "PATH=$PATH:/opt/llvm/bin" >> $GITHUB_ENV
- 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: |
conan config init
conan config install ./settings
conan 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 ("${{ 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: |
$PACKAGE_NAME="conan-${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.build_type }}"
if ("${{ matrix.distro }}") {
$PACKAGE_NAME += "_${{ matrix.distro }}"
}
conan 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@v3
with:
name: ${{ steps.package-conan-cache.outputs.package_name }}
path: ${{ steps.package-conan-cache.outputs.package_name }}.tar.gz
publish:
needs: build
if: github.event_name != 'schedule'
uses: ./.github/workflows/conan-publish.yml
secrets: inherit