-
Notifications
You must be signed in to change notification settings - Fork 10
131 lines (129 loc) · 4.06 KB
/
ci.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
name: PR builder
on:
pull_request:
branches:
- develop
push:
branches:
- develop
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/setup-node@v1
with:
node-version: '16'
- name: cache node modules
id: cache
uses: actions/cache@v2
with:
path: node_modules
key: node-modules-${{ hashFiles('yarn.lock') }}
- name: install
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
- name: lint
run: yarn lint
- name: build
run: yarn build
- name: unit tests
run: yarn test --coverage
e2e:
needs: ci
runs-on: ubuntu-latest
strategy:
matrix:
test-suite:
# grouped test runs
- "v36-compat"
- "create|call|queries"
- tx
- attestation.*
- cennzx.*
- nft.*
- staking
- rpc.decodeResponse
- send
- getMetadata
- governance
- ethBridge
steps:
- name: start local Eth node setup
uses: actions/checkout@v2
with:
repository: cennznet/bridge-contracts
ref: main
- name: install
run: yarn
- name: build
env:
ETH_ACCOUNT_KEY: ${{ secrets.ETH_ACCOUNT_KEY }}
ROPSTEN_INFURA_API_KEY: ${{ secrets.ROPSTEN_INFURA_API_KEY }}
RINKEBY_INFURA_API_KEY: ${{ secrets.RINKEBY_INFURA_API_KEY }}
MAINNET_INFURA_API_KEY: ${{ secrets.MAINNET_INFURA_API_KEY }}
run: yarn build
- name: start local Eth node
run: |
docker run --dns=127.0.0.1 -dit --name ethNode -p 8545:8545 -p 30303:30303 ethereumoptimism/hardhat
docker container ls -a
- name: Deploy contract and deposit
env:
ETH_ACCOUNT_KEY: ${{ secrets.ETH_ACCOUNT_KEY }}
ROPSTEN_INFURA_API_KEY: ${{ secrets.ROPSTEN_INFURA_API_KEY }}
RINKEBY_INFURA_API_KEY: ${{ secrets.RINKEBY_INFURA_API_KEY }}
MAINNET_INFURA_API_KEY: ${{ secrets.MAINNET_INFURA_API_KEY }}
run: yarn deploy
- uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16'
- name: cache node modules
id: cache
uses: actions/cache@v2
with:
path: node_modules
key: node-modules-${{ hashFiles('yarn.lock') }}
- name: install
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
- name: start v36 test node
if: contains(${{ matrix['test-suite'] }}, 'v36')
run: |
docker run --network=host -d cennznet/cennznet:1.1.1 --dev --ws-external --ws-port=9945 --no-mdns
- name: start latest test node and list all docker container
run: |
docker network create my-bridge-net
docker run --pull=always --network=my-bridge-net --name testnet_node_alice -p 9944:9944 -d cennznet/cennznet:latest --dev --tmp --unsafe-ws-external --unsafe-rpc-external --eth-http=http://ethNode:8545 --no-mdns
docker network connect my-bridge-net ethNode
docker exec testnet_node_alice curl ethNode:8545
- name: test
env:
TEST_TYPE: integration
# arbitrary value to disable internal API logging in test output
NODE_ENV: disable-logging
API_KEY_1: ${{ secrets.API_KEY_1 }}
run: |
npx jest -c jest/integration.config.js "${{ matrix['test-suite'] }}" --bail --forceExit --detectOpenHandles --runInBand
subscribe:
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16'
- name: start latest test node
run: |
docker run --pull=always --network=host -d cennznet/cennznet:latest --dev --tmp --ws-external --rpc-external --no-mdns
- name: run subscriber script at polkadot/rpc-provider version (2.7.1)
working-directory: ./test
run: |
yarn
yarn start