-
Notifications
You must be signed in to change notification settings - Fork 1
197 lines (174 loc) · 7.62 KB
/
e2e-tests.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
name: Build and run example apps using prod endpoints
on:
schedule:
- cron: '*/30 * * * *'
push:
pull_request:
jobs:
# check-version:
# runs-on: ubuntu-latest
# outputs:
# version_changed: ${{ steps.check-version.outputs.version_changed }}
# steps:
# - uses: actions/checkout@v4
# - name: Check Versions
# id: check-version
# run: |
# # Default to false
# echo "version_changed=false" >> $GITHUB_OUTPUT
# AUTH_BETA_VERSION=$(npm view @civic/auth@beta version)
# AUTH_PROD_VERSION=$(npm view @civic/auth version)
# WEB3_BETA_VERSION=$(npm view @civic/auth-web3@beta version)
# WEB3_PROD_VERSION=$(npm view @civic/auth-web3 version)
# echo "Auth Beta version: $AUTH_BETA_VERSION"
# echo "Auth Production version: $AUTH_PROD_VERSION"
# echo "Web3 Beta version: $WEB3_BETA_VERSION"
# echo "Web3 Production version: $WEB3_PROD_VERSION"
# if [ -f .civic-versions ]; then
# PREV_VERSIONS=$(cat .civic-versions)
# PREV_AUTH_BETA=$(echo "$PREV_VERSIONS" | sed -n '1p')
# PREV_AUTH_PROD=$(echo "$PREV_VERSIONS" | sed -n '2p')
# PREV_WEB3_BETA=$(echo "$PREV_VERSIONS" | sed -n '3p')
# PREV_WEB3_PROD=$(echo "$PREV_VERSIONS" | sed -n '4p')
# # Always echo previous versions for confirmation
# echo "Previous versions:"
# echo "Auth Beta: $PREV_AUTH_BETA"
# echo "Auth Prod: $PREV_AUTH_PROD"
# echo "Web3 Beta: $PREV_WEB3_BETA"
# echo "Web3 Prod: $PREV_WEB3_PROD"
# if [ "$AUTH_BETA_VERSION" != "$PREV_AUTH_BETA" ] || \
# [ "$AUTH_PROD_VERSION" != "$PREV_AUTH_PROD" ] || \
# [ "$WEB3_BETA_VERSION" != "$PREV_WEB3_BETA" ] || \
# [ "$WEB3_PROD_VERSION" != "$PREV_WEB3_PROD" ]; then
# echo "version_changed=true" >> $GITHUB_OUTPUT
# echo "Changed from:"
# echo "Auth Beta: $PREV_AUTH_BETA -> $AUTH_BETA_VERSION"
# echo "Auth Prod: $PREV_AUTH_PROD -> $AUTH_PROD_VERSION"
# echo "Web3 Beta: $PREV_WEB3_BETA -> $WEB3_BETA_VERSION"
# echo "Web3 Prod: $PREV_WEB3_PROD -> $WEB3_PROD_VERSION"
# else
# echo "No version changes detected"
# fi
# else
# # If the file doesn't exist, it's the first run, so we consider it changed
# echo "First run - no previous versions file found"
# echo "version_changed=true" >> $GITHUB_OUTPUT
# fi
# # Write new versions to file
# echo "$AUTH_BETA_VERSION" > .civic-versions
# echo "$AUTH_PROD_VERSION" >> .civic-versions
# echo "$WEB3_BETA_VERSION" >> .civic-versions
# echo "$WEB3_PROD_VERSION" >> .civic-versions
build:
# needs: check-version
# if: needs.check-version.outputs.version_changed == 'true'
runs-on: ubuntu-latest
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
VITE_CLIENT_ID: ${{ secrets.CLIENT_ID }}
CYPRESS_CLIENT_ID: ${{ secrets.CLIENT_ID }}
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v4
- name: Install Bun (used to run the examples)
uses: oven-sh/setup-bun@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Force upgrade civic/auth and civic/auth-web3
shell: bash
working-directory: ./
run: yarn upgrade @civic/auth @civic/auth-web3 --latest
- name: Build
working-directory: ./
run: yarn build
# There is a CI only error happening when running yarn dev here. The error is No valid token found - redirecting to "http://localhost:3000/"
- name: Start the nextjs example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth/nextjs
wait-on: http-get://localhost:3000
wait-for: 120s
log-output-if: true
- name: Start the reactjs example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth/reactjs
wait-on: http://localhost:3001/
wait-for: 60s
log-output-if: true
- name: Start the express example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth/server/express
wait-on: http://localhost:3002/
wait-for: 60s
log-output-if: true
- name: Start the fastify example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth/server/fastify
wait-on: http://localhost:3003/
wait-for: 60s
log-output-if: true
- name: Start the hono example app
working-directory: ./packages/civic-auth/server/hono
run: |
bun add @hono/node-server
yarn dev & npx wait-on http://localhost:3004/
timeout-minutes: 1
- name: Start the wagmi example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth-web3/wagmi
wait-on: http://localhost:3005/
wait-for: 60s
log-output-if: true
- name: Start the solana example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth-web3/solana
wait-on: http://localhost:3006/
wait-for: 60s
log-output-if: true
- name: Run Cypress example app e2e prod tests
id: cypress
uses: cypress-io/github-action@v6
with:
working-directory: packages/e2e
command: yarn cypress run --browser chrome --record
browser: chrome
install: true
wait-on: 'http://localhost:3000,http://localhost:3001,http://localhost:3002,http://localhost:3003,http://localhost:3004,http://localhost:3005,http://localhost:3006'
wait-on-timeout: 60
record: true
env:
NEXT_JS_BASE_URL: 'http://localhost:3000'
REACT_BASE_URL: 'http://localhost:3001'
EXPRESS_BASE_URL: 'http://localhost:3002'
FASTIFY_BASE_URL: 'http://localhost:3003'
HONO_BASE_URL: 'http://localhost:3004'
WAGMI_BASE_URL: 'http://localhost:3005'
SOLANA_BASE_URL: 'http://localhost:3006'
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Send Slack Notification on Failure
if: always()
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"channel": "#build",
"text": "<@UCBGV5J12> IGNORE. THIS IS A TEST Example repo Cypress tests failed in civicteam/civic-auth-examples.\n\nThese tests are run after new beta and prod versions of civic/auth and civic/auth-web3, so there may be an issue with the new version(s). Check the recording of the test failure here https://cloud.cypress.io/projects/cmyigw/runs.\n\n Alternatively, see the full GitHub Actions run details here ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}."
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK