Skip to content

Commit c595d2e

Browse files
authored
move to monorepo structure with pnpm (#1003)
* move to monorepo * remove extra lockfile * migrate to GH Actions (#1004) * ci: move to GH actions * remove travis * ci: setup commit author in git * try rm git * Revert "try rm git" This reverts commit 6e7cbf2. * lets try global * ci: event handler test * Fix postgres version * Fix option * try new style * fix redefine issue * skip node 14 for now * update image * remove * remove * remove generated * more generated * update gitignore
1 parent 81ef34c commit c595d2e

File tree

270 files changed

+7551
-7658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+7551
-7658
lines changed

.github/workflows/ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Tests
2+
env:
3+
NODE_NO_WARNINGS: true
4+
on:
5+
push:
6+
branches:
7+
- 'main'
8+
pull_request:
9+
10+
jobs:
11+
cli:
12+
name: CLI / nodejs v${{ matrix.node-version }}
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
# For some reason tests take forever on node 14 so will re-visit in future when we decide what versions to test on
18+
node-version: [16, 18]
19+
steps:
20+
- name: Checkout Repository
21+
uses: actions/checkout@v3
22+
23+
- name: Install Node
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Install pnpm
29+
uses: pnpm/[email protected]
30+
with:
31+
version: 7
32+
33+
- name: Setup git user information
34+
run: |
35+
git config --global user.name "$(git log -n 1 --pretty=format:%an)"
36+
git config --global user.email "$(git log -n 1 --pretty=format:%ae)"
37+
38+
- name: Get pnpm store path
39+
id: pnpm-store
40+
run: echo "PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
41+
42+
- name: Cache pnpm
43+
uses: actions/cache@v3
44+
with:
45+
path: ${{ steps.pnpm-store.outputs.PATH }}
46+
key: ${{ runner.os }}-pnpm-store-graphql-v${{ matrix.graphql-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pnpm-store-graphql-v${{ matrix.graphql-version }}-
49+
50+
- name: Install Dependencies
51+
run: pnpm i
52+
53+
- name: Build Packages
54+
run: pnpm build
55+
56+
- name: Run Tests
57+
uses: nick-fields/retry@v2
58+
with:
59+
timeout_minutes: 10
60+
max_attempts: 3
61+
command: pnpm run test:cli -- --forceExit
62+
63+
event-handler:
64+
name: Basic Event Handlers
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout Repository
68+
uses: actions/checkout@v3
69+
70+
- name: Install Node
71+
uses: actions/setup-node@v3
72+
with:
73+
node-version: 18
74+
75+
- name: Install pnpm
76+
uses: pnpm/[email protected]
77+
with:
78+
version: 7
79+
80+
- name: Get pnpm store path
81+
id: pnpm-store
82+
run: echo "PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
83+
84+
- name: Cache pnpm
85+
uses: actions/cache@v3
86+
with:
87+
path: ${{ steps.pnpm-store.outputs.PATH }}
88+
key: ${{ runner.os }}-pnpm-store-graphql-v${{ matrix.graphql-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
89+
restore-keys: |
90+
${{ runner.os }}-pnpm-store-graphql-v${{ matrix.graphql-version }}-
91+
92+
- name: Install Dependencies
93+
run: pnpm i
94+
95+
- name: Build Packages
96+
run: pnpm build
97+
98+
- name: Run Tests
99+
uses: nick-fields/retry@v2
100+
with:
101+
timeout_minutes: 10
102+
max_attempts: 3
103+
command: pnpm run --filter="basic-event-handlers" test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ examples/example-subgraph/generated
6666
examples/example-subgraph/node_modules
6767

6868
# validation tests output
69-
tests/cli/validation/*/generated
69+
*/tests/cli/validation/*/generated
7070

7171
# Ignore Mac DS_Store files
7272
.DS_Store

.travis.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: '3'
2+
services:
3+
graph-node:
4+
image: graphprotocol/graph-node:latest
5+
ports:
6+
- '18000:8000'
7+
- '18001:8001'
8+
- '18020:8020'
9+
- '18030:8030'
10+
- '18040:8040'
11+
depends_on:
12+
- ipfs
13+
- ethereum
14+
- postgres
15+
environment:
16+
postgres_host: postgres
17+
postgres_user: graph
18+
postgres_pass: let-me-in
19+
postgres_db: graph
20+
ipfs: 'ipfs:5001'
21+
ethereum: 'test:http://ethereum:8545'
22+
GRAPH_LOG: trace
23+
ethereum:
24+
image: trufflesuite/ganache-cli:latest
25+
ports:
26+
- '18545:8545'
27+
- '18546:8546'
28+
command: -d -l 100000000000 -g 1 --noVMErrorsOnRPCResponse
29+
ipfs:
30+
image: ipfs/go-ipfs:v0.4.23
31+
ports:
32+
- '15001:5001'
33+
postgres:
34+
image: postgres
35+
ports:
36+
- '15432:5432'
37+
environment:
38+
POSTGRES_USER: graph
39+
POSTGRES_PASSWORD: let-me-in
40+
POSTGRES_DB: graph

examples/basic-event-handlers/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"name": "basic-event-handlers",
33
"version": "0.1.0",
44
"scripts": {
5-
"codegen": "../../bin/graph codegen",
6-
"build": "../../bin/graph build",
7-
"test": "truffle test --network test",
8-
"create-test": "../../bin/graph create test/basic-event-handlers --node http://127.0.0.1:18020",
9-
"deploy-test": "../../bin/graph deploy test/basic-event-handlers --version-label v0.0.1 --ipfs http://localhost:15001 --node http://127.0.0.1:18020"
5+
"codegen": "../../packages/cli/bin/graph codegen",
6+
"build": "../../packages/cli/bin/graph build",
7+
"test": "docker compose up -d && sleep 30 && truffle test --network test && docker compose down",
8+
"create-test": "../../packages/cli/bin/graph create test/basic-event-handlers --node http://127.0.0.1:18020",
9+
"deploy-test": "../../packages/cli/bin/graph deploy test/basic-event-handlers --version-label v0.0.1 --ipfs http://localhost:15001 --node http://127.0.0.1:18020"
1010
},
1111
"devDependencies": {
1212
"@graphprotocol/graph-ts": "0.28.1",

0 commit comments

Comments
 (0)