-
Notifications
You must be signed in to change notification settings - Fork 114
193 lines (172 loc) · 6.47 KB
/
app-e2e.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
name: BE App E2E tests
on:
workflow_call:
secrets:
ALLURE_TOKEN:
description: 'A token passed from the caller workflow'
required: true
inputs:
environmentTags:
type: string
default: ''
required: false
targetUrl:
type: string
default: 'https://staging-scan-v2.zksync.dev/'
required: true
default_network_value_for_e2e:
type: string
default: '/?network=mainnet'
required: true
publish_to_allure: #Here we define the variable that can be overwritten by caller workflow
type: boolean
description: "Publish test results to allure"
default: true
required: false
env:
ALLURE_SEARCH_REQUEST: '[{"id":"name","type":"string","value":"#${{ github.run_number }}"}]'
ALLURE_BASIC_TAGS: "${{ github.head_ref }}, #${{ github.run_number }}, ${{ github.event.pull_request.title }}"
ALLURE_PROJECT_ID: ${{ vars.ALLURE_PROJECT_ID }}
ALLURE_ENDPOINT: ${{ vars.ALLURE_ENDPOINT }}
jobs:
e2e:
runs-on: [matterlabs-ci-runner]
permissions:
contents: read
defaults:
run:
working-directory: ./packages/app
strategy:
fail-fast: false
matrix:
tags: [
"@artifactsSet1",
# "@artifactsSet2",
# "@artifactsSet3",
# "@artifactsSet4",
# "@redirectionSet1",
# "@redirectionSet2",
# "@redirectionSet3",
"@copying",
"@search",
# "@testnetSmokeSuite"
]
name: '${{ matrix.tags }}'
container:
image: mcr.microsoft.com/playwright:v1.27.0-focal
options: --user 1001
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
# Workaround for bug https://github.com/typicode/husky/issues/991
HUSKY: 0
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
working-directory: ./
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: |
npm pkg delete scripts.prepare
npm ci
- name: Download allurectl
run: wget https://github.com/allure-framework/allurectl/releases/latest/download/allurectl_linux_386 -O ./allurectl
- name: Change permission for allurectl
run: chmod +x ./allurectl
- name: Launch tests
env:
CI: 'true'
TARGET_ENV: ${{ inputs.targetUrl }}
run: |
echo "Run tests"
if [ "${{ matrix.tags }}" = "@testnetSmokeSuite" ]; then
echo "Run in testnetSmokeSuite only"
E2ENETWORK='/?network=goerli' npx cucumber-js --tags "${{ matrix.tags }} ${{ inputs.environmentTags }} and not @mainnet"
else
echo "Run in mainnet"
E2ENETWORK='${{ inputs.default_network_value_for_e2e }}' npx cucumber-js --tags "${{ matrix.tags }} ${{ inputs.environmentTags }} and not @testnet"
fi
- name: Reset tags quotes
if: always()
run: |
echo "MATRIX_TAG_WITHOUT_QUOTES=$(echo ${{ matrix.tags }} | sed -e 's/@//g' )" >> $GITHUB_ENV
# - name: Create launch ID
# if: always()
# env:
# ALLURE_LAUNCH_NAME: "#${{ github.run_number }} ${{ env.MATRIX_TAG_WITHOUT_QUOTES }}"
# ALLURE_LAUNCH_TAGS: "${{ env.ALLURE_BASIC_TAGS }}, ${{ env.MATRIX_TAG_WITHOUT_QUOTES }}"
# ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
# run: |
# echo "ALLURE_LAUNCH_ID=$(./allurectl launch create --launch-name '${{ env.ALLURE_LAUNCH_NAME }}' --no-header --format ID | tail -n1)" >> $GITHUB_ENV
- name: Upload tests to the Allure proj
if: always() && inputs.publish_to_allure == true
env:
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
run: |
./allurectl upload allure-results
- uses: actions/checkout@v2
- name: Get Allure history
uses: actions/checkout@v2
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Allure Report action from marketplace
uses: simple-elf/[email protected]
if: always()
#id: allure-report
with:
allure_results: allure-results
#gh_pages: gh-pages
#allure_report: allure-report
allure_history: allure-history
keep_reports: 15
- name: Deploy report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history
- if: failure()
name: Save artifacts
uses: actions/upload-artifact@v3
with:
name: portal_e2e_${{ github.run_number }}_artifacts
path: packages/app/tests/e2e/artifacts/*
publish:
name: Allure Report
runs-on: ubuntu-latest
permissions:
contents: write
needs: e2e
if: always()
steps:
- name: Prepare a link
run: |
echo "BASE64_SEARCH_REQUEST=$(echo '${{ env.ALLURE_SEARCH_REQUEST }}' | base64)" >> $GITHUB_ENV
- name: Publish Allure link to GIT Summary
run: |
LINK1="${{ vars.ALLURE_ENDPOINT }}project/${{ vars.ALLURE_PROJECT_ID }}/launches?search=${{ env.BASE64_SEARCH_REQUEST }}"
LINK2="https://raw.githack.com/matter-labs/block-explorer/tree/gh-pages/${{ github.run_number }}/index.html"
echo "Allure [Private]($LINK1) and [Public]($LINK2) links:rocket: in git run #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
# - name: Post the link to the report
# if: always()
# uses: Sibz/github-status-action@v1
# with:
# authToken: ${{ secrets.GITHUB_TOKEN }}
# context: 'Public test report'
# state: 'success'
# sha: ${{ github.event.pull_request.head.sha }}
# target_url: https://raw.githack.com/matter-labs/block-explorer/tree/gh-pages/${{ github.run_number }}/index.html