-
Notifications
You must be signed in to change notification settings - Fork 1
233 lines (229 loc) · 8.34 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
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
name: SporeModLoader
on: [push, pull_request]
jobs:
build-msvc:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_x86
- name: Prepare Environment
run: |
$env:revision = git describe --tags --always
echo "GIT_REVISION=$env:revision" >> $env:GITHUB_ENV
- name: Build SporeModLoader (msvc)
run: |
msbuild "SporeModLoader" `
/p:Configuration=Release `
/p:Platform=Win32 `
/m
- name: Build SporeModManager (msvc)
run: |
msbuild "SporeModManager" `
/p:Configuration=Release `
/p:Platform=Win32 `
/m
- name: Package SporeModLoader (msvc)
run: |
New-Item -ItemType Directory -Force -Path bin\SporebinEP1
New-Item -ItemType Directory -Force -Path bin\SporeModLoader\CoreLibs\
New-Item -ItemType Directory -Force -Path bin\SporeModLoader\ModLibs
New-Item -ItemType Directory -Force -Path bin\SporeModLoader\SporeModManager
New-Item -ItemType File -Force -Path bin\SporeModLoader\ModLibs\.keep
Copy "3rdParty\Spore-ModAPI\dll\Release\SporeModAPI.dll" "bin\SporeModLoader\CoreLibs\SporeModAPI.dll"
Copy "3rdParty\Spore-ModAPI-legacy\SporeModAPI-disk.dll" "bin\SporeModLoader\CoreLibs\SporeModAPI-disk.dll"
copy "3rdParty\Spore-ModAPI-legacy\SporeModAPI-steam_patched.dll" "bin\SporeModLoader\CoreLibs\SporeModAPI-steam_patched.dll"
Copy "SporeModLoader\Bin\Release\dinput8.dll" "bin\SporebinEP1\dinput8.dll"
Copy "SporeModManager\Bin\Release\SporeModManager.exe" "bin\SporeModLoader\SporeModManager\SporeModManager.exe"
- name: Upload SporeModLoader (msvc)
uses: actions/upload-artifact@v4
with:
name: msvc-build-artifacts
path: bin/*
build-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Packages
run: |
sudo apt-get -y install libcurl4-gnutls-dev
- name: Prepare Environment
run: |
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Build SporeModManager (Linux)
run: |
make SporeModManager -j$(nproc)
- name: Upload SporeModLoader (Linux for msvc)
uses: actions/upload-artifact@v4
with:
name: linux-build-artifacts
path: bin/*
build-mingw:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Packages
run: |
sudo apt-get -y install gcc-mingw-w64-i686 g++-mingw-w64-i686
- name: Prepare Environment
run: |
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Build SporeModLoader (mingw)
run: |
make SporeModLoader -j$(nproc)
- name: Build SporeModManager (mingw)
run: |
make SporeModManager.exe -j$(nproc)
- name: Upload SporeModLoader (mingw)
uses: actions/upload-artifact@v4
with:
name: mingw-build-artifacts
path: bin/*
package-artifacts:
runs-on: ubuntu-20.04
needs: [ build-msvc, build-linux, build-mingw ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Environment
run: |
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Download msvc-build-artifacts
uses: actions/download-artifact@v4
with:
name: msvc-build-artifacts
path: artifacts
- name: Download linux-build-artifacts
uses: actions/download-artifact@v4
with:
name: linux-build-artifacts
path: artifacts
- name: Download mingw-build-artifacts
uses: actions/download-artifact@v4
with:
name: mingw-build-artifacts
path: mingw-artifacts
- name: Prepare SporeModLoader (mingw)
run: |
cp -r artifacts/SporeModLoader/CoreLibs/ mingw-artifacts/SporeModLoader/CoreLibs
cp -r artifacts/SporeModLoader/ModLibs/ mingw-artifacts/SporeModLoader/ModLibs
cp artifacts/SporeModLoader/SporeModManager/SporeModManager mingw-artifacts/SporeModLoader/SporeModManager/SporeModManager
- name: Upload SporeModLoader (msvc)
uses: actions/upload-artifact@v4
with:
name: SporeModLoader-${{ env.GIT_REVISION }}
path: artifacts/*
compression-level: 9
- name: Upload SporeModLoader (mingw)
uses: actions/upload-artifact@v4
with:
name: SporeModLoader-mingw-${{ env.GIT_REVISION }}
path: mingw-artifacts/*
compression-level: 9
- name: Delete leftover artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: |
msvc-build-artifacts
linux-build-artifacts
mingw-build-artifacts
test-msvc:
runs-on: windows-2022
needs: [ package-artifacts ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Environment
run: |
$env:revision = git describe --tags --always
echo "GIT_REVISION=$env:revision" >> $env:GITHUB_ENV
- name: Download SporeModManager (msvc)
uses: actions/download-artifact@v4
with:
name: SporeModLoader-${{ env.GIT_REVISION }}
path: artifact
- name: Test SporeModManager (msvc)
run: |
python3 ./SporeModManager/test.py ./artifact/SporeModLoader/SporeModManager/SporeModManager.exe
test-linux:
runs-on: ubuntu-20.04
needs: [ package-artifacts ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Environment
run: |
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Download SporeModManager (Linux)
uses: actions/download-artifact@v4
with:
name: SporeModLoader-${{ env.GIT_REVISION }}
path: artifact
- name: Test SporeModManager (Linux)
run: |
chmod +x ./artifact/SporeModLoader/SporeModManager/SporeModManager
python3 ./SporeModManager/test.py ./artifact/SporeModLoader/SporeModManager/SporeModManager
test-mingw:
runs-on: windows-2022
needs: [ package-artifacts ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Environment
run: |
$env:revision = git describe --tags --always
echo "GIT_REVISION=$env:revision" >> $env:GITHUB_ENV
- name: Download SporeModManager (mingw)
uses: actions/download-artifact@v4
with:
name: SporeModLoader-mingw-${{ env.GIT_REVISION }}
path: artifact
- name: Test SporeModManager (mingw)
run: |
python3 ./SporeModManager/test.py ./artifact/SporeModLoader/SporeModManager/SporeModManager.exe
# actions/upload-artifact still doesn't retain
# file permissions, so we'll need to download
# the artifact, mark the linux executable as
# executable, re-archive it (with better compression)
# and then add it to a draft release
create-draft-release:
runs-on: ubuntu-20.04
needs: [ test-msvc, test-linux, test-mingw ]
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Environment
run: |
echo "GIT_REVISION=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Download SporeModManager (msvc)
uses: actions/download-artifact@v4
with:
name: SporeModLoader-${{ env.GIT_REVISION }}
path: artifact
- name: Prepare SporeModManager (msvc)
run: |
pushd artifact
rm SporeModLoader/ModLibs/.keep -f
chmod +x SporeModLoader/SporeModManager/SporeModManager
7za a -mm=Deflate -mx=9 -r "../SporeModLoader-${GIT_REVISION}.zip" *
popd
- name: Create Draft Release
uses: ncipollo/[email protected]
with:
draft: true
makeLatest: true
tag: ${{ env.GIT_REVISION }}
artifacts: SporeModLoader-${{ env.GIT_REVISION }}.zip