-
Notifications
You must be signed in to change notification settings - Fork 387
171 lines (152 loc) · 5.82 KB
/
msvc-full-features-cmake.yml
File metadata and controls
171 lines (152 loc) · 5.82 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
name: Cataclysm Windows build (CMake + MSVC)
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "android/**"
- "build-data/osx/**"
- "docs/**"
- "doxygen_doc/**"
- "gfx/**"
- "lang/**"
- "lgtm/**"
- "tools/**"
- "!tools/format/**"
- "utilities/**"
- "scripts/**"
- "**.md"
- "**.mdx"
pull_request:
branches:
- main
paths-ignore:
- "android/**"
- "build-data/osx/**"
- "docs/**"
- "doxygen_doc/**"
- "gfx/**"
- "lang/**"
- "lgtm/**"
- "tools/**"
- "!tools/format/**"
- "utilities/**"
- "scripts/**"
- "**.md"
- "**.mdx"
# We only care about the latest revision, so cancel previous instances.
concurrency:
group: msvc-cmake-build-${{ github.ref_name }}
cancel-in-progress: true
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
# There's not enough disk space to build both release and debug versions of
# our dependencies, so we hack the triplet file to build only release versions
# Have to use github.workspace because runner namespace isn't available yet.
VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}\.github\vcpkg_triplets
ZSTD_CLEVEL: 17
CMAKE_BUILD_DIR: out/build/windows-tiles-sounds-x64-msvc-tests
jobs:
build_catatclysm:
name: Build
runs-on: windows-latest
if: github.event.pull_request.draft == false
steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Remove Strawberry Perl from PATH
run: |
echo $env:PATH
echo =========================
$env:PATH = $env:PATH -replace "C:\\Strawberry\\c\\bin;", ""
$env:PATH = $env:PATH -replace "C:\\Strawberry\\perl\\site\\bin;", ""
$env:PATH = $env:PATH -replace "C:\\Strawberry\\perl\\bin;", ""
"PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append
echo =========================
echo $env:PATH
- name: Install stable CMake
uses: lukka/get-cmake@v3.31.6
# https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache#1---export-required-github-actions-environment-variables
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable("ACTIONS_CACHE_URL", process.env.ACTIONS_CACHE_URL || "")
core.exportVariable("ACTIONS_RUNTIME_TOKEN", process.env.ACTIONS_RUNTIME_TOKEN || "")
- name: Install vcpkg
uses: lukka/run-vcpkg@main
id: runvcpkg
with:
vcpkgDirectory: "${{ runner.workspace }}/b/vcpkg"
- name: Integrate vcpkg
run: |
vcpkg integrate install
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable("ACTIONS_CACHE_URL", process.env.ACTIONS_CACHE_URL || "")
core.exportVariable("ACTIONS_RUNTIME_TOKEN", process.env.ACTIONS_RUNTIME_TOKEN || "")
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: msvc-cmake-windows-tiles-sounds-x64-msvc-${{ github.ref_name }}
restore-keys: |
msvc-cmake-windows-tiles-sounds-x64-msvc-${{ github.ref_name }}
msvc-cmake-windows-tiles-sounds-x64-msvc-main
msvc-cmake-windows-tiles-sounds-x64-msvc-
max-size: 500M
verbose: 2
save: ${{ github.event_name != 'pull_request' }}
- name: Configure ccache for MSVC
run: |
echo "CCACHE_BASEDIR=${{ github.workspace }}" >> $env:GITHUB_ENV
echo "CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros,pch_defines" >> $env:GITHUB_ENV
echo "CCACHE_NOHASHDIR=1" >> $env:GITHUB_ENV
# build-scripts/windows-tiles-sounds-x64-msvc.cmake (CMAKE_PROJECT_INCLUDE_BEFORE)
# bootstraps the MSVC toolchain via VsDevCmd.bat if not already in a VS environment,
# and auto-detects ccache if present on PATH.
- name: Configure CMake
run: |
cmake -G Ninja `
-S "${{ github.workspace }}" `
-B "${{ github.workspace }}/${{ env.CMAKE_BUILD_DIR }}" `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_PROJECT_INCLUDE_BEFORE="${{ github.workspace }}/build-scripts/windows-tiles-sounds-x64-msvc.cmake" `
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/build-scripts/MSVC.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
-DDYNAMIC_LINKING=False `
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
-DCURSES=False `
-DLOCALIZE=True `
-DTILES=True `
-DSOUND=True `
-DTESTS=True `
-DJSON_FORMAT=OFF `
-DCMAKE_INSTALL_MESSAGE=NEVER
- name: Build
run: |
cmake --build "${{ github.workspace }}/${{ env.CMAKE_BUILD_DIR }}" `
--target cataclysm-bn-tiles --target cata_test-tiles
- name: Dump logs if build failed
if: failure()
run: |
echo =================================================
Get-ChildItem "${{ github.workspace }}/${{ env.CMAKE_BUILD_DIR }}" -Recurse
echo =================================================
- name: Compile .mo files for localization
run: |
cmake --build "${{ github.workspace }}/${{ env.CMAKE_BUILD_DIR }}" --target translations_compile
- name: ccache stats
run: |
ccache -s -vv
- name: Run tests
run: |
& "${{ github.workspace }}/${{ env.CMAKE_BUILD_DIR }}/tests/cata_test-tiles.exe" --rng-seed time