-
Notifications
You must be signed in to change notification settings - Fork 1
182 lines (157 loc) · 5.04 KB
/
webclient-test.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
name: wc:tests
on:
pull_request:
branches:
- main
paths:
- "packages/web-client/**"
- ".github/workflows/webclient-deploy.yml"
- ".github/workflows/webclient-test.yml"
- ".github/workflows/webclient-test-deploy.yml"
- "wc.staging.fly.toml"
- "wc.Dockerfile"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
issues: write
pull-requests: write
jobs:
svelte-check:
if: github.event.pull_request.draft == false
timeout-minutes: 2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm install
- name: Run svelte-check
run: npm run wc:check
deploy-fly-staging:
if: github.actor != 'dependabot[bot]'
needs: ["svelte-check"]
environment:
name: pr-${{ github.event.number }}-web-client
url: ${{ steps.deploy.outputs.url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm install
- name: Deploy staging build
id: deploy
uses: superfly/[email protected]
env:
FLY_API_TOKEN: ${{ secrets.FLYIO_STAGING_KIT_DEPLOY_GH_ACTION }}
FLY_ORG: go-bazzinga-staging
with:
name: pr-${{ github.event.number }}-web-client
config: wc.staging.fly.toml
lighthouse-cypress-vitest:
needs: ["svelte-check"]
if: github.event.pull_request.draft == false
timeout-minutes: 40
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Install dependencies
run: npm install
- name: Add Rust wasm target
run: rustup target add wasm32-unknown-unknown
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: "0.16.1"
- name: Cache rust dependencies, build output and DFX build cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./packages/hot-or-not-backend-canister/target/
./packages/hot-or-not-backend-canister/.dfx/
key: ${{ runner.os }}-testing-${{ hashFiles('**/Cargo.lock') }}
- name: Start DFX Server
if: always()
working-directory: ./packages/hot-or-not-backend-canister
run: dfx start --background
- name: Provision local canister IDs for the canisters
working-directory: ./packages/hot-or-not-backend-canister
run: |
dfx canister create --no-wallet configuration
dfx canister create --no-wallet individual_user_template
dfx canister create --no-wallet user_index
dfx canister create --no-wallet post_cache
- name: Install canisters
if: always()
working-directory: ./packages/hot-or-not-backend-canister
run: ./scripts/canisters/local_deploy/install_all_canisters.sh -si
- name: Test DFX connection
if: always()
run: dfx ping http://localhost:4943
# - name: Run vitest
# run: |
# set -euxo pipefail
# npm run wc:test:vi
- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
browser: chrome
project: ./packages/web-client
build: npm run wc:build
start: npm run wc:preview
command: npm run ${{ (github.actor != 'dependabot[bot]' && 'wc:test:record') || 'wc:test' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_PROJECT_ID: uv7vm5
TEST_HOST: http://localhost:4173
- name: Lighthouse CI check
run: |
npm run wc:build
npm install -g @lhci/cli
lhci_host=http://localhost:4174 lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
- name: Stop DFX Server
run: dfx stop
if: always()
- uses: actions/upload-artifact@v4
if: always()
with:
name: lighthouse-ci-report
path: lhci_report
retention-days: 7
- uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: packages/web-client/coverage/
retention-days: 7
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-report
path: packages/web-client/cypress/
retention-days: 7
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-report
path: packages/web-client/cypress/reports/mochawesome-report
retention-days: 7