-
Notifications
You must be signed in to change notification settings - Fork 126
203 lines (171 loc) · 6.85 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: Build Mesen
on: [push]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
jobs:
windows:
strategy:
matrix:
platform: [
{netversion: 6.x, targetframework: net6.0, aot: false, singleFile: true, aotString: ""},
{netversion: 8.x, targetframework: net8.0, aot: false, singleFile: true, aotString: ""},
{netversion: 8.x, targetframework: net8.0, aot: true, singleFile: false, aotString: " - AoT"}
]
fail-fast: false
runs-on: windows-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.platform.netversion }}
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
- name: Restore packages
run: dotnet restore -p:TargetFramework="${{ matrix.platform.targetframework }}" -r win-x64 -p:PublishAot="${{ matrix.platform.aot }}"
- name: Build Mesen
run: msbuild -nologo -v:d -clp:ForceConsoleColor -m -p:Configuration=Release -p:Platform=x64 -t:Clean,UI -p:TargetFramework="${{ matrix.platform.targetframework }}"
- name: Publish Mesen
run: dotnet publish --no-restore -c Release -p:PublishAot="${{ matrix.platform.aot }}" -p:SelfContained="${{ matrix.platform.aot }}" -p:PublishSingleFile="${{ matrix.platform.singleFile }}" -p:OptimizeUi="true" -p:Platform="Any CPU" -p:TargetFramework="${{ matrix.platform.targetframework }}" -r win-x64 Mesen.sln /p:PublishProfile=UI\Properties\PublishProfiles\Release.pubxml
- name: Upload Mesen
uses: actions/upload-artifact@v4
with:
name: Mesen (Windows - ${{ matrix.platform.targetframework }}${{ matrix.platform.aotString }})
path: |
build/TmpReleaseBuild/Mesen.exe
linux:
strategy:
matrix:
compiler: [gcc, clang, clang_aot]
os: [ubuntu-22.04, ubuntu-20.04]
exclude:
# This currently fails to build.
- os: ubuntu-20.04
compiler: gcc
# Don't need 2 separate AoT builds
- os: ubuntu-22.04
compiler: clang_aot
include:
- compiler: gcc
make_flags: "USE_GCC=true"
- compiler: clang
make_flags: ""
- compiler: clang_aot
make_flags: "USE_AOT=true"
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Install dependencies
run: |
sudo apt-get update -qy
sudo apt-get install -qy libsdl2-dev # The compilers are already installed on GitHub's runners.
# stderr is not detected as a TTY, so diagnostics are by default printed without colours;
# forcing colours makes the log a little nicer to read.
- name: Build Mesen
run: |
make -j$(nproc) -O ${{ matrix.make_flags }} LTO=true STATICLINK=true SYSTEM_LIBEVDEV=false
- name: Upload Mesen
uses: actions/upload-artifact@v4
with:
name: Mesen (Linux - ${{ matrix.os }} - ${{ matrix.compiler }})
path: bin/linux-x64/Release/linux-x64/publish/Mesen
appimage:
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Install dependencies
run: |
sudo apt-get update -qy
sudo apt-get install -qy libsdl2-dev libfuse2 # The compilers are already installed on GitHub's runners.
- name: Build Mesen (AppImage)
run: |
Linux/appimage/appimage.sh
- name: Upload Mesen (AppImage)
uses: actions/upload-artifact@v4
with:
name: Mesen (Linux x64 - AppImage)
path: Mesen.AppImage
macos:
strategy:
matrix:
compiler: [clang, clang_aot]
platform: [
{os: macos-12, arch: x64},
{os: macos-14, arch: arm64}
]
include:
- compiler: clang
make_flags: ""
- compiler: clang_aot
make_flags: "USE_AOT=true"
fail-fast: false
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Install dependencies
run: |
brew install sdl2
# stderr is not detected as a TTY, so diagnostics are by default printed without colours;
# forcing colours makes the log a little nicer to read.
- name: Build Mesen
run: |
${{ matrix.make_flags }} make -j$(sysctl -n hw.logicalcpu)
- name: Sign binary
env:
APP_NAME: bin/osx-${{ matrix.platform.arch }}/Release/osx-${{ matrix.platform.arch }}/publish/Mesen.app
CERT_DATA: ${{ secrets.MACOS_CERTIFICATE }}
CERT_PASS: ${{ secrets.MACOS_CERTIFICATE_PWD }}
ENTITLEMENTS: UI/Mesen.entitlements
SIGNING_IDENTITY: Mesen
run: |
# Export certs
echo "$CERT_DATA" | base64 --decode > /tmp/certs.p12
# Create keychain
security create-keychain -p actions macos-build.keychain
security default-keychain -s macos-build.keychain
security unlock-keychain -p actions macos-build.keychain
security set-keychain-settings -t 3600 -u macos-build.keychain
# Import certs to keychain
security import /tmp/certs.p12 -k ~/Library/Keychains/macos-build.keychain -P "$CERT_PASS" -T /usr/bin/codesign -T /usr/bin/productsign
# Key signing
security set-key-partition-list -S apple-tool:,apple: -s -k actions macos-build.keychain
# print identities
security find-identity -v macos-build.keychain
echo "[INFO] Signing app file"
codesign --force --deep --timestamp --keychain macos-build.keychain --options=runtime --entitlements "$ENTITLEMENTS" --sign "$SIGNING_IDENTITY" "$APP_NAME"
- name: Zip Mesen.app
run: |
ditto -c -k --sequesterRsrc --keepParent bin/osx-${{ matrix.platform.arch }}/Release/osx-${{ matrix.platform.arch }}/publish/Mesen.app bin/osx-${{ matrix.platform.arch }}/Release/Mesen.app.zip
- name: Upload Mesen
uses: actions/upload-artifact@v4
with:
name: Mesen (macOS - ${{ matrix.platform.os }} - ${{ matrix.compiler }})
path: bin/osx-${{ matrix.platform.arch }}/Release/Mesen.app.zip