-
Notifications
You must be signed in to change notification settings - Fork 5
175 lines (149 loc) · 5.43 KB
/
build.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
name: Build All
on:
push:
branches: ['main', 'dev', 'dev/*']
pull_request:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test-windows:
name: Test (Windows)
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
config: [Release, Debug]
arch: [x64, x86]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download Foobar2000 SDK
run: |
curl -L https://www.foobar2000.org/files/SDK-2023-09-23.7z -o vendor/foobar2000_sdk.7z
7z x vendor/foobar2000_sdk.7z -ovendor/sdk
ls vendor/sdk
- name: Setup Msbuild
uses: microsoft/setup-msbuild@v2
- name: Restore NuGet packages
working-directory: ${{ github.workspace }}
run: nuget restore foo_input_ncm.sln
- name: Build Test Executable
working-directory: ${{ github.workspace }}
run: |
msbuild foo_input_ncm.sln -property:"Configuration=${{ matrix.config }};Platform=${{ matrix.arch}}" -target:foo_input_ncm_tests
- name: Run Tests (x86)
working-directory: ${{ github.workspace }}/${{ matrix.config }}
run: .\foo_input_ncm_tests.exe --gtest_repeat=10 --gtest_shuffle
if: matrix.arch == 'x86'
- name: Run Tests (x64)
working-directory: ${{ github.workspace }}/${{ matrix.arch }}/${{ matrix.config }}
run: .\foo_input_ncm_tests.exe --gtest_repeat=10 --gtest_shuffle
if: matrix.arch == 'x64'
test-macos:
name: Test (macOS)
runs-on: macos-14
strategy:
fail-fast: false
matrix:
config: [Release, Debug]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download Foobar2000 SDK
run: |
curl -L https://www.foobar2000.org/files/SDK-2023-09-23.7z -o vendor/foobar2000_sdk.7z
7z x vendor/foobar2000_sdk.7z -ovendor/sdk
ls vendor/sdk
- name: Setup GoogleTest Xcode Project
working-directory: ${{ github.workspace }}/vendor/googletest
run: |
mkdir build
cd build && cmake -G Xcode ..
- name: Build Tests
working-directory: ${{ github.workspace }}
run: |
xcodebuild clean build -workspace foo_input_ncm.xcworkspace -scheme foo_input_ncm_tests -configuration ${{ matrix.config }} -derivedDataPath .
- name: Run Tests
working-directory: ${{ github.workspace }}/Build/Products/${{ matrix.config }}
run: |
./foo_input_ncm_tests --gtest_repeat=10 --gtest_shuffle
matrix-build:
name: Matrix Build
runs-on: ${{ matrix.os }}
needs: [test-windows, test-macos]
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-14]
config: [Release, Debug]
arch: [x64, x86]
exclude:
- os: macos-14
arch: x86
include:
- os: windows-latest
build-command: msbuild
solution: foo_input_ncm.sln
- os: macos-14
build-command: xcodebuild
workspace: foo_input_ncm.xcworkspace
project: foo_input_ncm.xcodeproj
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true
fetch-depth: 0
- name: Versioning
run: |
TAG=$(git describe --tags)
VERSION=${TAG:1}
echo "#define CURRENT_VERSION $VERSION" >> src/stdafx.h
echo "----------------------------"
cat src/stdafx.h
shell: bash
working-directory: ${{ github.workspace }}
- name: Download Foobar2000 SDK
run: |
curl -L https://www.foobar2000.org/files/SDK-2023-09-23.7z -o vendor/foobar2000_sdk.7z
7z x vendor/foobar2000_sdk.7z -ovendor/sdk
ls vendor/sdk
- name: (XCode) Switch XCode Version
run: |
sudo xcode-select --switch /Applications/Xcode_15.3.app
xcodebuild -version
if: matrix.os == 'macos-14'
- name: (XCode) List Scheme
run: |
xcodebuild -list -workspace ${{ matrix.workspace }}
echo Build with scheme: foo_input_ncm-${{ matrix.config }}
if: matrix.os == 'macos-14'
- name: (XCode) Build component bundle
env:
scheme: foo_input_ncm-${{ matrix.config }}
run: |
xcodebuild clean build -workspace ${{ matrix.workspace }} -scheme "$scheme" -configuration ${{ matrix.config }}
if: matrix.os == 'macos-14'
- name: (MSBuild) Setup MSBuild
uses: microsoft/setup-msbuild@v2
if: matrix.os == 'windows-latest'
- name: (MSBuild) Restore NuGet packages
working-directory: ${{ github.workspace }}
run: nuget restore ${{ matrix.solution }}
if: matrix.os == 'windows-latest'
- name: (MSBuild) Build component dll
working-directory: ${{ github.workspace }}
run: msbuild ${{ matrix.solution }} -property:"Configuration=${{ matrix.config }};Platform=${{ matrix.arch}}" -target:foo_input_ncm
if: matrix.os == 'windows-latest'
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.config }}
path: ${{ github.workspace }}/dist
if-no-files-found: error