-
Notifications
You must be signed in to change notification settings - Fork 87
170 lines (157 loc) · 6.36 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
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Cache Cargo binaries
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script
- run: rustup target add wasm32-unknown-unknown
- name: Run checks
run: bonnie check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Cache Cargo binaries
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script
- name: Run traditional tests
run: bonnie test core
cli-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Cache Cargo binaries
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script
- run: rustup target add wasm32-unknown-unknown
- name: Run CLI tests
run: bonnie test cli
# We now have a separate job for each example's E2E testing because they all take a while, we may as well run them in parallel
# The job for each E2E test is exactly the same except for a minor difference, so we'll use a matrix based on listing the subdirectories
e2e-example-test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# For now, we list all the examples we're testing, but in future this will be automatic
- name: basic
type: core
- name: capsules
type: core
- name: custom_server
type: core
- name: error_views
type: core
- name: freezing_and_thawing
type: core
- name: global_state
type: core
- name: helper_build_state
type: core
- name: i18n
type: core
- name: idb_freezing
type: core
- name: index_view
type: core
- name: js_interop
type: core
- name: plugins
type: core
- name: preload
type: core
- name: router_state
type: core
- name: rx_state
type: core
- name: set_headers
type: core
- name: state_generation
type: core
- name: static_content
type: core
- name: suspense
type: core
- name: unreactive
type: core
# We want to run as many jobs as we can for debugging, so we can see easily what has actually failed (and re-run failed jobs more quickly)
fail-fast: false
steps:
- uses: actions/checkout@v2
# Cache Cargo binaries
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script
# Also cache all the other Cargo files, since plenty of CI runs won't involve different dependencies
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
# # Also cache the apt packages we need for testing
# - uses: awalsh128/cache-apt-pkgs-action@latest
# with:
# packages: firefox
# version: 1.0
# # And finally cache Geckodriver itself
# - uses: actions/cache@v3
# id: geckocache
# with:
# path: |
# ~/.geckodriver
# # The cache should be OS-specific
# key: ${{ runner.os }}-geckodriver
# - name: Install Geckodriver
# if: steps.geckocache.outputs.cache-hit != 'true'
# run: wget -O ~/geckodriver-archive https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz && tar -xvzf ~/geckodriver-archive -C ~/ && mv ~/geckodriver ~/.geckodriver && chmod +x ~/.geckodriver
- run: sudo apt update && sudo apt install firefox
- name: Run Firefox WebDriver
run: geckodriver &
- name: Run E2E tests for example ${{ matrix.name }} in category ${{ matrix.type }}
run: bonnie test example-all-integrations ${{ matrix.type }} ${{ matrix.name }}