Repository navigation
134 lines (113 loc) · 3.57 KB
/
Copy pathci.yml
File metadata and controls
134 lines (113 loc) · 3.57 KB
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
name: CI
on:
push:
branches: [main, alpha]
paths-ignore:
- '**.md'
- 'LICENSE'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
pull_request:
branches: [main, alpha]
paths-ignore:
- '**.md'
- 'LICENSE'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
workflow_dispatch:
inputs:
emulator-ref:
description: 'flashforge-emulator-v2 git ref to run the E2E track against'
required: false
default: 'v0.3.0'
type: string
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
name: Type-check, lint, build, test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout FlashForgeWebUI
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.23.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm run type-check
- name: Lint
run: pnpm run lint
- name: Build (backend + webui)
run: pnpm run build
- name: Unit tests
run: pnpm test
e2e-emulator:
name: E2E (emulator + browser)
runs-on: ubuntu-latest
needs: verify
timeout-minutes: 40
steps:
- name: Checkout FlashForgeWebUI
uses: actions/checkout@v4
# The emulator lives in a separate public repo and provides the printers this
# track drives, so no real hardware is needed. Pinned to a release tag so an
# emulator change cannot silently break or silently change this CI; bump the
# tag (or dispatch with emulator-ref) to pick up a new emulator release.
- name: Checkout flashforge-emulator-v2
uses: actions/checkout@v4
with:
repository: GhostTypes/flashforge-emulator-v2
ref: ${{ inputs.emulator-ref || 'v0.4.0' }}
path: emulator
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.23.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
- name: Install emulator dependencies
working-directory: emulator
run: npm ci
env:
# Only the emulator's headless runtime is used here; skip the large
# Electron binary download this repo's e2e-tests track never launches.
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
# The browser track needs the chromium binary itself, not just its system libraries.
- name: Install Playwright chromium
run: pnpm exec playwright install --with-deps chromium
# Unlike FlashForgeUI-Electron's CI there is no xvfb-run and no chrome-sandbox
# fixup here: this track drives the plain Node server (dist/index.js) with
# headless Chromium, never a real Electron window.
- name: Run browser E2E against the emulator
run: pnpm run test:e2e
env:
FF_EMULATOR_ROOT: ${{ github.workspace }}/emulator
- name: Upload Playwright artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-e2e-artifacts
path: |
test-results/
playwright-report/
retention-days: 7
if-no-files-found: ignore