-
-
Notifications
You must be signed in to change notification settings - Fork 171
185 lines (154 loc) · 5.69 KB
/
ci.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
name: Build
on:
push:
branches:
- 'master'
pull_request:
workflow_dispatch:
jobs:
windows:
name: Windows
runs-on: windows-2022
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up variables
id: vars
run: |
Add-Content $env:GITHUB_OUTPUT "sha_short=$(git rev-parse --short HEAD)"
- name: Append git revision to project version
run: |
(Get-Content version.py) `
-Replace '^__version__\s*=\s*"[^"]+', "`$0.${{ steps.vars.outputs.sha_short }}" |`
Out-File version.py
- name: Set up Python virtual environment
run: |
python3 -m venv env
- name: Install project dependencies
run: |
.\env\Scripts\activate
python3 -m pip install wheel -r requirements.txt
- name: Install UPX
run: |
Invoke-WebRequest -Uri https://github.com/upx/upx/releases/download/v4.0.2/upx-4.0.2-win64.zip -OutFile (Join-Path $env:Temp upx.zip)
Expand-Archive -LiteralPath (Join-Path $env:Temp upx.zip) -DestinationPath $env:Temp
Move-Item -Path (Join-Path $env:Temp upx-*) -Destination (Join-Path $env:Temp upx)
Add-Content $env:GITHUB_PATH (Join-Path $env:Temp upx)
- name: Install PyInstaller
run: |
.\env\Scripts\activate
python3 -m pip install pyinstaller
- name: Create portable executable
run: |
.\env\Scripts\activate
pyinstaller build.spec
- name: Create release folder
run: |
$FolderName = 'Twitch Drops Miner'
New-Item $FolderName -ItemType Directory
Copy-Item dist\*.exe $FolderName
Copy-Item manual.txt $FolderName
Compress-Archive -Path $FolderName -DestinationPath Twitch.Drops.Miner.Windows.zip
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: Twitch.Drops.Miner.Windows
path: Twitch.Drops.Miner.Windows.zip
linux:
name: Linux
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up variables
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}"
- name: Append git revision to project version
run: |
sed -ri "s/^__version__\s*=\s*\"[^\"]+/\0.${{ steps.vars.outputs.sha_short }}/" version.py
# NOTE: We're only use a custom version of Python here because truststore requires at least Python 3.10, but Ubuntu 20.04 has Python 3.8.
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install system dependencies
run: |
sudo apt update
sudo apt install gir1.2-appindicator3-0.1 libgirepository1.0-dev python3-tk
- name: Set up Python virtual environment
run: |
python3 -m venv env
- name: Install project dependencies
run: |
source ./env/bin/activate
python3 -m pip install wheel -r requirements.txt
- name: Install PyInstaller
run: |
source ./env/bin/activate
python3 -m pip install pyinstaller
# NOTE: Remove this step if/once libxft gets updated to 2.3.5 or newer on Ubuntu 20.04, which currently has 2.3.3.
- name: Build a recent version of libXft
run: |
mkdir -p /tmp/libXft
cd /tmp/libXft
curl -L https://xorg.freedesktop.org/releases/individual/lib/libXft-2.3.8.tar.xz -o libXft.tar.xz
tar xvf libXft.tar.xz
cd libXft-*
./configure --prefix=/tmp/libXft --sysconfdir=/etc --disable-static
make
make install-strip
- name: Create portable executable
run: |
source ./env/bin/activate
LD_LIBRARY_PATH=/tmp/libXft/lib xvfb-run --auto-servernum pyinstaller build.spec
- name: Show PyInstaller warnings
run: |
cat build/build/warn-build.txt || true
- name: Create release folder
run: |
folder='Twitch Drops Miner'
mkdir "${folder}"
cp manual.txt dist/* "${folder}"
7z a Twitch.Drops.Miner.Linux.zip "${folder}"
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: Twitch.Drops.Miner.Linux
path: Twitch.Drops.Miner.Linux.zip
update_releases_page:
name: Upload builds to Releases
if: github.event_name != 'pull_request'
needs:
- windows
- linux
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Set up variables
id: vars
run: |
echo "date_now=$(date --rfc-3339=seconds)" >> "${GITHUB_OUTPUT}"
- name: Download build artifacts from previous jobs
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Upload builds to Releases
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: artifacts/*/*
body: |
**This is an automatically generated in-development pre-release version of the application, that includes the latest master branch changes.**
**⚠️ This build is not stable and may end up terminating with a fatal error. ⚠️**
**Use at your own risk.**
- Last build date: `${{ steps.vars.outputs.date_now }}`
- Reference commit: ${{ github.sha }}
name: Development build
prerelease: true
removeArtifacts: true
tag: dev-build