-
-
Notifications
You must be signed in to change notification settings - Fork 87
224 lines (188 loc) · 7.29 KB
/
release.yml
File metadata and controls
224 lines (188 loc) · 7.29 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release Version'
required: true
env:
UID_VERSION: v4.0.6
ICE_ADAPTER_VERSION: 3.3.12
BUILD_VERSION: ${{ github.event.inputs.version }}
PYTHON_VERSION: 3.14
ZIG_VERSION: 0.16.0
JAVA_DISTRIBUTION: "oracle"
JAVA_VERSION: 25
jobs:
build-windows:
environment: release
runs-on: windows-latest
outputs:
MSI_SUM: ${{ steps.checksum.outputs.MSI_SUM }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Test with pytest
run: |
python runtests.py -vv --full-trace
- name: Download ICE adapter and UID calculator
run: |
mkdir build_setup
mkdir setup_helpers
Invoke-WebRequest -Uri "https://github.com/FAForever/uid/releases/download/$($env:UID_VERSION)/faf-uid.exe" -OutFile ".\\build_setup\\faf-uid.exe"
Invoke-WebRequest -Uri "https://github.com/FAForever/java-ice-adapter/releases/download/$($env:ICE_ADAPTER_VERSION)/faf-ice-adapter-$($env:ICE_ADAPTER_VERSION)-win.jar" -OutFile ".\\setup_helpers\\faf-ice-adapter.jar"
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Create JRE
run: |
$ICE_ADAPTER_JAVA_MODULES=((jdeps -s "setup_helpers/faf-ice-adapter.jar" | findstr "java" | ForEach-Object { $_.split(" ")[2] }) -join ",")
jlink --add-modules "$ICE_ADAPTER_JAVA_MODULES,jdk.crypto.ec,jdk.unsupported" --strip-debug --no-man-pages --no-header-files --compress "zip-9" --output "build_setup/jre"
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
- name: Build zig library
run: |
$LIBPY = $(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
Write-Host "LIBPY=$LIBPY"
$INCLUDEPY = $(python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")
Write-Host "INCLUDEPY=$INCLUDEPY"
zig build-lib -dynamic -lc -lpython3 -I"$INCLUDEPY" -L"$LIBPY" -O ReleaseFast --name zigfafreplay src/replays/zigparser/zigfafreplay.zig
move zigfafreplay.dll zigfafreplay.pyd
- name: Shrink scipy dependency
run: |
python minimize_scipy.py -d scipy_ndimage
- name: Build application
run: |
python setup.py build
python post_setup.py
- name: Create installer
run: |
ISCC /DWORKING_DIR="build" /DBUILD_VERSION="$env:BUILD_VERSION" win-installer.iss
- name: Calculate checksum
id: checksum
run: |
$MSI_SUM = $(Get-FileHash dist/*).hash
Write-Host $MSI_SUM
echo "MSI_SUM=$MSI_SUM" >> "$env:GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: client-windows
path: dist/*
build-linux:
runs-on: ubuntu-latest
environment: release
outputs:
TAR_SUM: ${{ steps.checksum.outputs.TAR_SUM }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
libxkbcommon-x11-0 \
x11-utils \
libyaml-dev \
libegl1 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libopengl0 \
libxcb-cursor0 \
pulseaudio
python -m pip install -r requirements.txt
python -m pip install pytest-xvfb
- name: Test with pytest
run: |
python runtests.py -vv --full-trace
- name: Download ICE adapter and UID calculator
run: |
mkdir -p build_setup
wget -O build_setup/faf-uid "https://github.com/FAForever/uid/releases/download/$UID_VERSION/faf-uid"
chmod +x build_setup/faf-uid
mkdir -p setup_helpers
wget "https://github.com//FAForever/java-ice-adapter/releases/download/$ICE_ADAPTER_VERSION/faf-ice-adapter-$ICE_ADAPTER_VERSION-win.jar" -O "setup_helpers/faf-ice-adapter.jar"
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Create JRE
run: |
ICE_ADAPTER_JAVA_MODULES=$(jdeps -s setup_helpers/faf-ice-adapter.jar | cut -d' ' -f 3 | grep java | xargs echo | tr ' ' ',')
jlink --add-modules "$ICE_ADAPTER_JAVA_MODULES,jdk.crypto.ec,jdk.unsupported" --strip-debug --no-man-pages --no-header-files --compress "zip-9" --output "build_setup/jre"
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
- name: Build zig library
run: |
LIBPY=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
echo "LIBPY=$LIBPY"
INCLUDEPY=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")
echo "INCLUDEPY=$INCLUDEPY"
zig build-lib -dynamic -lc -lpython$PYTHON_VERSION -I$INCLUDEPY -L$LIBPY -O ReleaseFast --name zigfafreplay src/replays/zigparser/zigfafreplay.zig
mv libzigfafreplay.so zigfafreplay.so
- name: Shrink scipy dependency
run: |
python3 minimize_scipy.py -d scipy_ndimage
- name: Build application
run: |
python3 setup.py build
python3 post_setup.py
tar -C "build" -cvzf "faforever.tar.gz" "faf_python_client"
- name: Calculate checksum
id: checksum
run: |
TAR_SUM=$(echo faforever.tar.gz -n | sha256sum)
echo $TAR_SUM
echo "TAR_SUM=$TAR_SUM" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: client-linux
path: faforever.tar.gz
create-release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download Windows artifact
uses: actions/download-artifact@v6
with:
name: client-windows
path: release-artifacts/
- name: Download Linux artifact
uses: actions/download-artifact@v6
with:
name: client-linux
path: release-artifacts/
- name: Create draft release
id: create_release
uses: ncipollo/release-action@v1.20.0
with:
commit: ${{ github.sha }}
tag: ${{ github.event.inputs.version }}
body: "SHA256 (Windows): ${{ needs.build-windows.outputs.MSI_SUM }}\nSHA256 (Linux): ${{ needs.build-linux.outputs.TAR_SUM }}"
draft: true
prerelease: true
artifacts: "release-artifacts/*"