-
Notifications
You must be signed in to change notification settings - Fork 13
194 lines (194 loc) · 6.91 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
186
187
188
189
190
191
192
193
194
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
CARGO_TERM_COLOR: always
CARGO_LEPTOS_VERSION: 0.2.22
jobs:
lib_test:
name: Test leptos_i18n package
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Load cargo toolchain"
uses: dtolnay/rust-toolchain@nightly
- name: "Install cargo-all-features"
run: cargo install cargo-all-features --locked
- name: "Install clippy"
run: rustup component add clippy
- name: "Run clippy"
run: cargo clippy --package leptos_i18n
- name: "Test all features"
working-directory: "leptos_i18n"
run: cargo test-all-features
macros_test:
# Why not also use cargo-all-features with the parser and macros packages ?
# Because all features are forwarded from leptos_i18n,
# so if some features mix creates a problem they will appear in leptos_i18n tests.
# All leptos_i18n_macro tests don't require any feature flag, so no need to test each feature and matchup
# just run once with default, this speeds up CI
name: Test ${{ matrix.packages }} package
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
packages: [leptos_i18n_macro, leptos_i18n_parser, leptos_i18n_build]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Load cargo toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Run tests"
run: cargo test --package ${{ matrix.packages }}
test_ssr_examples:
name: Test ${{ matrix.examples }} SSR example
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
examples: [hello_world_actix, hello_world_axum, workspace, axum_island, routing_ssr]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 18
- name: "Setup Rust toolchain"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "stable"
targets: "wasm32-unknown-unknown"
- name: "Install cargo-leptos"
run: cargo install cargo-leptos@${{ env.CARGO_LEPTOS_VERSION }} --locked
- name: "Build ${{ matrix.examples }} example"
working-directory: examples/ssr/${{ matrix.examples }}
run: cargo leptos build
- name: "Build e2e utils"
working-directory: examples/utils
run: npm ci
- name: "Install Playwright"
working-directory: examples/ssr/${{ matrix.examples }}
run: |
npm ci
npx playwright install --with-deps
- name: "e2e testing ${{ matrix.examples }} example"
id: e2e
working-directory: examples/ssr/${{ matrix.examples }}
run: npx playwright test
- name: "Upload e2e report"
uses: actions/upload-artifact@v4
# upload artifact only if e2e test failed
if: ${{ steps.e2e.outcome == 'failure' && !cancelled() }}
with:
name: playwright-report-${{ matrix.examples }}
path: examples/ssr/${{ matrix.examples }}/playwright-report/
test_dyn_load_examples:
name: Test ${{ matrix.examples }} dynamic_load example
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
examples: [hello_world_actix, hello_world_axum, axum_island, namespaces]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 18
- name: "Setup Rust toolchain"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "stable"
targets: "wasm32-unknown-unknown"
- name: "Install cargo-leptos"
run: cargo install cargo-leptos@${{ env.CARGO_LEPTOS_VERSION }} --locked
- name: "Build ${{ matrix.examples }} example"
working-directory: examples/dynamic_load/${{ matrix.examples }}
run: cargo leptos build
- name: "Build e2e utils"
working-directory: examples/utils
run: npm ci
- name: "Install Playwright"
working-directory: examples/dynamic_load/${{ matrix.examples }}
run: |
npm ci
npx playwright install --with-deps
- name: "e2e testing ${{ matrix.examples }} example"
id: e2e
working-directory: examples/dynamic_load/${{ matrix.examples }}
run: npx playwright test
- name: "Upload e2e report"
uses: actions/upload-artifact@v4
# upload artifact only if e2e test failed
if: ${{ steps.e2e.outcome == 'failure' && !cancelled() }}
with:
name: playwright-report-${{ matrix.examples }}
path: examples/dynamic_load/${{ matrix.examples }}/playwright-report/
test_csr_examples:
name: Test ${{ matrix.examples }} CSR example
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
examples: [counter, counter_icu_datagen, counter_plurals, counter_ranges, interpolation, namespaces, subkeys, yaml, routing_csr, subcontext]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 18
- name: "Setup Rust toolchain"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "stable"
targets: "wasm32-unknown-unknown"
- name: "Install trunk"
run: cargo install trunk --locked
- name: "Build ${{ matrix.examples }} example"
working-directory: examples/csr/${{ matrix.examples }}
run: trunk build
- name: "Build e2e utils"
working-directory: examples/utils
run: npm ci
- name: "Install Playwright"
working-directory: examples/csr/${{ matrix.examples }}
run: |
npm ci
npx playwright install --with-deps
- name: "e2e testing ${{ matrix.examples }} example"
id: e2e
working-directory: examples/csr/${{ matrix.examples }}
run: npx playwright test
- name: "Upload e2e report"
uses: actions/upload-artifact@v4
# upload artifact only if e2e test failed
if: ${{ steps.e2e.outcome == 'failure' && !cancelled() }}
with:
name: playwright-report-${{ matrix.examples }}
path: examples/csr/${{ matrix.examples }}/playwright-report/
test_suite:
name: Test suite ${{ matrix.tests_suites }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tests_suites: [json, json5, yaml, namespaces]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Install wasm32-unknown-unknown"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "stable"
- name: Running test suite ${{ matrix.tests_suites }}
working-directory: tests/${{ matrix.tests_suites }}
run: cargo test