-
Notifications
You must be signed in to change notification settings - Fork 0
275 lines (267 loc) · 9 KB
/
tests.yaml
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: test
on:
pull_request:
push:
branches: [main]
env:
POETRY_VERSION: "1.5.1"
NODEJS_VERSION: "20.5.1"
RUST_VERSION: "1.82.0"
PRE_COMMIT_VERSION: "3.6.0"
TAURI_CLI_VERSION: "2.0.4"
TAURI_DRIVER_VERSION: "2.0.1"
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
jobs:
build:
name: Build entire program
runs-on: ubuntu-latest
container:
image: "ghcr.io/zamm-dev/zamm:v0.2.1-build"
options: --user root
env:
HOME: /root
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.FONTS_PAT }}
submodules: "recursive"
- name: Build artifacts
run: make copy-docker-deps build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: builds
path: |
src-svelte/.svelte-kit/
src-svelte/build/
forks/neodrag/packages/core/dist/
forks/neodrag/packages/svelte/dist/
src-tauri/target/release/zamm
retention-days: 1
- name: Upload .deb
uses: actions/upload-artifact@v3
with:
name: zamm.deb
path: src-tauri/target/release/bundle/deb/zamm_*.deb
retention-days: 1
- name: Upload AppImage
uses: actions/upload-artifact@v3
with:
name: zamm.AppImage
path: src-tauri/target/release/bundle/appimage/zamm_*.AppImage
retention-days: 1
pre-commit:
name: Check pre-commit hooks
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.FONTS_PAT }}
submodules: "recursive"
- name: Install Tauri dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libasound2-dev libglib2.0-dev libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev
- name: Set up Yarn cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
**/node_modules
**/.eslintcache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
continue-on-error: false
with:
workspaces: "src-tauri -> target"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODEJS_VERSION }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
override: true
components: rustfmt, clippy
- uses: actions/download-artifact@v3
with:
name: builds
- name: Prepare yarn link
run: yarn link
working-directory: forks/neodrag/packages/svelte
- name: Install main Node dependencies
run: yarn install --frozen-lockfile
- name: Setup Svelte project
run: |
yarn link @neodrag/svelte
yarn svelte-kit sync
working-directory: src-svelte
# end of common dependency setup with downloaded artifacts
- name: Install pre-commit
run: |
pipx install pre-commit==$PRE_COMMIT_VERSION
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ hashFiles('.pre-commit-config.yaml') }}
- run: pre-commit run --show-diff-on-failure --color=always --all-files
rust:
name: Run Rust tests
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.FONTS_PAT }}
submodules: "recursive"
- name: Install Tauri dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libasound2-dev sqlite3 libglib2.0-dev libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
continue-on-error: false
with:
workspaces: "src-tauri -> target"
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
override: true
components: rustfmt, clippy
- uses: actions/download-artifact@v3
with:
name: builds
# end of common dependency setup with downloaded artifacts
- name: Run Rust Tests
run: cargo test -- --test-threads=1
working-directory: src-tauri
svelte:
name: Run Svelte tests
runs-on: ubuntu-latest
container:
image: "ghcr.io/zamm-dev/zamm:v0.2.1-build"
options: --user root
env:
PLAYWRIGHT_TIMEOUT: 60000
needs: build
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.FONTS_PAT }}
submodules: "recursive"
- name: Set up Yarn cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
**/node_modules
**/.eslintcache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/download-artifact@v3
with:
name: builds
- name: Install Node dependencies
run: |
yarn install --frozen-lockfile
cd src-svelte && yarn install --frozen-lockfile && yarn svelte-kit sync
# end of common dependency setup with downloaded artifacts
- name: Copy over playwright binaries
run: |
mkdir -p /github/home/.cache/
cp -R /root/.cache/ms-playwright /github/home/.cache/ms-playwright
- name: Run Svelte Tests
run: yarn workspace gui test
- name: Do better diff
if: always()
run: python3 diff-screenshots.py
working-directory: src-svelte/
- name: Upload final app
if: always() # run even if tests fail
uses: actions/upload-artifact@v3
with:
name: storybook-screenshots
path: |
src-svelte/screenshots/testing/**/*.png
retention-days: 1
e2e:
name: Run end-to-end tests
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.FONTS_PAT }}
submodules: "recursive"
- name: Install Tauri dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
- name: Set up Yarn cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
**/node_modules
**/.eslintcache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
continue-on-error: false
with:
workspaces: "src-tauri -> target"
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODEJS_VERSION }}
- name: Install Node dependencies
run: |
yarn install --frozen-lockfile
cd src-svelte && yarn svelte-kit sync
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
override: true
components: rustfmt, clippy
- uses: actions/download-artifact@v3
with:
name: builds
# end of common dependency setup with downloaded artifacts
- name: Install webdriver dependencies
run: sudo apt-get install -y webkit2gtk-driver xvfb
- name: Install tauri-cli
uses: actions-rs/cargo@v1
with:
command: install
args: --locked tauri-cli@${{ env.TAURI_CLI_VERSION }}
- name: Install tauri-driver
uses: actions-rs/cargo@v1
with:
command: install
args: --locked tauri-driver@${{ env.TAURI_DRIVER_VERSION }}
- name: Try creating directories
run: |
mkdir -p /home/runner/.local/share/zamm/
chmod -R 777 /home/runner/.local/share/zamm/
mkdir -p /home/runner/.config/dev.zamm/
echo "background_animation = false" > /home/runner/.config/dev.zamm/preferences.toml
chmod +x src-tauri/target/release/zamm
- name: Run headless WebdriverIO tests
run: xvfb-run yarn e2e-test
- name: Upload test screenshots as artifacts
if: always() # run even if tests fail
uses: actions/upload-artifact@v3
with:
name: webdriver-screenshots
path: webdriver/screenshots/testing/**/*.png