forked from fredemmott/HTCC
-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (123 loc) · 4.59 KB
/
Copy pathhtcc.yml
File metadata and controls
127 lines (123 loc) · 4.59 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
name: Build HTCC
on:
push:
paths-ignore:
- 'docs/**'
- '.github/workflows/pages.yml'
pull_request:
paths-ignore:
- 'docs/**'
- '.github/workflows/pages.yml'
jobs:
build:
name: ${{matrix.preset}}
runs-on: windows-latest
strategy:
matrix:
preset:
- Debug - default
- Debug - clang-cl
- Release
env:
VCPKG_DEFAULT_BINARY_CACHE: ${{github.workspace}}/.vcpkg-binary-cache
steps:
- name: Set up visual studio environment
shell: pwsh
run: |
$VSRoot = $(
vswhere `
-latest `
-products * `
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
-property installationPath)
cmd /c "`"${VSRoot}/VC/Auxiliary/Build/vcvarsall.bat`" x64&set" `
| Where-Object { $_ -like '*=*' } `
| Out-File -Encoding utf8 -Append $Env:GITHUB_ENV
- uses: actions/checkout@v6
with:
path: source
fetch-depth: 0
submodules: true
- name: Make build directory
run: cmake -E make_directory build
- name: Setup vcpkg binary cache
uses: actions/cache@v4
with:
key: ${{matrix.preset}}-${{hashFiles('source/vcpkg.json', 'source/vcpkg-configuration.json')}}
path: ${{env.VCPKG_DEFAULT_BINARY_CACHE}}
- name: Configure
id: configure
working-directory: build
shell: pwsh
run: |
cmake -E make_directory "${{env.VCPKG_DEFAULT_BINARY_CACHE}}"
$args = @()
if ("${{github.ref_type}}" -eq "tag") {
$args += "-DIS_TAGGED_BUILD=ON"
}
if ("${{matrix.preset}}" -like "*clang*") {
echo "NOT adding SOURCELINK - not supported by clang's linker"
} else {
echo "Telling CMake to enable SOURCELINK"
$args += "-DSOURCELINK=https://raw.githubusercontent.com/fredemmott/HTCC/${{github.sha}}"
}
$OutputRoot = "${{runner.temp}}/OUTPUT_ROOT"
cmake `
${{github.workspace}}/source `
--preset "${{matrix.preset}}" `
-DVERSION_TWEAK=${{github.run_number}} `
-DVERSION_TWEAK_LABEL=gha `
"-DOUTPUT_ROOT=${OutputRoot}" `
@args
Add-Content $Env:GITHUB_OUTPUT "output-root=${OutputRoot}"
- name: Build
id: build
working-directory: build
run: |
cmake --build . `
--parallel
$version="$(Get-Content version.txt)"
Add-Content $Env:GITHUB_OUTPUT "version=${version}"
- name: Build installer-generator
working-directory: source/HTCC-Installer
shell: pwsh
run: |
dotnet publish `
--configuration Release `
--output "${{steps.configure.outputs.output-root}}/wixsharp" `
HTCC-Installer.csproj
- name: Build installer
id: installer
shell: pwsh
working-directory: ${{steps.configure.outputs.output-root}}
run: |
# Pin specifically to WiX 5.0.2 to avoid any potential EULA changes
# https://github.com/wixtoolset/issues/issues/8974#issuecomment-2716432149
dotnet tool install --global wix --version '5.0.2'
wix extension add -g WixToolset.UI.wixext/5.0.2
wix extension list -g
wixsharp/HTCC-Installer.exe `
"$(Get-Location)" `
--stamp-file "${{github.workspace}}/installer.stamp"
$InstallerPath = Get-Content "${{github.workspace}}/installer.stamp"
$InstallerName = (Get-Item $InstallerPath).Name
Add-Content $env:GITHUB_OUTPUT "installer-path=${InstallerPath}"
Add-Content $env:GITHUB_OUTPUT "installer-name=${InstallerName}"
- uses: actions/upload-artifact@v6
if: matrix.preset == 'Release'
with:
name: HTCC-v${{steps.build.outputs.version}}-bundle
path: |
${{steps.configure.outputs.output-root}}/**/*
!${{steps.configure.outputs.output-root}}/**/*.pdb
!${{steps.configure.outputs.output-root}}/**/*.msi
- uses: actions/upload-artifact@v6
if: matrix.preset == 'Release'
with:
name: HTCC-v${{steps.build.outputs.VERSION}}-DebugSymbols
path: ${{steps.configure.outputs.output-root}}/bin/*.pdb
- uses: actions/upload-artifact@v6
if: matrix.preset == 'Release'
with:
name: ${{steps.installer.outputs.installer-name}}
path: ${{steps.installer.outputs.installer-path}}