forked from ava-labs/avalanche-wallet
-
Notifications
You must be signed in to change notification settings - Fork 4
158 lines (144 loc) · 5.9 KB
/
cypress.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
name: cypress-tests
on:
push:
branches: [c4t, dev, suite, suite-c4t]
pull_request:
branches: [c4t, dev, suite, suite-c4t]
env:
suite_image: 'europe-west3-docker.pkg.dev/pwk-c4t-dev/camino-suite-apps/camino-suite-host'
explorer_image: 'europe-west3-docker.pkg.dev/pwk-c4t-dev/camino-suite-apps/camino-suite-explorer'
jobs:
wallet-cypress:
runs-on: ubuntu-latest
strategy:
matrix:
# The node version, you can put one or many versions in here to test with
node: [16]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: get branch name
id: setBranch
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
else
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
# This should be caching node modules, hashing the cache key with the yarn lock code and busting that when yarn lock changes
- name: cache modules
uses: actions/cache@v3
with:
path: './node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('./yarn.lock') }}
- run: sudo npm install -g yarn
- run: yarn install --network-timeout 1000000
env:
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
- name: build local image
run: |
docker-compose build --build-arg SUITE_IMAGE=${{ env.suite_image }}:${{ steps.setBranch.outputs.branch }} --build-arg EXPLORER_IMAGE=${{ env.explorer_image }}:${{ steps.setBranch.outputs.branch }}
export SUITE_IMAGE=${{ env.suite_image }}:${{ steps.setBranch.outputs.branch }}
export EXPLORER_IMAGE=${{ env.explorer_image }}:${{ steps.setBranch.outputs.branch }}
docker-compose up -d
docker cp camino-suite-host-container:/app/camino-suite ./
mkdir -p /home/runner/.cache
docker cp camino-suite-host-container:/root/.cache/Cypress /home/runner/.cache/
- name: cypress-run
uses: cypress-io/github-action@v5
env:
USE_HTTP: true
with:
wait-on: 'http://localhost:5001/, http://localhost:5002/, http://localhost:5003/'
working-directory: camino-suite
# wait for 3 minutes for the server to respond
wait-on-timeout: 180
browser: chrome
headless: true
config-file: cypress.config.ts
env: grepTags=@wallet
# These extract all artifacts out from the container to git so they can be previewed
- name: extract screenshots to git
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: camino-suite/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- name: extract videos to git
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: camino-suite/cypress/videos
explorer-cypress:
runs-on: ubuntu-latest
strategy:
matrix:
# The node version, you can put one or many versions in here to test with
node: [16]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: get branch name
id: setBranch
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "branch=${{ github.base_ref }}" >> $GITHUB_OUTPUT
else
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
# This should be caching node modules, hashing the cache key with the yarn lock code and busting that when yarn lock changes
- name: cache modules
uses: actions/cache@v3
with:
path: './node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('./yarn.lock') }}
- run: sudo npm install -g yarn
- run: yarn install --network-timeout 1000000
env:
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress
- name: build local image
run: |
docker-compose build --build-arg SUITE_IMAGE=${{ env.suite_image }}:${{ steps.setBranch.outputs.branch }} --build-arg EXPLORER_IMAGE=${{ env.explorer_image }}:${{ steps.setBranch.outputs.branch }}
export SUITE_IMAGE=${{ env.suite_image }}:${{ steps.setBranch.outputs.branch }}
export EXPLORER_IMAGE=${{ env.explorer_image }}:${{ steps.setBranch.outputs.branch }}
docker-compose up -d
docker cp camino-suite-host-container:/app/camino-suite ./
mkdir -p /home/runner/.cache
docker cp camino-suite-host-container:/root/.cache/Cypress /home/runner/.cache/
- name: cypress-run
uses: cypress-io/github-action@v5
env:
USE_HTTP: true
with:
wait-on: 'http://localhost:5001/, http://localhost:5002/, http://localhost:5003/'
working-directory: camino-suite
# wait for 3 minutes for the server to respond
wait-on-timeout: 180
browser: chrome
headless: true
config-file: cypress.config.ts
env: grepTags=@explorer
# These extract all artifacts out from the container to git so they can be previewed
- name: extract screenshots to git
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: camino-suite/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- name: extract videos to git
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: camino-suite/cypress/videos