-
Notifications
You must be signed in to change notification settings - Fork 5
289 lines (267 loc) · 9.94 KB
/
build-test.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
name: 'Test & Build the app'
on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
pull_request:
branches:
- master
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# https://blog.taranissoftware.com/build-net-maui-apps-with-github-actions
jobs:
test-desktop:
runs-on: ubuntu-latest
steps:
# Setup code, .NET and Android
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build --configuration Release BTCPayApp.Server
# Setup infrastructure
- name: Start containers
run: docker compose -f "submodules/btcpayserver/BTCPayServer.Tests/docker-compose.yml" up -d dev
- name: Start BTCPay
run: |
cd submodules/btcpayserver
nohup dotnet run -c Release --project BTCPayServer &
while ! curl -s http://localhost:14142/api/v1/health > /dev/null; do
echo "Waiting for BTCPay Server to start..."
sleep 10
done
# Run tests
- name: Run tests
run: dotnet test -v n --logger "console;verbosity=normal" BTCPayApp.Tests
# Stop infrastructure
build-desktop-win:
runs-on: windows-latest
steps:
# Setup code, .NET and Android
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build win x64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-x64 -c Debug -o publish/win-x64
- name: Build win x86
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-x86 -c Debug -o publish/win-x86
- name: Build win-arm64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-arm64 -c Debug -o publish/win-arm64
- name: Upload artifact win
uses: actions/upload-artifact@v4
with:
name: windows build
path: |
publish/win-x64
publish/win-x86
publish/win-arm64
build-desktop-linux:
runs-on: ubuntu-latest
steps:
# Setup code, .NET and Android
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build linux x64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r linux-x64 -c Debug -o publish/linux-x64
- name: Build linux arm64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r linux-arm64 -c Debug -o publish/linux-arm64
- name: Upload artifact linux
uses: actions/upload-artifact@v4
with:
name: linux build
path: |
publish/linux-x64
publish/linux-arm64
build-desktop-mac:
runs-on: macos-latest
steps:
# Checkout the code
- uses: actions/checkout@v4
with:
submodules: recursive
# Import code-signing certificates
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_CERT_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_CERT_P12_PASS }}
# Verify imported certificates and extract Developer ID
- name: Find Code Signing Certificate
id: find-cert
run: |
CERT_NAME=$(security find-identity -v -p codesigning | grep "Apple Distribution" | awk -F '"Apple Distribution: ' '{print $2}' | awk -F '"' '{print $1}')
if [ -z "$CERT_NAME" ]; then
echo "No valid Apple Distribution certificate found!"
exit 1
fi
echo "Certificate Name: Apple Distribution: $CERT_NAME"
echo "CERT_NAME=Apple Distribution: $CERT_NAME" >> $GITHUB_ENV
# Setup .NET
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Build the app for macOS architectures
- name: Build mac x64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r osx-x64 -c Release -o publish/osx-x64
- name: Build mac arm64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r osx-arm64 -c Release -o publish/osx-arm64
# Create the .app bundle
- name: Create .app bundle for x64
run: |
mkdir -p BTCPayApp_x64.app/Contents/MacOS
cp publish/osx-x64/BTCPayApp.Photino BTCPayApp_x64.app/Contents/MacOS/BTCPayApp
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleExecutable</key>
<string>BTCPayApp</string>
<key>CFBundleIdentifier</key>
<string>com.example.BTCPayApp</string>
<key>CFBundleName</key>
<string>BTCPayApp</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>" > BTCPayApp_x64.app/Contents/Info.plist
- name: Create .app bundle for arm64
run: |
mkdir -p BTCPayApp_arm64.app/Contents/MacOS
cp publish/osx-arm64/BTCPayApp.Photino BTCPayApp_arm64.app/Contents/MacOS/BTCPayApp
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleExecutable</key>
<string>BTCPayApp</string>
<key>CFBundleIdentifier</key>
<string>com.example.BTCPayApp</string>
<key>CFBundleName</key>
<string>BTCPayApp</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>" > BTCPayApp_arm64.app/Contents/Info.plist
# Sign the .app bundles using the dynamic certificate name
- name: Sign x64 .app bundle
run: |
codesign --deep --force --options runtime --sign "$CERT_NAME" BTCPayApp_x64.app
- name: Sign arm64 .app bundle
run: |
codesign --deep --force --options runtime --sign "$CERT_NAME" BTCPayApp_arm64.app
# # Verify the signing
# - name: Verify signing for x64
# run: spctl -a -t exec -vv BTCPayApp_x64.app
#
# - name: Verify signing for arm64
# run: spctl -a -t exec -vv BTCPayApp_arm64.app
#
# Create DMG files
- name: Create DMG for x64
run: |
mkdir -p dist
hdiutil create -volname "BTCPayApp" -srcfolder BTCPayApp_x64.app -ov -format UDZO dist/BTCPayApp_x64.dmg
- name: Create DMG for arm64
run: |
mkdir -p dist
hdiutil create -volname "BTCPayApp" -srcfolder BTCPayApp_arm64.app -ov -format UDZO dist/BTCPayApp_arm64.dmg
# Sign the DMG files
- name: Sign x64 DMG
run: |
codesign --force --sign "$CERT_NAME" dist/BTCPayApp_x64.dmg
- name: Sign arm64 DMG
run: |
codesign --force --sign "$CERT_NAME" dist/BTCPayApp_arm64.dmg
# Verify DMG signing
- name: Verify x64 DMG signing
run: spctl -a -t open --context context:primary-signature -v dist/BTCPayApp_x64.dmg
- name: Verify arm64 DMG signing
run: spctl -a -t open --context context:primary-signature -v dist/BTCPayApp_arm64.dmg
# Upload artifacts
- name: Upload DMG artifacts
uses: actions/upload-artifact@v4
with:
name: mac-dmg
path: dist
build-android:
runs-on: windows-latest
steps:
# Setup code, .NET and Android
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install workloads
run: dotnet workload install maui
- name: Build
run: dotnet publish BTCPayApp.Maui/BTCPayApp.Maui.csproj -f net8.0-android -c Debug -o publish/android
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: android build
path: |
publish/android
#
# build-ios:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Setup Xcode version
# uses: maxim-lobanov/[email protected]
# with:
# xcode-version: 16.0
# - name: Setup .NET
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8.0.x
# - name: Install workloads
# run: dotnet workload install maui
# - name: Import Code-Signing Certificates
# uses: Apple-Actions/import-codesign-certs@v1
# with:
# p12-file-base64: ${{ secrets.APPLE_CERT_P12_BASE64 }}
# p12-password: ${{ secrets.APPLE_CERT_P12_PASS }}
# - name: Download Apple Provisioning Profiles
# uses: Apple-Actions/download-provisioning-profiles@v1
# with:
# bundle-id: ${{ secrets.APPLE_BUNDLE_ID }}
# issuer-id: ${{ secrets.APPLE_ISSUER_ID }}
# api-key-id: ${{ secrets.APPLE_KEY_ID }}
# api-private-key: ${{ secrets.APPLE_KEY }}
# - name: Build
# run: dotnet publish BTCPayApp.Maui/BTCPayApp.Maui.csproj -f net8.0-ios -c Debug -o publish/ios
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: ios build
# path: |
# publish/ios