-
-
Notifications
You must be signed in to change notification settings - Fork 34
177 lines (144 loc) · 5.74 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
name: Build and Release
on: workflow_dispatch
permissions: write-all
jobs:
Windows:
strategy:
fail-fast: false
matrix:
os:
- windows-latest
architecture:
- x64
- x86
runs-on: ${{ matrix.os }}
steps:
- name: Check-out repository
uses: actions/checkout@v3
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8.10'
cache: 'pip,PyQt5,psutil,requests,aria2p,ordered-set,imageio,nuitka'
- name: Update Pip and Uninstall Useless Dependencies
shell: pwsh
run: |
python -m pip install tomli
python Tools/gen-requirements.py
python -m pip install --upgrade pip
python -m pip install -U -r requirements.txt
python -m pip uninstall numpy -y
python -m pip uninstall scipy -y
python -m pip uninstall pyqt5-stubs -y
- name: Build on Windows
run: |
python Tools/update-pyproject.py
python -m lndl_nuitka . -y
- name: Delete Useless Files and Compress with upx
shell: pwsh
run: |
Remove-Item -Force -Recurse .\build\MCSL2.dist\zstandard
Remove-Item -Force -Recurse .\build\MCSL2.dist\_asyncio.pyd
Remove-Item -Force -Recurse .\build\MCSL2.dist\pyexpat.pyd
Remove-Item -Force -Recurse .\build\MCSL2.dist\qt5qml.dll
Remove-Item -Force -Recurse .\build\MCSL2.dist\qt5qmlmodels.dll
Remove-Item -Force -Recurse .\build\MCSL2.dist\qt5quick.dll
.\upx.exe -9 build/MCSL2.dist/_ctypes.pyd build/MCSL2.dist/_decimal.pyd build/MCSL2.dist/_elementtree.pyd build/MCSL2.dist/_lzma.pyd build/MCSL2.dist/_overlapped.pyd build/MCSL2.dist/_socket.pyd build/MCSL2.dist/_ssl.pyd build/MCSL2.dist/_win32sysloader.pyd build/MCSL2.dist/libffi-7.dll build/MCSL2.dist/libcrypto-1_1.dll build/MCSL2.dist/libssl-1_1.dll build/MCSL2.dist/MCSL2.exe build/MCSL2.dist/python38.dll build/MCSL2.dist/pythoncom38.dll build/MCSL2.dist/pywintypes38.dll build/MCSL2.dist/qt5core.dll build/MCSL2.dist/qt5dbus.dll build/MCSL2.dist/qt5gui.dll build/MCSL2.dist/qt5multimedia.dll build/MCSL2.dist/qt5network.dll build/MCSL2.dist/qt5printsupport.dll build/MCSL2.dist/qt5svg.dll build/MCSL2.dist/qt5websockets.dll build/MCSL2.dist/qt5widgets.dll build/MCSL2.dist/qt5xml.dll build/MCSL2.dist/select.pyd build/MCSL2.dist/unicodedata.pyd build/MCSL2.dist/win32api.pyd build/MCSL2.dist/win32gui.pyd build/MCSL2.dist/win32print.pyd
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: MCSL2-${{ runner.os }}-${{ matrix.architecture }}
path: |
build/MCSL2.dist/**/*
Linux:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
architecture:
- x64
- x86
runs-on: ${{ matrix.os }}
steps:
- name: Check-out repository
uses: actions/checkout@v3
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8.10'
cache: 'pip,PyQt5,psutil,requests,aria2p,ordered-set,imageio,nuitka'
- name: Update Pip and Uninstall Useless Dependencies
shell: pwsh
run: |
python -m pip install tomli
python Tools/gen-requirements.py
python -m pip install --upgrade pip
python -m pip install -U -r requirements.txt
python -m pip uninstall numpy -y
python -m pip uninstall scipy -y
python -m pip uninstall pyqt5-stubs -y
- name: Install Dependencies for Linux
run: |
sudo apt-get install -y libfuse2
sudo apt-get install -y upx-ucl
- name: Build on Linux
run: |
python Tools/update-pyproject.py
python -m lndl_nuitka . -y
- name: Delete Useless Files and Compress with upx
run: |
cd build
cd MCSL2.dist
rm -r zstandard
sudo rm libQt5Quick.so.5
sudo rm libQt5Qml.so.5
sudo rm libQt5QmlModels.so.5
sudo rm _asyncio.so
sudo rm _multiprocessing.so
sudo rm _queue.so
upx -9 MCSL2.bin
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: MCSL2-${{ runner.os }}-${{ matrix.architecture }}
path: |
build/MCSL2.dist/**/*
Release:
runs-on: ubuntu-latest
needs:
- Windows
- Linux
steps:
- uses: szenius/[email protected]
with:
timezoneLinux: 'Asia/Shanghai'
- name: Install Tools
run: sudo apt install p7zip-full -y
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Check-out repository
uses: actions/checkout@v3
with:
path: repo
- name: Set Environment Variable
run: |
mcsl2_version=$(python -c "from MCSL2Lib import MCSL2VERSION; print(MCSL2VERSION)")
echo "MCSL2_VERSION=$mcsl2_version" >> $GITHUB_ENV
- name: Compress Artifacts
run: |
7z a -tzip "MCSL2-${{ env.MCSL2_VERSION }}-Windows-x64.zip" "./MCSL2-Windows-x64/*"
7z a -tzip "MCSL2-${{ env.MCSL2_VERSION }}-Windows-x86.zip" "./MCSL2-Windows-x86/*"
7z a -tzip "MCSL2-${{ env.MCSL2_VERSION }}-Linux-x64.zip" "./MCSL2-Linux-x64/*"
7z a -tzip "MCSL2-${{ env.MCSL2_VERSION }}-Linux-x86.zip" "./MCSL2-Linux-x86/*"
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: ./repo/ChangeLog.md
prerelease: false
draft: false
tag_name: v${{ env.MCSL2_VERSION }}
files: |
*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}