-
Notifications
You must be signed in to change notification settings - Fork 5
227 lines (194 loc) · 8.82 KB
/
push-github-action.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
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
225
226
227
name: push-github-action
on: [push, pull_request]
jobs:
build-macos:
strategy:
matrix:
os:
# NOTE: Earliest macOS supported by Crystal is macOS 10.14
#- macos-10.14 # no longer supported by GitHub Actions
#- macos-10.15 # no longer supported by GitHub Actions
#- macos-11
#- macos-12 # same as macos-latest as of 2023-03-22
- macos-latest
python-version: ["3.8", "3.9"]
runs-on: ${{ matrix.os }}
timeout-minutes: 10 # normally takes 4 min, as of 2023-03-03
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Poetry
# NOTE: Poetry 1.5.0 cannot use "poetry run" to run make-mac.sh
run: pipx install "poetry>=1.4.0,<1.5.0"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies with Poetry
# If build takes a very long time, then it's likely that the version
# of wxPython installed does not offer a precompiled wheel for this
# version of Python. Check the wxPython PyPI page to confirm.
timeout-minutes: 2 # normally takes 6s, as of 2023-03-03
run: poetry install
- name: Display SQLite version and JSON support
run: |
python3 -c "import sqlite3; print('SQLite %s' % sqlite3.sqlite_version)"
poetry run python -c "from crystal.util.xsqlite3 import sqlite_has_json_support; print('JSON Support: ' + ('yes' if sqlite_has_json_support else 'NO'))"
- name: Run non-UI tests
run: poetry run python -m pytest
- name: Build .app and disk image
working-directory: "./setup"
run: "poetry run ./make-mac.sh"
- name: Run UI tests
run: |
CRYSTAL_SCREENSHOTS_DIRPATH=$GITHUB_WORKSPACE/screenshots "setup/dist/Crystal Web Archiver.app/Contents/MacOS/Crystal Web Archiver" --test
- name: Upload screenshot if test failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: screenshots
path: screenshots
if-no-files-found: ignore
- name: Upload distribution artifact
# Only export distribution artifact for earliest supported Python and OS
if: (matrix.python-version == '3.8') && (matrix.os == 'macos-10.14')
uses: actions/upload-artifact@v3
with:
name: dist-mac
path: setup/dist-mac/*.dmg
if-no-files-found: warn
build-linux:
strategy:
matrix:
os:
# NOTE: Earliest Linux supported by Crystal is Ubuntu 22.04
# NOTE: When adding new Linux versions, you may need
# to compile new wxPython .wgn files
- ubuntu-22.04
python-version: ["3.8", "3.9"]
runs-on: ${{ matrix.os }}
timeout-minutes: 10 # normally takes 2 min, as of 2023-03-03
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Update APT packages
run: sudo apt-get update
# HACK: Suppress warning "Error retrieving accessibility bus
# address: org.freedesktop.DBus.Error.ServiceUnknown:
# The name org.a11y.Bus was not provided by any .service files"
# when running tests later
- name: Install at-spi2-core
run: sudo apt-get install -y at-spi2-core
- name: Install wxPython dependencies
run: sudo apt-get install -y libgtk-3-dev
# Install wxPython from precompiled wagon because installing
# wxPython from source takes about 40 minutes on GitHub Actions
#
# NOTE: To recompile the .wgn, see instructions in: doc/how_to_make_wxpython_wagon.md
- name: Install dependency wxPython from wagon (Python 3.8)
if: ${{ matrix.python-version == 3.8 }}
run: |
poetry run pip3 install wagon
wget https://github.com/davidfstr/Crystal-Web-Archiver/releases/download/v1.4.0b/wxPython-4.2.1-py38-none-linux_x86_64.wgn
poetry run wagon install wxPython-4.2.1-py38-none-linux_x86_64.wgn
- name: Install dependency wxPython from wagon (Python 3.9)
if: ${{ matrix.python-version == 3.9 }}
run: |
poetry run pip3 install wagon
wget https://github.com/davidfstr/Crystal-Web-Archiver/releases/download/v1.4.0b/wxPython-4.2.1-py39-none-linux_x86_64.wgn
poetry run wagon install wxPython-4.2.1-py39-none-linux_x86_64.wgn
- name: Install remaining dependencies with Poetry
# If build takes a very long time, the precompiled .wgn in the
# previous build step may no longer be installing the correct
# dependency versions that are consistent with pyproject.toml and
# poetry.lock. In that case you'll need to rebuild the .wgn using
# instructions from: doc/how_to_make_wxpython_wagon.md
timeout-minutes: 2 # normally takes 6s, as of 2023-03-03
run: poetry install
- name: Display SQLite version and JSON support
run: |
python3 -c "import sqlite3; print('SQLite %s' % sqlite3.sqlite_version)"
poetry run python -c "from crystal.util.xsqlite3 import sqlite_has_json_support; print('JSON Support: ' + ('yes' if sqlite_has_json_support else 'NO'))"
- name: Run non-UI tests
run: poetry run python -m pytest
- name: Run UI tests
run: |
CRYSTAL_SCREENSHOTS_DIRPATH=$GITHUB_WORKSPACE/screenshots poetry run xvfb-run crystal --test
- name: Upload screenshot if test failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: screenshots
path: screenshots
if-no-files-found: ignore
build-windows:
strategy:
matrix:
os:
# NOTE: Earliest Windows supported by Crystal is Windows 7
#- windows-7 # available only as a self-hosted runner
#- windows-2012-r2 # based on Windows 7 # no longer supported by GitHub Actions
#- windows-2016 # based on Windows 8.1 # no longer supported by GitHub Actions
- windows-2019 # based on Windows 10
- windows-latest
python-version: ["3.8", "3.9"]
runs-on: ${{ matrix.os }}
timeout-minutes: 15 # normally takes 10 min, as of 2023-03-03
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies with Poetry
# If build takes a very long time, then it's likely that the version
# of wxPython installed does not offer a precompiled wheel for this
# version of Python. Check the wxPython PyPI page to confirm.
timeout-minutes: 2 # normally takes 15s, as of 2023-03-03
run: poetry install
- name: Display SQLite version and JSON support
run: |
python3 -c "import sqlite3; print('SQLite %s' % sqlite3.sqlite_version)"
poetry run python -c "from crystal.util.xsqlite3 import sqlite_has_json_support; print('JSON Support: ' + ('yes' if sqlite_has_json_support else 'NO'))"
- name: Run non-UI tests
run: poetry run python -m pytest
- name: Display Inno Setup in Program Files
run: |
dir "C:\Program Files (x86)"
dir "C:\Program Files (x86)\Inno Setup 6"
- name: Build .exe and installer
working-directory: ".\\setup"
run: "poetry run .\\make-win.bat"
- name: Run UI tests
working-directory: ".\\setup"
run: |
$LOGDIR = "$HOME\AppData\Local\DaFoster\Crystal Web Archiver\Logs"
$env:CRYSTAL_SCREENSHOTS_DIRPATH = "$env:GITHUB_WORKSPACE\screenshots"
poetry run python run_exe.py "--argsfile=arguments.txt" "--stdoutfile=$LOGDIR\stdout.log" "--stderrfile=$LOGDIR\stderr.log" "dist\Crystal Web Archiver.exe" "---" "--test"
- name: Upload screenshot if test failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: screenshots
path: screenshots
if-no-files-found: ignore
- name: Upload distribution artifact
# Only export distribution artifact for earliest supported Python and OS
if: (matrix.python-version == '3.8') && (matrix.os == 'windows-7')
uses: actions/upload-artifact@v3
with:
name: dist-win
path: "setup\\dist-win\\*.exe"
if-no-files-found: warn