-
Notifications
You must be signed in to change notification settings - Fork 50
197 lines (174 loc) · 4.89 KB
/
main.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
on:
[
push,
workflow_dispatch,
]
name: 'Build, test, clippy'
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- run:
|
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
build_js:
name: Build JS assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run:
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys:
|
${{ runner.os }}-pnpm-store-
- name: Install JS deps
working-directory: ./browser/
run:
|
pnpm install
pnpm run playwright-install
- name: Lint JS
working-directory: ./browser/
run:
|
pnpm run lint
- name: Test JS (no e2e)
working-directory: ./browser/
run:
|
pnpm run test
- name: Build JS
working-directory: ./browser/
run:
|
pnpm run build
- name: Save JS Build Artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: ./browser/data-browser/dist
e2e:
name: End-to-end tests
runs-on: ubuntu-latest
needs:
[
build_js,
]
steps:
- run:
|
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions/checkout@v3
- name: Download JS Build Artifact
uses: actions/download-artifact@v3
with:
name: build-artifact
path: ./browser/data-browser/dist
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
- uses: actions-rs/cargo@v1
name: cargo build
with:
command: build
args: --locked
- uses: actions-rs/cargo@v1
name: cargo clippy
with:
command: clippy
args: --no-deps
- uses: taiki-e/install-action@nextest
- uses: actions-rs/cargo@v1
name: cargo nextest run
with:
command: nextest
args: run --all-features --retries 3
- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run:
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys:
|
${{ runner.os }}-pnpm-store-
- name: Install Playwright
working-directory: ./browser/
run:
|
pnpm install
pnpm run playwright-install
- name: Run atomic-server in the background
run: nohup ./target/debug/atomic-server --initialize &
- name: Run end-to-end tests
working-directory: ./browser/
env:
FRONTEND_URL: http://localhost:9883
LANGUAGE: 'en_GB'
DELETE_PREVIOUS_TEST_DRIVES: 'false'
run: pnpm run test-e2e
# Coverage
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --lcov --locked --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
- name: Upload test artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-results
path: ./browser/data-browser/test-results/