-
Notifications
You must be signed in to change notification settings - Fork 1.4k
166 lines (139 loc) · 4.53 KB
/
test.yaml
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
name: "Test"
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
environments:
runs-on: ubuntu-latest
# name will be node@<version> or browser
name: ${{ matrix.env.name }}${{ matrix.env.version && '@' || ''}}${{ matrix.env.version || ''}}
strategy:
fail-fast: false
matrix:
env:
[
{ name: node, version: 18.18.2 },
{ name: node, version: 20 },
{ name: browser },
]
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@v4
- name: CI Setup
uses: ./.github/actions/test-setup
with:
node-version: ${{ matrix.env.version || 20 }}
- name: Validate Tests
run: pnpm test:validate
- name: Run Tests - ${{ matrix.env.name }}
run: pnpm ci:test --${{ matrix.env.name }}
- name: Upload Coverage - ${{ matrix.env.name }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.env.name }}
path: coverage/environments/${{ matrix.env.name }}
overwrite: true
e2e:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [environments]
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: CI Setup
uses: ./.github/actions/test-setup
- name: Pretest
run: pnpm pretest
- name: Run Isolated Tests
run: pnpm test:e2e
env:
FUEL_NETWORK_URL: https://devnet.fuel.network/v1/graphql
TEST_WALLET_PVT_KEY: ${{ secrets.TEST_WALLET_PVT_KEY }}
TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }}
FUEL_TESTNET_NETWORK_URL: ${{ secrets.FUEL_TESTNET_NETWORK_URL }}
test:
if: github.base_ref == 'master' || github.ref_name == 'master'
runs-on: ubuntu-latest
needs: [environments, e2e]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: CI Setup
uses: ./.github/actions/test-setup
- name: Generate Coverage Directory
run: mkdir -p coverage/environments
- name: Download Coverage Artifact for Node Tests
uses: actions/download-artifact@v4
with:
name: node
path: coverage/environments
- name: Generate Coverage
run: pnpm test:coverage-merge
- name: Find PR Number
uses: jwalton/gh-find-current-pr@v1
id: findPr
- name: Upload Master Coverage Artifact
uses: actions/upload-artifact@v4
if: ${{ !steps.findPr.outputs.number }}
with:
name: coverage-master
path: coverage/report
- name: Download Master Coverage Artifact
uses: dawidd6/action-download-artifact@v2
if: ${{ steps.findPr.outputs.number }}
with:
workflow: test.yaml
branch: master
name: coverage-master
path: coverage-master
- name: Generate Coverage Diff
if: ${{ (steps.findPr.outputs.number) }}
run: pnpm test:coverage-diff
- name: Report Coverage
uses: thollander/actions-comment-pull-request@v2
if: ${{ steps.findPr.outputs.number }}
with:
filePath: coverage/report/coverage-diff.txt
pr_number: ${{ (steps.findPr.outputs.number) }}
comment_tag: diff
mode: recreate
create_if_not_exists: true
create-changeset:
needs: [test]
name: Create Changeset
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.client_payload.ref }}
- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 9.0.5
run_install: true
- name: Install jq
run: sudo apt-get install -y jq
- name: Run dependabot changeset script
run: pnpm changeset:dependabot
env:
PR_TITLE: ${{ github.event.pull_request.title }}
- name: Commit Changeset
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .
git commit -m "build: update dependency changeset [skip ci]"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}