-
Notifications
You must be signed in to change notification settings - Fork 19
254 lines (249 loc) · 10.3 KB
/
prod_ci_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
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
# Build, check and deploy LPub3D
# Trevor SANDY <[email protected]>
# Last Update: October 21, 2024
# Copyright (C) 2021 - 2025 by Trevor SANDY
#
# Commit message strings with [skip ci], [ci skip], [no ci], [skip actions], or [actions skip]
# will skip pull request and push workflows.
#
name: builds # used for badge label
on:
push:
branches:
- 'master'
tags:
- 'v*'
- '!continuous'
workflow_dispatch:
jobs:
build-linux:
# if: ${{ false }} # uncomment to disable
name: Build ${{ matrix.BUILD }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: # ubuntu-amd64, ubuntu-arm64, ubuntu-amd64-appimage, ubuntu-arm64-appimage, fedora-amd64, archlinux-amd64
BUILD: [ ubuntu-amd64, ubuntu-arm64, ubuntu-amd64-appimage, ubuntu-arm64-appimage, fedora-amd64, archlinux-amd64 ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Work Paths
run: |
echo "LP3D_3RD_PARTY_PATH=$(cd ../ && echo "$PWD/third_party")" >> ${GITHUB_ENV}
echo "LP3D_BUILDPKG_PATH=$(cd ../ && mkdir buildpkg && echo "$PWD/buildpkg")" >> ${GITHUB_ENV}
- name: Cache Third-party
id: cache-third-party
uses: actions/cache@v4
with:
path: ${{ env.LP3D_3RD_PARTY_PATH }}
key: third-party-${{ matrix.BUILD }}-${{ secrets.THIRD_PARTY_CACHE }}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: Build ${{ matrix.BUILD }}
run: bash -ex builds/utilities/ci/github/linux-build.sh
env:
GITHUB_TOKEN: ${{ github.token }}
BUILD: ${{ matrix.BUILD }}
LP3D_CPU_CORES: ${{ steps.cpu-cores.outputs.count }}
LP3D_COMMIT_MSG: ${{ github.event.head_commit.message }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
- name: List Artifacts
if: always()
run: test -d ${{ env.LP3D_BUILDPKG_PATH }} && ls -alFR ${{ env.LP3D_BUILDPKG_PATH }} || true
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.BUILD }}-download
path: ${{ env.LP3D_BUILDPKG_PATH }}/
if-no-files-found: ignore
- name: Diagnostics
if: failure() || cancelled()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.BUILD }}-logs
path: ${{ env.LP3D_BUILDPKG_PATH }}/
if-no-files-found: ignore
build-macos:
# if: ${{ false }} # uncomment to disable
name: Build macOS ${{ matrix.runner-version }}
runs-on: macos-${{ matrix.runner-version }}
strategy:
fail-fast: false
matrix:
runner-version: [ 13, 14 ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Work Paths
run: |
echo "LP3D_3RD_PARTY_PATH=$(cd ../ && echo "$PWD/third_party")" >> ${GITHUB_ENV}
echo "LP3D_BUILDPKG_PATH=$(cd ../ && mkdir buildpkg && echo "$PWD/buildpkg")" >> ${GITHUB_ENV}
- name: Cache Third-party
id: cache-third-party
uses: actions/cache@v4
with:
path: ${{ env.LP3D_3RD_PARTY_PATH }}
key: third-party-macos-${{ matrix.runner-version }}-${{ secrets.THIRD_PARTY_CACHE }}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: Build macOS ${{ matrix.runner-version }}
run: bash -ex builds/utilities/ci/github/macos-build.sh
env:
GITHUB_TOKEN: ${{ github.token }}
LP3D_CPU_CORES: ${{ steps.cpu-cores.outputs.count }}
LP3D_COMMIT_MSG: ${{ github.event.head_commit.message }}
- name: List Artifacts
if: always()
run: test -d ${{ env.LP3D_BUILDPKG_PATH }} && ls -alFR ${{ env.LP3D_BUILDPKG_PATH }} || true
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: macos-${{ matrix.runner-version }}-download
path: ${{ env.LP3D_BUILDPKG_PATH }}/
if-no-files-found: ignore
- name: Diagnostics
if: failure() || cancelled()
uses: actions/upload-artifact@v4
with:
name: macos-${{ matrix.runner-version }}-logs
path: ${{ env.LP3D_BUILDPKG_PATH }}/
if-no-files-found: ignore
build-windows:
# if: ${{ false }} # uncomment to disable
name: Build Windows 2022
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Work Paths
run: |
Echo "LP3D_3RD_PARTY_PATH=$(Join-Path (resolve-path ..\) 'third_party')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Echo "LP3D_BUILDPKG_PATH=$(Join-Path (resolve-path ..\) 'buildpkg')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Echo "LP3D_BUILD_BASE=$(resolve-path ..\)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
New-Item -Path ..\ -Name 'buildpkg' -ItemType 'directory'
- name: Cache Third-party # distribution folder
id: cache-third-party
uses: actions/cache@v4
with:
path: ${{ env.LP3D_3RD_PARTY_PATH }}
key: third-party-windows-${{ secrets.THIRD_PARTY_CACHE }}
- name: Cache QtMSVC 2019
id: cache-qt
uses: actions/cache@v4
with:
path: ${{ env.LP3D_BUILD_BASE }}\Qt
key: qt-windows-${{ env.QT_CACHE }}
- name: VC 141 Build Tools
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$ComponentsToAdd= @("Microsoft.VisualStudio.Component.VC.v141.x86.x64")
[string]$WorkloadArgs = $ComponentsToAdd | ForEach-Object {" --add " + $_} # Use --remove to delete component
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$WorkloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
shell: powershell
- name: Windows 8.1 SDK
run: |
Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=323507 -OutFile sdksetup.exe -UseBasicParsing
Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/features", "OptionId.WindowsDesktopSoftwareDevelopmentKit", "OptionId.NetFxSoftwareDevelopmentKit"
shell: powershell
- name: Qt MSVC 2019 64bit # path: ..\Qt\5.15.2\msvc2019_64\bin
uses: jurplel/install-qt-action@v4
with:
version: 5.15.2
host: windows
arch: win64_msvc2019_64
dir: ${{ env.LP3D_BUILD_BASE }}
cache: true
cache-key-prefix: install-qt-action
- name: Qt MSVC 2019 32bit # path: ..\Qt\5.15.2\msvc2019\bin
uses: jurplel/install-qt-action@v4
with:
version: 5.15.2
host: windows
arch: win32_msvc2019
dir: ${{ env.LP3D_BUILD_BASE }}
cache: true
cache-key-prefix: install-qt-action
- name: Build Windows
run: .\builds\utilities\ci\github\windows-build.bat | .\builds\utilities\win_tee.cmd "${{ env.LP3D_BUILDPKG_PATH }}\windows_build.log" append
env:
GITHUB_TOKEN: ${{ github.token }}
LP3D_COMMIT_MSG: ${{ github.event.head_commit.message }}
shell: cmd
- name: List Artifacts
if: always()
run: If (Test-Path -Path ${{ env.LP3D_BUILDPKG_PATH }}) { Get-ChildItem -Path ${{ env.LP3D_BUILDPKG_PATH }} –Recurse }
- name: Upload Update Artifacts
uses: actions/upload-artifact@v4
with:
name: updates
path: ${{ env.LP3D_BUILDPKG_PATH }}\Updates\
if-no-files-found: ignore
- name: Upload Download Artifacts
uses: actions/upload-artifact@v4
with:
name: windows-download
path: ${{ env.LP3D_BUILDPKG_PATH }}\Downloads\
if-no-files-found: ignore
- name: Diagnostics
if: failure() || cancelled()
uses: actions/upload-artifact@v4
with:
name: windows-logs
path: ${{ env.LP3D_BUILDPKG_PATH }}/
if-no-files-found: ignore
build-deploy:
# add "${{ false }} && # remove to enable" after pipe to disable
if: |
always() &&
!contains(github.event.head_commit.message, 'SKIP_DEPLOY') &&
(contains(github.event.head_commit.message, 'RELEASE_BUILD') ||
contains(github.event.head_commit.message, 'BUILD_ALL') ||
startsWith(github.event.ref, 'refs/tags/v') ||
github.event_name == 'workflow_dispatch')
name: Publish Assets
needs: [ build-linux, build-macos, build-windows ] # build-linux, build-macos, build-windows
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Assets Path
run: echo "LP3D_BUILD_ASSETS=$(cd ../ && echo "$PWD/assets")" >> ${GITHUB_ENV}
- name: Download Artifacts
uses: actions/download-artifact@v4
with: # omit 'with: name:' to download all artifacts
path: ${{ env.LP3D_BUILD_ASSETS }}
- name: List Assets
run: ls -alFR
working-directory: ${{ env.LP3D_BUILD_ASSETS }}
- name: Deploy Assets
run: bash -ex builds/utilities/ci/github/build-deploy.sh
env:
GITHUB_TOKEN: ${{ github.token }}
LP3D_COMMIT_MSG: ${{ github.event.head_commit.message }}
GPG_SIGN_KEY_ALIAS: ${{ secrets.GPG_SIGN_KEY_ALIAS }}
GPG_SIGN_PASSPHRASE: ${{ secrets.GPG_SIGN_PASSPHRASE }}
GPG_INIT_PASSPHRASE: ${{ secrets.GPG_INIT_PASSPHRASE }}
GPG_SIGN_KEY_BASE64: ${{ secrets.GPG_SIGN_KEY_BASE64 }}
SFDEPLOY_ED25519_BASE64: ${{ secrets.SFDEPLOY_ED25519_BASE64 }}
- name: Diagnostics
if: failure() || cancelled()
uses: actions/upload-artifact@v4
with:
name: publish-logs
path: ${{ env.LP3D_BUILDPKG_PATH }}/
if-no-files-found: ignore