forked from Tribler/tribler
-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (184 loc) · 7.52 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
name: Build
on: workflow_dispatch
jobs:
build:
strategy:
matrix:
include: # macos-12 is no longer on GitHub Actions, we use the Mac mini for this
- os: ubuntu-latest
architecture: x64
- os: ubuntu-latest
architecture: aarch64
- os: windows-latest
architecture: x86
- os: windows-latest
architecture: x64
runs-on: ${{ matrix.os }}
steps:
########################################
# NSIS installer (Windows, always x86) #
########################################
- name: Check out SimpleFC repository (Windows)
if: matrix.os == 'windows-latest'
uses: actions/checkout@v4
with:
repository: mazinsw/SimpleFC
- name: Build SimpleFC NSIS Plugin (Windows)
if: matrix.os == 'windows-latest'
run: |
copy "bin\x86-unicode\SimpleFC.dll" "C:\Program Files (x86)\NSIS\Plugins\x86-unicode\SimpleFC.dll"
- name: Check out nsProcess repository (Windows)
if: matrix.os == 'windows-latest'
uses: actions/checkout@v4
with:
repository: simdsoft/nsProcess
submodules: 'true'
- name: Add msbuild to PATH (Windows)
if: matrix.os == 'windows-latest'
uses: microsoft/setup-msbuild@v2
- name: Build nsProcess NSIS Plugin (Windows)
if: matrix.os == 'windows-latest'
run: |
cd nsProcess
msbuild nsProcess.vcxproj /p:PlatformToolset=v143 /p:Configuration="Release UNICODE"
copy "Release UNICODE\nsProcess.dll" "C:\Program Files (x86)\NSIS\Plugins\x86-unicode\nsProcess.dll"
cd ../Include
copy nsProcess.nsh "C:\Program Files (x86)\NSIS\Include\nsProcess.nsh"
#######################
# Package preparation #
#######################
- name: Check-out repository
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-tags: 'true'
- name: Remove test files
shell: bash
run: |
rm -rf doc
rm -rf scripts
rm src/run_unit_tests.py
rm -rf src/tribler/test_integration
rm -rf src/tribler/test_unit
rm -rf pyipv8/.github
rm pyipv8/.gitignore
rm pyipv8/.gitmodules
rm pyipv8/.readthedocs.yaml
rm pyipv8/.ruff.toml
rm pyipv8/*.md
rm pyipv8/*.ini
rm pyipv8/create_setup_taskmanager.py
rm pyipv8/create_test_coverage_report.py
rm pyipv8/github_increment_version.py
rm pyipv8/run_all_tests.py
rm pyipv8/setup.py
rm -rf pyipv8/doc
rm -rf pyipv8/scripts
rm -rf pyipv8/stresstest
rm -rf pyipv8/systemd
rm -rf pyipv8/ipv8/test
- name: Setup Python ${{ matrix.architecture }}
if: matrix.architecture != 'aarch64'
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: ${{ matrix.architecture }}
cache: 'pip'
cache-dependency-path: |
**/build/requirements.txt
- name: Install Dependencies
if: matrix.architecture != 'aarch64'
run: |
pip install --upgrade -r build/requirements.txt
- name: Setup npm
uses: actions/setup-node@v4
- name: Build npm
shell: bash
run: |
cd src/tribler/ui/
npm install
npm run build
rm -rf node_modules
- name: Determine release tag
shell: bash
run: |
git fetch --tags
git for-each-ref --count=1 --sort=-creatordate --format '%(refname)' refs/tags > raw_tag.txt
GITHUB_TAG=$(git name-rev --tags --name-only $(cat raw_tag.txt))
echo "GITHUB_TAG=${GITHUB_TAG#v}" >> $GITHUB_ENV
#####################
# Individual builds #
#####################
- name: Build Executables (Ubuntu x64)
if: matrix.os == 'ubuntu-latest' && matrix.architecture == 'x64'
run: |
sudo apt-get install -y --allow-downgrades alien cpio=2.13+dfsg-7 devscripts fakeroot gir1.2-gtk-4.0 libgirepository1.0-dev rpm
./build/debian/makedist_debian.sh
mv build/debian/tribler_${GITHUB_TAG}_all.deb build/debian/tribler_${GITHUB_TAG}_${{ matrix.architecture }}.deb
- name: Build Executables (Ubuntu aarch64)
if: matrix.os == 'ubuntu-latest' && matrix.architecture == 'aarch64'
uses: uraimo/run-on-arch-action@v2
id: run_ubuntu_aarch64
with:
arch: ${{ matrix.architecture }}
distro: ubuntu22.04
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${PWD}:/tribler"
env: |
GITHUB_TAG: ${{ env.GITHUB_TAG }}
shell: /bin/sh
install: |
apt-get update -q -y
apt-get install -q -y --allow-downgrades alien cpio=2.13+dfsg-7 devscripts fakeroot gir1.2-gtk-4.0 libgirepository1.0-dev rpm python3-pip libcairo2-dev
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade -r /tribler/build/requirements.txt
python3 -m pip install meson ninja
cd /tribler
python3 -m pip install --upgrade cx_Freeze==7.2.3 # cx_Freeze workaround
cp /lib/${{ matrix.architecture }}-linux-gnu/libcrypt.so.1 libcrypt-06cd74a6.so.2 # cx_Freeze workaround
export PATH="/usr/local/bin:$PATH"
./build/debian/makedist_debian.sh
cd build/debian
apt-get install -y --fix-broken ./tribler_${GITHUB_TAG}_all.deb
timeout 10s tribler -s || true
cat /tmp/*tribler*.log
mv tribler_${GITHUB_TAG}_all.deb tribler_${GITHUB_TAG}_${{ matrix.architecture }}.deb
- name: Build Executables (MacOS-12)
if: matrix.os == 'macos-12'
run: |
mv ./build/tribler.spec ./tribler.spec
./build/mac/makedist_macos.sh
- name: Fetch libsodium.dll (Windows)
if: matrix.os == 'windows-latest'
run: |
vcpkg install libsodium:${{ matrix.architecture }}-windows
Copy C:/vcpkg/packages/libsodium_${{ matrix.architecture }}-windows/bin/libsodium.dll src/libsodium.dll
- name: Install OpenSSL (Windows, x86)
if: ${{ matrix.os == 'windows-latest' && matrix.architecture == 'x86'}}
run: |
Remove-Item -Path "C:\Program Files\OpenSSL" -Force -Recurse
vcpkg install openssl:x86-windows
New-Item -Path "C:\Program Files\OpenSSL" -ItemType SymbolicLink -Value "C:\vcpkg\packages\openssl_x86-windows\"
- name: Build Executables (Windows)
if: matrix.os == 'windows-latest'
run: |
(gc build/win/resources/tribler.nsi) -replace '!define BITVERSION "x86"', '!define BITVERSION "${{ matrix.architecture }}"' | Out-File -encoding ASCII build/win/resources/tribler.nsi
./build/win/makedist_win.bat
echo 'Double-check executable architectures'
echo '> Should be "${{ matrix.architecture }}"'
7z l ./dist/tribler/tribler.exe | findstr CPU
echo '> Should be "x86"'
7z l ./dist/*.exe | findstr CPU
################################
# Cleanup and artifact uploads #
################################
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }} ${{ matrix.architecture }} Build
path: |
dist/*.exe
dist/*.dmg
build/debian/*.deb