-
Notifications
You must be signed in to change notification settings - Fork 38
88 lines (74 loc) · 2.82 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
name: Build tor-relay-scanner
on:
push:
paths:
- 'src/**'
workflow_dispatch:
env:
PYTHON_URL: https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe
PYTHON_NAME: python-3.8.10.exe
PYTHON_SHA256: ad07633a1f0cd795f3bf9da33729f662281df196b4567fa795829f3bb38a30ac
WINEARCH: win32
jobs:
build_linux:
name: Build Python pyz file
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Declare short commit variable
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build pyz file
run: |
./build.sh
mv torparse.pyz tor-relay-scanner-${{ steps.vars.outputs.sha_short }}.pyz
- name: Upload output file x86
uses: actions/upload-artifact@v3
with:
name: tor-relay-scanner-${{ steps.vars.outputs.sha_short }}.pyz
path: tor-relay-scanner-${{ steps.vars.outputs.sha_short }}.pyz
build_windows:
name: Build Windows exe file
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Declare short commit variable
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Install Wine
run: >
sudo rm /var/lib/man-db/auto-update &&
sudo sed -i 's/yes/no/g' /etc/initramfs-tools/update-initramfs.conf &&
sudo apt-add-repository -y ppa:ondrej/php &&
sudo eatmydata apt install ppa-purge &&
sudo eatmydata ppa-purge -y ppa:ondrej/php &&
sudo dpkg --add-architecture i386 && sudo apt update &&
sudo DEBIAN_FRONTEND=noninteractive eatmydata
apt install -y --no-install-recommends wine-stable wine32 xvfb
- name: Download Python from cache
id: python-cache
uses: actions/cache@v3
with:
path: ${{ env. PYTHON_NAME }}
key: ${{ env. PYTHON_SHA256 }}
- name: Download Python from the website
if: steps.python-cache.outputs.cache-hit != 'true'
run: >
wget ${{ env. PYTHON_URL }} &&
(echo ${{ env. PYTHON_SHA256 }} ${{ env. PYTHON_NAME }} | sha256sum -c)
- name: Install Python and dependencies (Windows)
run: |
xvfb-run wine ${{ env. PYTHON_NAME }} /quiet InstallAllUsers=1 PrependPath=1
wine pip install .
wine pip install pyinstaller
- name: Build exe file for Windows
run: |
wine pyinstaller -c -F src/tor_relay_scanner/__main__.py
mv dist/__main__.exe tor-relay-scanner-${{ steps.vars.outputs.sha_short }}.exe
- name: Upload output file
uses: actions/upload-artifact@v3
with:
name: tor-relay-scanner-${{ steps.vars.outputs.sha_short }}.exe
path: tor-relay-scanner-${{ steps.vars.outputs.sha_short }}.exe