Repository navigation
174 lines (161 loc) · 5.85 KB
/
Copy pathbuild.yml
File metadata and controls
174 lines (161 loc) · 5.85 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
name: Build
on:
workflow_call:
inputs:
source_sha:
required: true
type: string
build_type:
required: true
type: string
version_identifier:
type: string
default: ''
use_cache:
type: boolean
default: true
use_ccache:
type: boolean
default: false
outputs:
semver:
value: ${{ jobs.Prepare.outputs.semver }}
tag:
value: ${{ jobs.Prepare.outputs.tag }}
application_name:
value: ${{ jobs.Prepare.outputs.application_name }}
defaults:
run:
shell: pwsh
jobs:
Prepare:
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.version.outputs.semver }}
tag: ${{ steps.version.outputs.tag }}
application_name: ${{ steps.version.outputs.application_name }}
version_identifier: ${{ steps.version.outputs.version_identifier }}
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ inputs.source_sha }}
- name: Prepare build version
id: version
uses: diffscope/catalogs/actions/nightly@main
with:
operation: prepare
source-sha: ${{ inputs.source_sha }}
build-type: ${{ inputs.build_type }}
version-identifier: ${{ inputs.version_identifier }}
Build:
needs: Prepare
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
platform: Windows
arch: amd64
- os: macos-15
platform: macOS
arch: arm64
- os: ubuntu-24.04
platform: Linux
arch: amd64
runs-on: ${{ matrix.os }}
env:
VCPKG_REF: 0c2a9ace1964b818b15f7ae50ba1c42404918a7b
VCPKG_DISABLE_METRICS: '1'
MACOSX_DEPLOYMENT_TARGET: '13.3'
BUILD_DIR: ${{ github.workspace }}/build/build
INSTALL_DIR: ${{ github.workspace }}/build/install
CCACHE_DIR: ${{ github.workspace }}/build/ccache
BUILD_TYPE: ${{ inputs.build_type }}
VERSION_IDENTIFIER: ${{ needs.Prepare.outputs.version_identifier }}
EXPECTED_SEMVER: ${{ needs.Prepare.outputs.semver }}
ARTIFACT_PLATFORM: ${{ matrix.platform }}
ARTIFACT_ARCH: ${{ matrix.arch }}
ARCHIVE_EXTENSION: ${{ matrix.platform == 'Windows' && 'zip' || 'tar.xz' }}
USE_CCACHE: ${{ inputs.build_type != 'nightly' && inputs.use_cache && inputs.use_ccache }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.source_sha }}
submodules: recursive
- name: Initialize build environment
uses: ./.github/actions/initialize-build-environment
- name: Initialize vcpkg
uses: ./.github/actions/initialize-vcpkg
with:
ref: ${{ env.VCPKG_REF }}
use_cache: ${{ inputs.build_type != 'nightly' && inputs.use_cache }}
- name: Restore CCache cache
if: inputs.build_type != 'nightly' && inputs.use_cache && inputs.use_ccache
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-${{ inputs.source_sha }}
restore-keys: |
${{ runner.os }}-ccache-
- name: Build and install
run: |
$expectedArch = $env:ARTIFACT_ARCH -eq 'amd64' ? 'X64' : 'ARM64'
if ($env:RUNNER_ARCH -ne $expectedArch) {
throw "Unexpected runner architecture: $env:RUNNER_ARCH"
}
$output = & ./scripts/ci/Build.ps1 `
-BuildType $env:BUILD_TYPE `
-VcpkgRootDir $env:VCPKG_ROOT_DIR `
-BuildDir $env:BUILD_DIR `
-InstallDir $env:INSTALL_DIR `
-VersionIdentifier $env:VERSION_IDENTIFIER `
-ArtifactPlatform $env:ARTIFACT_PLATFORM `
-ArtifactArchitecture $env:ARTIFACT_ARCH `
-CCache:($env:USE_CCACHE -eq 'true')
if ($output.Semver -ne $env:EXPECTED_SEMVER) {
throw 'Built application version differs from the reserved version'
}
"ARTIFACT_NAME=$($output.ArtifactFileBase)" >> $env:GITHUB_ENV
"APPLICATION_SEMVER=$($output.Semver)" >> $env:GITHUB_ENV
"APPLICATION_DISPLAY_NAME=$($output.ApplicationDisplayName)" >> $env:GITHUB_ENV
"APPLICATION_NAME=$($output.ApplicationName)" >> $env:GITHUB_ENV
- name: Save CCache cache
if: inputs.build_type != 'nightly' && inputs.use_cache && inputs.use_ccache
uses: actions/cache/save@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-${{ inputs.source_sha }}
- name: Collect symbol files
run: |
$output = & ./scripts/ci/Collect-Symbol-Files.ps1 `
-VcpkgRootDir $env:VCPKG_ROOT_DIR `
-InstallDir $env:INSTALL_DIR `
-ArchivePath "$($env:ARTIFACT_NAME)_debug_symbols.$($env:ARCHIVE_EXTENSION)"
"SYMBOL_FILES_PATH=$output" >> $env:GITHUB_ENV
- name: Create portable archive
run: |
$archive = & ./scripts/ci/Create-Portable.ps1 `
-InstallDir $env:INSTALL_DIR `
-ApplicationName $env:APPLICATION_NAME `
-ArchivePath "$($env:ARTIFACT_NAME)_portable.$($env:ARCHIVE_EXTENSION)"
"PORTABLE_PATH=$archive" >> $env:GITHUB_ENV
- name: Upload symbol files
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_debug_symbols
path: ${{ env.SYMBOL_FILES_PATH }}
if-no-files-found: error
overwrite: true
compression-level: 0
- name: Upload portable archive
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_portable
path: ${{ env.PORTABLE_PATH }}
if-no-files-found: error
overwrite: true
compression-level: 0