forked from alliedmodders/hl2sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
150 lines (129 loc) · 5.05 KB
/
build-windows.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
name: Build on Windows
on:
push:
branches: [ "main" ]
paths:
- '.github/workflows/build-windows.yml'
- 'cmake/**'
- 'common/**'
- 'devtools/bin/win64/**'
- 'entity2/**'
- 'game/server/**'
- 'game/shared/**'
- 'gcsdk/**'
- 'interfaces/**'
- 'lib/win64/**'
- 'mathlib/**'
- 'public/**'
- 'thirdparty/**'
- 'tier1/**'
- 'CMakeGameManifests.json'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'trigger-build.txt'
pull_request:
branches: [ "main" ]
paths:
- '.github/workflows/build-windows.yml'
- 'cmake/**'
- 'common/**'
- 'devtools/bin/win64/**'
- 'entity2/**'
- 'game/server/**'
- 'game/shared/**'
- 'interfaces/**'
- 'lib/win64/**'
- 'mathlib/**'
- 'public/**'
- 'thirdparty/**'
- 'tier1/**'
- 'CMakeGameManifests.json'
- 'CMakeLists.txt'
- 'CMakePresets.json'
- 'trigger-build.txt'
env:
CMAKE_DEBUG_PRESET_NAME: VisualStudio/Debug
CMAKE_DEBUG_PRESET_PUBLIC_NAME: Debug
CMAKE_DEBUG_CONFIG_NAME: Debug
CMAKE_DEBUG_OUTPUT_PATTERN: build/Windows/VisualStudio/Debug/Debug/*
CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_NAME: VisualStudio/RelWithDebInfo
CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_PUBLIC_NAME: RelWithDebInfo
CMAKE_RELEASE_WITH_DEBUG_INFO_CONFIG_NAME: Debug
CMAKE_RELEASE_WITH_DEBUG_INFO_OUTPUT_PATTERN: build/Windows/VisualStudio/RelWithDebInfo/Debug/*
CMAKE_RELEASE_PRESET_NAME: VisualStudio/Release
CMAKE_RELEASE_PRESET_PUBLIC_NAME: Release
CMAKE_RELEASE_CONFIG_NAME: Release
CMAKE_RELEASE_OUTPUT_PATTERN: build/Windows/VisualStudio/Release/Release/*
SOURCESDK_MALLOC_OVERRIDE: ON
MSVC_CC: cl
MSVC_CXX: cl
MSVC_NAME: MSVC
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true
- name: Set up environment variables
run: |
echo "REPOSITORY_NAME=$(basename ${env:GITHUB_REPOSITORY})" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "ABSOLUTE_PATH=${env:GITHUB_WORKSPACE}" | Out-File -FilePath $env:GITHUB_ENV -Append
shell: pwsh
- name: Configure Git to treat current directory as safe
run: git config --global --add safe.directory $env:GITHUB_WORKSPACE
shell: pwsh
- name: Get latest tag
id: get-latest-tag
run: |
if ((git tag) -eq $null) {
echo "No tags found"
echo "LATEST_TAG=none" | Out-File -FilePath $env:GITHUB_ENV -Append
} else {
$LATEST_TAG = git describe --tags (git rev-list --tags --max-count=1)
echo "LATEST_TAG=$LATEST_TAG" | Out-File -FilePath $env:GITHUB_ENV -Append
}
shell: pwsh
- name: Debug - Configure CMake
run: >
cmake --preset ${{ env.CMAKE_DEBUG_PRESET_NAME }}
-DCMAKE_C_COMPILER=${{ env.MSVC_CC }}
-DCMAKE_CXX_COMPILER=${{ env.MSVC_CXX }}
-DSOURCESDK_MALLOC_OVERRIDE=${{ env.SOURCESDK_MALLOC_OVERRIDE }}
- name: Debug - Build
run: cmake --build --preset ${{ env.CMAKE_DEBUG_PRESET_NAME }} --parallel --config ${{ env.CMAKE_DEBUG_CONFIG_NAME }}
- name: Debug - Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPOSITORY_NAME }}-${{ env.LATEST_TAG }}-${{ runner.os }}-${{ env.MSVC_NAME }}-${{ env.CMAKE_DEBUG_PRESET_PUBLIC_NAME }}
path: ${{ env.CMAKE_DEBUG_OUTPUT_PATTERN }}
- name: Release With Debug Info - Configure CMake
run: >
cmake --preset ${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_NAME }}
-DCMAKE_C_COMPILER=${{ env.MSVC_CC }}
-DCMAKE_CXX_COMPILER=${{ env.MSVC_CXX }}
-DSOURCESDK_MALLOC_OVERRIDE=${{ env.SOURCESDK_MALLOC_OVERRIDE }}
- name: Release With Debug Info - Build
run: cmake --build --preset ${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_NAME }} --parallel --config ${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_CONFIG_NAME }}
- name: Release With Debug Info - Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPOSITORY_NAME }}-${{ env.LATEST_TAG }}-${{ runner.os }}-${{ env.MSVC_NAME }}-${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_PUBLIC_NAME }}
path: ${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_OUTPUT_PATTERN }}
- name: Release - Configure CMake
run: >
cmake --preset ${{ env.CMAKE_RELEASE_PRESET_NAME }}
-DCMAKE_C_COMPILER=${{ env.MSVC_CC }}
-DCMAKE_CXX_COMPILER=${{ env.MSVC_CXX }}
-DSOURCESDK_MALLOC_OVERRIDE=${{ env.SOURCESDK_MALLOC_OVERRIDE }}
- name: Release - Build
run: cmake --build --preset ${{ env.CMAKE_RELEASE_PRESET_NAME }} --parallel --config ${{ env.CMAKE_RELEASE_CONFIG_NAME }}
- name: Release - Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPOSITORY_NAME }}-${{ env.LATEST_TAG }}-${{ runner.os }}-${{ env.MSVC_NAME }}-${{ env.CMAKE_RELEASE_PRESET_PUBLIC_NAME }}
path: ${{ env.CMAKE_RELEASE_OUTPUT_PATTERN }}