-
-
Notifications
You must be signed in to change notification settings - Fork 3
276 lines (230 loc) · 9.59 KB
/
Copy pathci-build.yml
File metadata and controls
276 lines (230 loc) · 9.59 KB
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
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
types: [ opened, reopened, synchronize ]
workflow_call:
inputs:
platforms:
description: 'Platforms to build for'
required: false
type: string
latest:
description: 'Tag image as latest'
required: false
type: boolean
default: false
rc:
description: 'Tag image as rc'
required: false
type: boolean
default: false
workflow_dispatch:
name: ci-build
permissions:
contents: read
actions: write
packages: write
env:
DOTNET_VERSION: 10.0.x
REGISTRY: ghcr.io
jobs:
test-module-loader:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup .NET SDK ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ matrix.os }}-tests-nuget-${{ hashFiles('**/*.csproj', 'Directory.Packages.props') }}
restore-keys: |
${{ matrix.os }}-tests-nuget-
- name: Run module loader tests
# TUnit ships its own runner via Microsoft.Testing.Platform; the test project is
# an Exe. `dotnet run` invokes that runner directly and works on net10 without the
# legacy VSTest bridge.
run: dotnet run --project Desktop.ModuleManager.Tests/Desktop.ModuleManager.Tests.csproj -c Release -- --report-trx --report-trx-filename test-results.trx --results-directory ${{ github.workspace }}/test-results
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: module-loader-test-results-${{ matrix.os }}
path: ${{ github.workspace }}/test-results
if-no-files-found: ignore
build-windows-maui:
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup .NET SDK ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install maui workload for windows
run: dotnet workload install maui-windows
- name: Cache NuGet packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.nuget/packages
key: windows-maui-nuget
restore-keys: |
windows-maui-nuget
- name: Publish OpenShock Desktop Windows
run: dotnet publish Desktop/Desktop.csproj -c Release-Windows -o ./publish/Windows-Maui
- name: Upload OpenShock Desktop Windows artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: OpenShock Desktop Windows MAUI
path: publish/Windows-Maui/*
retention-days: 1
if-no-files-found: error
installer-windows-maui:
runs-on: windows-latest
needs: build-windows-maui
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
sparse-checkout: |
Installer
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: OpenShock Desktop Windows MAUI
path: publish/
- name: Install NSIS
run: choco install nsis -y
- name: Create nsis installer
uses: joncloud/makensis-action@971ef20f43e4f9f3af2c7f276cb7348d033da1cd # v5.0
with:
script-file: ${{ github.workspace }}/Installer/installer.nsi
additional-plugin-paths: ${{ github.workspace }}/Installer/Plugins
- name: Upload OpenShock Desktop Windows Setup
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: OpenShock_Desktop_Setup
path: Installer/OpenShock_Desktop_Setup.exe
retention-days: 7
if-no-files-found: error
build-linux-web-containers:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Log in to Container Registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/desktop
flavor: |
latest=false
tags: |
type=raw,value={{branch}},enable=${{ github.ref_type == 'branch' && github.event_name != 'pull_request' }}
type=raw,value=latest,enable=${{ github.event_name == 'workflow_call' && (inputs.latest || false) }}
type=raw,value=rc,enable=${{ github.event_name == 'workflow_call' && (inputs.rc || false) }}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Build and push
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: .
file: Dockerfile
push: ${{ (inputs.latest || inputs.rc) || (github.ref_protected && github.event_name != 'pull_request') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ inputs.platforms || 'linux/amd64' }}
cache-from: |
type=gha
cache-to: |
type=gha
build-linux-photino:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup .NET SDK ${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.nuget/packages
key: linux-photino-nuget
restore-keys: |
linux-photino-nuget
- name: Publish OpenShock Photino
run: dotnet publish Desktop/Desktop.csproj -c Release-Photino -o ./publish/Photino-Linux
- name: Upload OpenShock Desktop Photino Linux artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: OpenShock Desktop Photino Linux
path: publish/Photino-Linux/*
retention-days: 7
if-no-files-found: error
- name: Build AppImage
run: |
set -euo pipefail
ARCH=x86_64
APPDIR=AppDir
# Download appimagetool, pinned to a tagged release and verified by checksum
# (runs without FUSE via --appimage-extract-and-run).
APPIMAGETOOL_VERSION=1.9.1
APPIMAGETOOL_SHA256=ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0
curl -fsSL -o appimagetool \
"https://github.com/AppImage/appimagetool/releases/download/${APPIMAGETOOL_VERSION}/appimagetool-${ARCH}.AppImage"
echo "${APPIMAGETOOL_SHA256} appimagetool" | sha256sum -c -
chmod +x appimagetool
# Assemble the AppDir from committed assets + the published self-contained app
rm -rf "${APPDIR}"
mkdir -p "${APPDIR}/usr/bin" \
"${APPDIR}/usr/share/applications" \
"${APPDIR}/usr/share/icons/hicolor/512x512/apps"
cp -r publish/Photino-Linux/. "${APPDIR}/usr/bin/"
install -m 0755 packaging/appimage/AppRun "${APPDIR}/AppRun"
install -m 0644 packaging/appimage/OpenShock.Desktop.desktop \
"${APPDIR}/usr/share/applications/OpenShock.Desktop.desktop"
cp packaging/appimage/OpenShock.Desktop.desktop "${APPDIR}/OpenShock.Desktop.desktop"
install -m 0644 Desktop/wwwroot/images/Icon512.png \
"${APPDIR}/usr/share/icons/hicolor/512x512/apps/openshock-desktop.png"
cp Desktop/wwwroot/images/Icon512.png "${APPDIR}/openshock-desktop.png"
# The published binary needs to be executable
chmod +x "${APPDIR}/usr/bin/OpenShock.Desktop"
ARCH="${ARCH}" ./appimagetool --appimage-extract-and-run \
"${APPDIR}" "OpenShock_Desktop-${ARCH}.AppImage"
- name: Upload OpenShock Desktop AppImage
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: OpenShock Desktop AppImage
path: OpenShock_Desktop-*.AppImage
retention-days: 7
if-no-files-found: error