This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
146 lines (124 loc) · 4.4 KB
/
tests.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
name: Tests
on:
pull_request:
types:
- opened
- synchronize
branches:
- master
- dev
paths-ignore:
- '**.md'
- 'LICENSE'
- '.nvmrc'
- '.gitignore'
- '.yarnclean'
- 'scripts/**'
- 'examples/**'
- 'tsconfig.build.json'
push:
branches:
- master
- dev
- 'renovate/*'
paths-ignore:
- '**.md'
- 'LICENSE'
- '.nvmrc'
- '.gitignore'
- '.yarnclean'
- 'scripts/**'
- 'examples/**'
- 'tsconfig.build.json'
jobs:
prebuild:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- if: github.event_name == 'push'
id: push_commit_msg
run: echo ::set-output name=push_msg::$(git log --format=%B -n 1 HEAD)
- if: github.event_name == 'pull_request'
id: pull_commit_msg
run: echo ::set-output name=pull_msg::$(git log --format=%B -n 1 HEAD^2)
outputs:
commit_message: $( [ -z "${{ steps.pull_commit_msg.outputs.pull_msg }}" ] && echo "${{ steps.push_commit_msg.outputs.push_msg }}" || echo "${{ steps.pull_commit_msg.outputs.pull_msg }}" )
test:
strategy:
matrix:
node-version:
- lts/gallium # most recent release of Node v16, since it's LTS
- 17.0.1 # Node version used in .nvmrc
platform:
- ubuntu-latest
needs:
- prebuild
if: ${{ !contains(needs.prebuild.outputs.commit_message, '[ci notest]') }}
env:
COVERAGE_DIR: ${{ github.workspace }}/coverage
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Set coveralls run flag
id: coveralls_flag
run: |
FLAGVAL=node-${{ matrix.node-version }}
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
FLAGVAL="${FLAGVAL}.pr.${{ github.event.pull_request.number }}"
else
FLAGVAL="${FLAGVAL}.${{ github.ref_name }}"
fi
FLAGVAL="${FLAGVAL}.${{ github.run_id }}/${{ github.run_attempt }}"
echo ::set-output name=coveralls_flag::${FLAGVAL}
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- id: cache_dir
run: echo ::set-output name=dir::$(yarn cache dir)
- uses: actions/cache@v3
id: yarn_cache
with:
path: ${{ steps.cache_dir.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-yarn-
- run: yarn install
if: steps.yarn_cache.outputs.cache-hit != 'true'
- name: Run Tests (Node ${{ matrix.node-version }})
run: yarn -s run coverage:test
env:
REPORTS_DIR: ${{ env.COVERAGE_DIR }}
ETH_RPC_URI: ${{ secrets.ETH_RPC_URI }}
POLYGON_RPC_URI: ${{ secrets.POLYGON_RPC_URI }}
FANTOM_RPC_URI: ${{ secrets.FANTOM_RPC_URI }}
METIS_RPC_URI: ${{ secrets.METIS_RPC_URI }}
ARBITRUM_RPC_URI: ${{ secrets.ARBITRUM_RPC_URI }}
CRONOS_RPC_URI: "https://mmf-rpc.xstaking.sg/"
HARMONY_RPC_URI: "https://harmony-0-rpc.gateway.pokt.network"
INFINITE_APPROVALS_PRIVKEY: ${{ secrets.INFINITE_APPROVALS_PRIVKEY }}
INFINITE_APPROVALS_PRIVKEY_ADDRESS: ${{ secrets.INFINITE_APPROVALS_PRIVKEY_ADDRESS }}
BRIDGE_INTERACTIONS_PRIVKEY: ${{ secrets.BRIDGE_INTERACTIONS_PRIVKEY }}
BRIDGE_INTERACTIONS_PRIVKEY_ADDRESS: ${{ secrets.BRIDGE_INTERACTIONS_PRIVKEY_ADDRESS }}
- name: Generate Coverage report
run: yarn -s run coverage:report
env:
REPORTS_DIR: ${{ env.COVERAGE_DIR }}
- name: Coveralls - Process coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ env.COVERAGE_DIR }}/lcov.info
flag-name: ${{ steps.coveralls_flag.outputs.coveralls_flag }}
parallel: true
send-coverage:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls - Process all coverage results
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true