forked from PCSX2/pcsx2
-
Notifications
You must be signed in to change notification settings - Fork 3
199 lines (183 loc) · 7.76 KB
/
windows-workflow.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
name: 🖥️ Windows Builds
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
- '.clang-format'
- '.codacy.yaml'
- '.github/*'
- '.github/workflows/lint-gamedb.yml'
- '.github/workflows/linux-workflow.yml'
- '.github/workflows/macos-workflow.yml'
- '.github/workflows/scripts/linux/**'
- '.github/workflows/scripts/validation/**'
- '.gitignore'
- 'bin/PCSX2_keys.ini.default'
- 'build.sh'
- 'buildbot.xml'
- 'linux_various/**'
- 'mscompile.cmd'
- 'pcsx2/CDVD/Linux/**'
- 'pcsx2/DEV9/Linux/**'
- 'pcsx2/Linux/**'
- 'pcsx2/PAD/Linux/**'
- 'pcsx2/SPU2/Linux/**'
- 'pcsx2/USB/linux/**'
pull_request:
branches:
- master
paths-ignore:
- '**/*.md'
- '.clang-format'
- '.codacy.yaml'
- '.github/*'
- '.github/workflows/lint-gamedb.yml'
- '.github/workflows/linux-workflow.yml'
- '.github/workflows/macos-workflow.yml'
- '.github/workflows/scripts/linux/**'
- '.github/workflows/scripts/validation/**'
- '.gitignore'
- 'bin/PCSX2_keys.ini.default'
- 'build.sh'
- 'buildbot.xml'
- 'linux_various/**'
- 'mscompile.cmd'
- 'pcsx2/CDVD/Linux/**'
- 'pcsx2/DEV9/Linux/**'
- 'pcsx2/Linux/**'
- 'pcsx2/PAD/Linux/**'
- 'pcsx2/SPU2/Linux/**'
- 'pcsx2/USB/linux/**'
workflow_dispatch:
inputs:
retainDebugArtifacts:
description: 'Retain debug artifacts (.pdb/.exp/.lib) for an easier debugging experience. (true|false)'
required: true
default: 'false'
jobs:
build:
strategy:
# Prevent one build from failing everything (although maybe those should be included as experimental builds instead)
fail-fast: false
matrix:
os: [windows-2019]
platform: [Win32, x64]
configuration: [Release, Release AVX2, CMake]
experimental: [false]
name: ${{ matrix.platform }} | ${{ matrix.configuration }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
timeout-minutes: 60
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_COMPRESS_LEVEL: 9
BUILDCACHE_MAX_CACHE_SIZE: 536870912 # 512MB
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_LOG_FILE: ${{ github.workspace }}\buildcache.log
steps:
# NOTE - useful for debugging
# - name: Dump GitHub context
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: echo "$GITHUB_CONTEXT"
- name: Checkout Repository
uses: actions/checkout@v2
- name: Checkout Submodules
run: git submodule update --init --recursive -j $env:NUMBER_OF_PROCESSORS
- name: Setup Buildcache
uses: mikehardy/[email protected]
with:
cache_key: ${{ matrix.os }} ${{ matrix.platform }} ${{ matrix.configuration }}
if: matrix.configuration == 'CMake' # TODO: buildcache on VS
- name: Verify VS Project Files
run: .github\workflows\scripts\windows\validate-vs-filters.ps1
if: matrix.configuration != 'CMake'
- name: Setup msbuild
uses: microsoft/setup-msbuild@v1
if: matrix.configuration != 'CMake'
- name: Generate CMake
id: cmake
shell: cmd
run: |
if "${{ github.event.inputs.retainDebugArtifacts }}"=="true" (SET type=RelWithDebInfo) else (SET type=Release)
if "${{ matrix.platform }}"=="Win32" (SET vcvars=vcvarsamd64_x86.bat) else (SET vcvars=vcvars64.bat)
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\%vcvars%"
echo ::set-output name=buildtype::%type%
echo ::set-output name=vcvars::%vcvars%
cmake . -B build -DCMAKE_BUILD_TYPE=%type% -DLTO_PCSX2_CORE=ON -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=..\buildcache\bin\buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=..\buildcache\bin\buildcache.exe -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
if: matrix.configuration == 'CMake'
- name: Build PCSX2
shell: cmd
env:
# Set to 'true' to retain the .pdb / .exp / .lib, etc files which can be useful for repro'ing issues that only occur in the compiled .exe
RetainDebuggingArtifacts: ${{ github.event.inputs.retainDebugArtifacts == 'true' }}
run: |
if "${{ matrix.configuration }}"=="CMake" (
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\${{ steps.cmake.outputs.vcvars }}"
cmake --build build --config ${{ steps.cmake.outputs.buildtype }}
) else (
msbuild "PCSX2_suite.sln" /m /v:m /p:Configuration="${{ matrix.configuration }}" /p:Platform="${{ matrix.platform }}"
)
- name: Run Tests
shell: cmd
run: |
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\${{ steps.cmake.outputs.vcvars }}"
cmake --build build --config ${{ steps.cmake.outputs.buildtype }} --target unittests
if: matrix.configuration == 'CMake'
- name: Prepare Artifact Metadata
id: artifact-metadata
shell: bash
run: |
ARCH=$([ "${{ matrix.platform }}" == Win32 ] && echo "32bit" || echo "64bit")
case "${{ matrix.configuration }}" in
Release) SIMD="SSE4";;
*AVX2) SIMD="AVX2";;
CMake) SIMD="CMake"
cp build/pcsx2/PCSX2* bin/ ;;
*) SIMD="UNKNOWN";;
esac
if [ ${{ github.event_name }} == "pull_request" ]; then
PR_SHA=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")
ARTIFACT_NAME="PCSX2-${ARCH}-${SIMD}"
if [ ! -z "${{ github.event.pull_request.number }}" ]; then
PR_NUM=${{ github.event.pull_request.number }}
ARTIFACT_NAME="${ARTIFACT_NAME}-pr[${PR_NUM}]"
fi
ARTIFACT_NAME="${ARTIFACT_NAME}-sha[${PR_SHA}]"
if [ ! -z "${{ github.event.pull_request.title }}" ]; then
PR_TITLE=$(echo "${{ github.event.pull_request.title }}" | tr -cd '[a-zA-Z0-9[:space:]]_-')
ARTIFACT_NAME="${ARTIFACT_NAME}-title["${PR_TITLE}""
fi
else
SHA=$(git rev-parse --short "$GITHUB_SHA")
ARTIFACT_NAME="PCSX2-${ARCH}-${SIMD}-sha[${SHA}"
fi
TRIMMED_ARTIFACT_NAME=$(printf "%.199s]" "$ARTIFACT_NAME")
echo "name=$TRIMMED_ARTIFACT_NAME"
echo "##[set-output name=name;]${TRIMMED_ARTIFACT_NAME}"
- name: Prepare Artifact Folder
shell: bash
working-directory: bin
run: |
retainDebugArtifacts=$([ "${{ github.event.inputs.retainDebugArtifacts }}" == "true" ] && echo "true" || echo "false")
if [ "${retainDebugArtifacts}" == "false" ]; then
ls ./
rm -f *.bsc *.exp *.ilk *.iobj *.ipdb *.lib *.pdb
fi
shopt -s extglob dotglob
mkdir -p "${{ steps.artifact-metadata.outputs.name }}"
mv !("${{ steps.artifact-metadata.outputs.name }}") "${{ steps.artifact-metadata.outputs.name }}"
shopt -u dotglob
- name: Upload artifact
uses: actions/upload-artifact@v2
continue-on-error: true
with:
name: ${{ steps.artifact-metadata.outputs.name }}
path: bin
retention-days: 30 # https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy