-
Notifications
You must be signed in to change notification settings - Fork 261
112 lines (90 loc) · 3.52 KB
/
call.test-local-subgraph.yml
File metadata and controls
112 lines (90 loc) · 3.52 KB
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
name: Reusable Workflow | Run Unit and Integration Tests on Local Subgraph
on:
workflow_call:
env:
DEV_SHELL_NAME: ci-node22
ethereum-contracts-working-directory: ./packages/ethereum-contracts
sdk-core-working-directory: ./packages/sdk-core
subgraph-working-directory: ./packages/subgraph
jobs:
subgraph-unit-tests:
name: Run subgraph unit tests
runs-on: ubuntu-22.04
defaults:
run:
shell: nix develop .#${{ env.DEV_SHELL_NAME }} -c bash -xe {0}
steps:
- uses: actions/checkout@v4
- name: Setup workflow base
id: base
uses: ./.github/actions/setup-workflow-base
with:
package-name: subgraph
cache-key-prefix: subgraph-${{ env.DEV_SHELL_NAME }}-unit-tests-
dev-shell-name: ${{ env.DEV_SHELL_NAME }}
- name: Install dependencies
if: steps.base.outputs.cache-hit != 'true'
run: |
yarn install --frozen-lockfile
npx tsc --version
npx graph --version
- name: Build ethereum contracts
if: steps.base.outputs.cache-hit != 'true'
run: |
yarn lint
yarn build
working-directory: ${{ env.ethereum-contracts-working-directory }}
- name: Run unit tests
if: steps.base.outputs.cache-hit != 'true'
run: yarn matchstick
working-directory: ${{ env.subgraph-working-directory }}
subgraph-integration-tests:
name: Run subgraph integration tests
runs-on: ubuntu-22.04
defaults:
run:
shell: nix develop .#${{ env.DEV_SHELL_NAME }} -c bash -xe {0}
steps:
- uses: actions/checkout@v4
- name: Setup workflow base
id: base
uses: ./.github/actions/setup-workflow-base
with:
package-name: subgraph
cache-key-prefix: subgraph-${{ env.DEV_SHELL_NAME }}-integration-tests-
dev-shell-name: ${{ env.DEV_SHELL_NAME }}
- name: Install dependencies
if: steps.base.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Build contracts
if: steps.base.outputs.cache-hit != 'true'
run: yarn build
working-directory: ${{ env.ethereum-contracts-working-directory }}
- name: Build SDK core
if: steps.base.outputs.cache-hit != 'true'
# build sdk-core because subgraph tests use sdk-core
run: yarn build
working-directory: ${{ env.sdk-core-working-directory }}
- name: Start hardhat node
if: steps.base.outputs.cache-hit != 'true'
run: ./tasks/startHardhatNode.sh start
working-directory: ${{ env.sdk-core-working-directory }}
- name: Deploy framework and tokens
if: steps.base.outputs.cache-hit != 'true'
run: npx hardhat run dev-scripts/run-deploy-contracts-and-token.js --network localhost
working-directory: ${{ env.ethereum-contracts-working-directory }}
- name: Prepare files for local testing
if: steps.base.outputs.cache-hit != 'true'
run: yarn prepare-local
working-directory: ${{ env.subgraph-working-directory }}
- name: Setup graph node
if: steps.base.outputs.cache-hit != 'true'
run: |
./tasks/setup-graph-node.sh &
# wait for it to warm up
sleep 15
working-directory: ${{ env.subgraph-working-directory }}
- name: Run subgraph integration test suite
if: steps.base.outputs.cache-hit != 'true'
run: yarn test --network localhost
working-directory: ${{ env.subgraph-working-directory }}