This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
252 lines (220 loc) · 8.54 KB
/
compile.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
name: Compile
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: setup jdk
uses: actions/setup-java@v1
with:
java-version: 16
- name: configure cmake
run: cmake -B build -DMCPPPP_CLI=TRUE -DMCPPPP_GUI=TRUE -DMCPPPP_JNI=TRUE -DMCPPPP_BUILD_FLTK=TRUE -DMCPPPP_STATIC_LINK=TRUE -DCMAKE_BUILD_TYPE=Release
- name: build cmake
run: cmake --build build --config Release --parallel 16
- name: copy files (windows)
if: ${{ runner.os == 'Windows' }}
run: mkdir artifacts; cp build/bin/Release/* artifacts/
shell: powershell
- name: copy files (linux)
if: ${{ runner.os == 'Linux' }}
run: mkdir artifacts && cp build/bin/* artifacts/ && cp build/libmcpppp.so artifacts/
- name: copy files (mac)
if: ${{ runner.os == 'macOs' }}
run: mkdir artifacts && cp build/libmcpppp.dylib artifacts/
- name: rename files (windows)
if: ${{ runner.os == 'Windows' }}
run: mv artifacts/MCPPPP-gui.exe artifacts/MCPPPP-windows.exe ; mv artifacts/MCPPPP-cli.exe artifacts/MCPPPP-windows-cli.exe
shell: powershell
- name: rename files (linux)
if: ${{ runner.os == 'Linux' }}
run: mv artifacts/MCPPPP-gui artifacts/MCPPPP-linux && mv artifacts/MCPPPP-cli artifacts/MCPPPP-linux-cli
#- name: create .app files (mac only)
- name: zip files (mac only)
if: ${{ runner.os == 'macOs' }}
run: |
#mkdir artifacts/MCPPPP-mac-cli.app
#mkdir artifacts/MCPPPP-mac-cli.app/Contents
#mkdir artifacts/MCPPPP-mac-cli.app/Contents/MacOS
#mkdir artifacts/MCPPPP-mac-cli.app/Contents/Resources
#cp build/bin/MCPPPP-cli artifacts/MCPPPP-mac-cli.app/Contents/MacOS/MCPPPP-cli
#touch artifacts/MCPPPP-mac-cli.app/Contents/MacOS/Info.plist
#
#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>CFBundleDisplayName</key>
# <string>MCPPPP-cli</string>
# <key>CFBundleExecutable</key>
# <string>MCPPPP-cli</string>
# <key>CFBundleIconFile</key>
# <string>resources/mcpppp.png</string>
# <key>CFBundleIdentifier</key>
# <string>com.github.supsm.mcpppp</string>
# <key>CFBundleInfoDictionaryVersion</key>
# <string>6.0</string>
# <key>CFBundleName</key>
# <string>MCPPPP-cli</string>
#</dict>
#</plist>" >> artifacts/MCPPPP-mac-cli.app/Contents/Info.plist
#
#hdiutil create -volname MCPPPP-cli -srcfolder artifacts/MCPPPP-mac-cli.app -ov artifacts/MCPPPP-mac-cli.dmg
#rm -rf artifacts/MCPPPP-mac-cli.app
#
#
#mkdir artifacts/MCPPPP-mac.app
#mkdir artifacts/MCPPPP-mac.app/Contents
#mkdir artifacts/MCPPPP-mac.app/Contents/MacOS
#mkdir artifacts/MCPPPP-mac.app/Contents/Resources
#cp build/bin/MCPPPP-gui artifacts/MCPPPP-mac.app/Contents/MacOS/MCPPPP
#touch artifacts/MCPPPP-mac.app/Contents/MacOS/Info.plist
#
#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>CFBundleDisplayName</key>
# <string>MCPPPP</string>
# <key>CFBundleExecutable</key>
# <string>MCPPPP</string>
# <key>CFBundleIconFile</key>
# <string>resources/mcpppp.png</string>
# <key>CFBundleIdentifier</key>
# <string>com.github.supsm.mcpppp</string>
# <key>CFBundleInfoDictionaryVersion</key>
# <string>6.0</string>
# <key>CFBundleName</key>
# <string>MCPPPP</string>
#</dict>
#</plist>" >> artifacts/MCPPPP-mac.app/Contents/Info.plist
#
#hdiutil create -volname MCPPPP -srcfolder artifacts/MCPPPP-mac.app -ov artifacts/MCPPPP-mac.dmg
#rm -rf artifacts/MCPPPP-mac.app
cp build/bin/MCPPPP-gui artifacts/MCPPPP-mac && cp build/bin/MCPPPP-cli artifacts/MCPPPP-mac-cli
cd artifacts
#chmod +x MCPPPP-mac && chmod +x MCPPPP-mac-cli
zip MCPPPP-mac.zip MCPPPP-mac
zip MCPPPP-mac-cli.zip MCPPPP-mac-cli
cd ..
- name: capture build artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}
path: artifacts/
- name: copy file (windows)
if: ${{ runner.os == 'Windows' }}
uses: supsm/copy_file_to_another_repo@master
env:
API_TOKEN_GITHUB: ${{ secrets.GH_PAT }}
with:
source_file: 'artifacts/mcpppp.dll'
destination_repo: 'supsm/MCPPPP'
destination_branch: 'mod'
destination_folder: 'src/main/resources'
user_email: '[email protected]'
user_name: 'supsm'
commit_message: 'copy windows libraries'
- name: copy file (linux)
if: ${{ runner.os == 'Linux' }}
uses: supsm/copy_file_to_another_repo@master
env:
API_TOKEN_GITHUB: ${{ secrets.GH_PAT }}
with:
source_file: 'artifacts/libmcpppp.so'
destination_repo: 'supsm/MCPPPP'
destination_branch: 'mod'
destination_folder: 'src/main/resources'
user_email: '[email protected]'
user_name: 'supsm'
commit_message: 'copy linux libraries'
- name: copy file (mac)
if: ${{ runner.os == 'macOs' }}
uses: supsm/copy_file_to_another_repo@master
env:
API_TOKEN_GITHUB: ${{ secrets.GH_PAT }}
with:
source_file: 'artifacts/libmcpppp.dylib'
destination_repo: 'supsm/MCPPPP'
destination_branch: 'mod'
destination_folder: 'src/main/resources'
user_email: '[email protected]'
user_name: 'supsm'
commit_message: 'copy mac libraries'
build-linux-arm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo apt update && sudo apt install -y gcc-12-aarch64-linux-gnu g++-12-aarch64-linux-gnu
- name: configure cmake
run: cmake -B build -DMCPPPP_CLI=TRUE -DMCPPPP_GUI=FALSE -DMCPPPP_JNI=FALSE -DMCPPPP_STATIC_LINK=TRUE -DCMAKE_BUILD_TYPE=Release
env:
CC: aarch64-linux-gnu-gcc-12
CXX: aarch64-linux-gnu-g++-12
- name: build cmake
run: cmake --build build
- name: copy files
run: mkdir artifacts && cp build/bin/* artifacts/
- name: rename files
run: mv artifacts/MCPPPP-cli artifacts/MCPPPP-linux-arm-cli
- name: capture build artifacts
uses: actions/upload-artifact@v2
with:
name: Linux-arm
path: artifacts/
build-emscripten:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: setup emsdk (emscripten)
uses: mymindstorm/setup-emsdk@v11
- name: configure cmake
run: emcmake cmake -B build -DMCPPPP_CLI=FALSE -DMCPPPP_GUI=FALSE -DMCPPPP_WEB=TRUE -DMCPPPP_STATIC_LINK=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel
- name: build cmake
run: cmake --build build
- name: copy files
run: mkdir artifacts && cp build/bin/* artifacts/
- name: capture build artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}
path: artifacts/
- name: rename
run: mv artifacts/MCPPPP-web.html artifacts/index.html
- name: copy to github pages
uses: supsm/copy_file_to_another_repo@master
env:
API_TOKEN_GITHUB: ${{ secrets.GH_PAT }}
with:
source_file: 'artifacts/'
use_rsync: 'true'
destination_repo: 'supsm/MCPPPP'
destination_branch: 'pages'
user_email: '[email protected]'
user_name: 'supsm'
commit_message: 'copy web files'
# this is a separate workflow since my thing seems to have issues when used more than once
copy-gradle-properties:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: copy gradle properties
uses: supsm/copy_file_to_another_repo@master
env:
API_TOKEN_GITHUB: ${{ secrets.GH_PAT }}
with:
source_file: 'gradle.properties'
destination_repo: 'supsm/MCPPPP'
destination_branch: 'mod'
user_email: '[email protected]'
user_name: 'supsm'
commit_message: 'copy gradle.properties'