Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy example contract in graph-node #113

Merged
merged 3 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions .github/workflows/on-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,48 @@ on:
- main

jobs:
test:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
- run: yarn
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#use-private-packages
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_TOKEN can't access packages from other private repositories.
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages
NODE_AUTH_TOKEN: ${{ secrets.PAT_PACKAGES }}
- name: Linter check
run: yarn lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
- run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.PAT_PACKAGES }}
- name: Run tests
env:
NODE_AUTH_TOKEN: ${{ secrets.PAT_PACKAGES }}
run: |
yarn build
yarn test:init
yarn test
build:
name: Run docker build
runs-on: ubuntu-latest
Expand Down
33 changes: 30 additions & 3 deletions .github/workflows/on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,48 @@ name: Docker Build
on: [pull_request]

jobs:
test:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
- run: yarn
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#use-private-packages
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_TOKEN can't access packages from other private repositories.
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages
NODE_AUTH_TOKEN: ${{ secrets.PAT_PACKAGES }}
- name: Linter check
run: yarn lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
- run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.PAT_PACKAGES }}
- name: Run tests
env:
NODE_AUTH_TOKEN: ${{ secrets.PAT_PACKAGES }}
run: |
yarn build
yarn test:init
yarn test
build:
name: Run docker build
runs-on: ubuntu-latest
Expand All @@ -28,3 +53,5 @@ jobs:
- uses: actions/checkout@v2
- name: Run docker build
run: make docker-build
env:
NPM_AUTH_TOKEN: ${{ secrets.PAT_PACKAGES }}
File renamed without changes.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM node:16.13.1-alpine3.14

ARG NPM_AUTH_TOKEN
WORKDIR /app

COPY . .

RUN apk --update --no-cache add git && yarn
RUN echo //npm.pkg.github.com/:_authToken=$NPM_AUTH_TOKEN > ~/.npmrc

RUN apk --update --no-cache add git && yarn
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Build docker image
.PHONY: docker-build
docker-build:
docker build -t vulcanize/watcher-ts .
docker build -t vulcanize/watcher-ts --build-arg NPM_AUTH_TOKEN=$(NPM_AUTH_TOKEN) .
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
"scripts": {
"lint": "lerna run lint --stream",
"test": "lerna run test --stream --no-bail",
"test:init": "lerna run test:init --stream --ignore @vulcanize/*-watcher",
"test": "lerna run test --stream --ignore @vulcanize/*-watcher",
"build": "lerna run build --stream",
"build:watch": "lerna run build --stream --parallel -- -w",
"build:contracts": "lerna run build:contracts",
Expand Down
4 changes: 4 additions & 0 deletions packages/graph-node/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ tmp/
temp/

.env

#Hardhat files
cache
artifacts
20 changes: 20 additions & 0 deletions packages/graph-node/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Copyright 2022 Vulcanize, Inc.
//

import '@nomiclabs/hardhat-waffle';

import './test/tasks/example-deploy';

// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more

/**
* @type import('hardhat/config').HardhatUserConfig
*/
export default {
solidity: '0.8.0',
paths: {
sources: './test/contracts'
}
};
11 changes: 8 additions & 3 deletions packages/graph-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"license": "AGPL-3.0",
"devDependencies": {
"@graphprotocol/graph-ts": "^0.22.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@types/chai": "^4.2.18",
"@types/chai-spies": "^1.0.3",
"@types/js-yaml": "^4.0.4",
Expand All @@ -20,10 +22,11 @@
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
"ethers": "^5.2.0",
"hardhat": "^2.3.0",
"mocha": "^8.4.0",
"nodemon": "^2.0.7",
"ts-node": "^10.0.0",
"typescript": "^4.3.2",
"mocha": "^8.4.0"
"typescript": "^4.3.2"
},
"bin": {
"compare-entity": "bin/compare-entity"
Expand All @@ -34,10 +37,12 @@
"asbuild:debug": "asc assembly/index.ts --lib ./node_modules --exportRuntime --target debug --runPasses asyncify --runtime stub --maximumMemory 10",
"asbuild:release": "asc assembly/index.ts --lib ./node_modules --exportRuntime --target release --runPasses asyncify",
"asbuild": "yarn asbuild:debug && yarn asbuild:release",
"test:init": "cp .env.example .env && yarn build:example",
"test": "yarn asbuild:debug && DEBUG=vulcanize:* node node_modules/.bin/_mocha src/**/*.test.ts",
"build:example": "cd test/subgraph/example1 && yarn && yarn codegen && yarn build",
"watch": "DEBUG=vulcanize:* nodemon --watch src src/watcher.ts",
"compare-entity": "node bin/compare-entity"
"compare-entity": "node bin/compare-entity",
"example:deploy": "hardhat --network localhost example-deploy"
},
"dependencies": {
"@apollo/client": "^3.3.19",
Expand Down
4 changes: 2 additions & 2 deletions packages/graph-node/test/subgraph/example1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 example1"
},
"dependencies": {
"@graphprotocol/graph-cli": "ssh://git@github.com:vulcanize/graph-cli.git#graph-watcher",
"@graphprotocol/graph-ts": "^0.22.1"
"@graphprotocol/graph-ts": "^0.22.1",
"@vulcanize/graph-cli": "0.22.5"
}
}
Loading