-
-
Notifications
You must be signed in to change notification settings - Fork 19
238 lines (196 loc) · 6.95 KB
/
dotnet-desktop.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
name: 🛠️ .NET Desktop
on:
push:
paths-ignore: [HexEditorStructures/**, Images/**, Core/mbedTLS_AES/**, "README.md", "LICENSE", ".gitignore*", ".github/**/util_*"]
pull_request:
paths-ignore: [HexEditorStructures/**, Images/**, Core/mbedTLS_AES/**, "README.md", "LICENSE", ".gitignore*", ".github/**/util_*"]
# Stop the same workflow actions
concurrency:
group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true
env:
ARTIFACT_PREFIX: GodotPCKExplorer
jobs:
get_version:
name: Get the current version
runs-on: ubuntu-latest
outputs:
version: ${{steps.getversion.outputs.version}}
artifact_name: ${{steps.getversion.outputs.artifact_name}}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: version.txt
- id: getversion
run: |
echo "Version: $(cat version.txt)"
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT
echo "Artifact name: ${{env.ARTIFACT_PREFIX}}_$(cat version.txt)"
echo "artifact_name=${{env.ARTIFACT_PREFIX}}_$(cat version.txt)" >> $GITHUB_OUTPUT
build_debug:
name: Build Framework
needs: get_version
strategy:
fail-fast: false
# For WinForms build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Setup dotnet and cache
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
#cache: true
#cache-dependency-path: '**/packages.lock.json'
- name: Build Explorer
shell: bash
run: |
dotnet build Explorer/UI/GodotPCKExplorer.UI.csproj -c Debug -o bin/Explorer
dotnet build Explorer/UI/GodotPCKExplorer.UI.csproj -c Release -o bin/ExplorerRel
- name: Prepare artifacts
shell: powershell
run: |
Remove-Item bin/ExplorerRel/* -Recurse -Include *.exp,*.lib,*.pdb -Force
- name: Upload Debug artifact
uses: actions/upload-artifact@v4
with:
name: ${{env.ARTIFACT_PREFIX}}_Debug
path: bin/Explorer
- name: Upload Release artifact
uses: actions/upload-artifact@v4
with:
name: ${{needs.get_version.outputs.artifact_name}}_dotnet-ui-console-win-linux-mac
path: bin/ExplorerRel
- name: Build Bruteforcer
run: |
dotnet build Bruteforcer/UI/PCKBruteforcer.UI.csproj -o bin/Bruteforcer
publish_folder:
name: Publish Folder
needs: get_version
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Setup dotnet and cache
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Publish
shell: bash
run: |
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=Win64 -o publish/Win64
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=Win86 -o publish/Win86
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=Linux64 -o publish/Linux64
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=Mac64 -o publish/Mac64
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=MacArm -o publish/MacArm
- name: Prepare artifacts
shell: bash
run: |
find publish/ -type f \( -name "*.exp" -o -name "*.lib" -o -name "*.pdb" \) -exec rm -f {} +
cleanup_mbedtls() {
echo "mbedTLS cleanup is started in $1 for $2."
working_dir="$1"
keep_dir="$2"
base_dir="mbedTLS"
pushd "$working_dir" > /dev/null
if [ ! -d "$base_dir/$keep_dir" ]; then
echo "Folder '$keep_dir' not found in '$base_dir'."
return 1
fi
for dir in "$base_dir"/*; do
if [ -d "$dir" ] && [ "$(basename "$dir")" != "$keep_dir" ]; then
echo "Removing: $dir"
rm -rf "$dir"
fi
done
popd > /dev/null
echo "mbedTLS cleanup is complete."
echo ""
}
cleanup_mbedtls "publish/Win64" "win_x64"
cleanup_mbedtls "publish/Win86" "win_x86"
cleanup_mbedtls "publish/Linux64" "linux_x64"
cleanup_mbedtls "publish/Mac64" "mac_universal"
cleanup_mbedtls "publish/MacArm" "mac_universal"
- name: Upload Win64
uses: actions/upload-artifact@v4
with:
name: ${{needs.get_version.outputs.artifact_name}}_native-console-win-64
path: publish/Win64
- name: Upload Win86
uses: actions/upload-artifact@v4
with:
name: ${{needs.get_version.outputs.artifact_name}}_native-console-win-86
path: publish/Win86
- name: Upload Linux64
uses: actions/upload-artifact@v4
with:
name: ${{needs.get_version.outputs.artifact_name}}_native-console-linux-64
path: publish/Linux64
- name: Upload Temp Mac64
uses: actions/upload-artifact@v4
with:
name: thin_mac_64
path: publish/Mac64
- name: Upload Temp MacArm
uses: actions/upload-artifact@v4
with:
name: thin_mac_arm
path: publish/MacArm
fat_mac:
name: Fat macOS
needs:
- publish_folder
- get_version
strategy:
fail-fast: false
runs-on: macos-latest
steps:
- name: Download macOS Thin bins x64
uses: actions/download-artifact@v4
with:
path: publish/Mac64
name: thin_mac_64
- name: Download macOS Thin bins arm64
uses: actions/download-artifact@v4
with:
path: publish/MacArm
name: thin_mac_arm
- name: Combine
shell: bash
run: |
mkdir publish/MacUniversal
bin_name="${{env.ARTIFACT_PREFIX}}.Console"
lipo -create -output publish/MacUniversal/$bin_name publish/Mac64/$bin_name publish/MacArm/$bin_name
file publish/MacUniversal/$bin_name
cp -rf publish/Mac64/mbedTLS publish/MacUniversal/mbedTLS
- name: Upload MacUniversal
uses: actions/upload-artifact@v4
with:
name: ${{needs.get_version.outputs.artifact_name}}_native-console-mac-universal
path: publish/MacUniversal
tests:
name: Tests
#needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Setup dotnet and cache
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Run unit tests
shell: bash
run: dotnet test Tests -p:Parallel=0