-
Notifications
You must be signed in to change notification settings - Fork 448
172 lines (143 loc) · 4.62 KB
/
pr-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
name: Tests
on:
pull_request:
branches: [main, master, sdk-v2]
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
COVERAGE_FILE: ./coverage/report.json
jobs:
tests-jest:
name: JEST Tests
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start Test Node
run: pnpm node:up:test
- name: Graphql Codegen
run: pnpm codegen:app
env:
NODE_ENV: test
# Unit tests running with JEST
- name: Find PR number
uses: jwalton/gh-find-current-pr@v1
id: findPr
- name: Build libs
run: |
pnpm build:libs
- name: Run Jest Tests
run: |
pnpm test:ci --outputFile="${{ env.COVERAGE_FILE }}"
timeout-minutes: 20
env:
NODE_OPTIONS: "--max-old-space-size=4096"
- name: Publish coverage
uses: artiomtr/jest-coverage-report-action@v2.0.5
if: ${{ steps.findPr.outputs.number }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
package-manager: pnpm
annotations: failed-tests
test-script: pnpm test:ci
working-directory: ./packages/app
coverage-file: ${{ env.COVERAGE_FILE }}
base-coverage-file: ${{ env.COVERAGE_FILE }}
- name: Stop Test Node
run: pnpm node:clean:test
tests-e2e:
name: E2E Tests
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start Test Node
run: pnpm node:up:test
- name: Graphql Codegen
run: pnpm codegen:app
env:
NODE_ENV: test
- name: Build Application
run: pnpm build:test
env:
## increase node.js m memory limit for building
## with sourcemaps
NODE_OPTIONS: "--max-old-space-size=4096"
NODE_ENV: test
# E2E tests running with Playwright
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run E2E Tests
run: xvfb-run --auto-servernum -- pnpm test:e2e
env:
NODE_ENV: test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-app-report
path: packages/app/playwright-results
retention-days: 30
- name: Stop Test Node
run: pnpm node:clean:test
tests-e2e-contracts:
name: E2E Contract Tests
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run PNPM install
id: pnpm-cache
run:
pnpm recursive install --frozen-lockfile
- name: Start Test Node
run: pnpm node:up:test
- name: Build Application
run: pnpm build:all
env:
## increase node.js m memory limit for building
## with sourcemaps
NODE_OPTIONS: "--max-old-space-size=4096"
NODE_ENV: test
- name: Build & Deploy Contracts
run: pnpm deploy:contracts
working-directory: ./packages/e2e-contract-tests
# E2E tests running with Playwright
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run E2E Contract Tests
run: xvfb-run --auto-servernum -- pnpm test:e2e:contracts
env:
NODE_ENV: test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: |
packages/app/playwright-report/
packages/app/playwright-html/
retention-days: 30
- name: Stop Test Node
run: pnpm node:clean:test