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

chore: convert repo into a yarn workspaces monorepo and add sdk package #888

Merged
merged 20 commits into from
Dec 15, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup

runs:
using: composite

steps:
- name: Enable corepack for modern yarn
shell: bash
run: corepack enable
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
- name: Install dependencies
shell: bash
run: yarn --immutable
- name: Build
shell: bash
run: yarn build
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build

env:
CI: true

on:
push:
branches: "*"
pull_request:
branches: "*"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
35 changes: 18 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
name: Run CI tests
name: CI

env:
CI: true

on:
push:
branches: [main]
pull_request: {}
branches: "*"
paths:
- packages/contracts/**
pull_request:
branches: "*"
paths:
- packages/contracts/**
workflow_dispatch:

jobs:
build:
test-ci:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: yarn install --non-interactive --frozen-lockfile
- name: Checkout
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests
run: yarn test:coverage
- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.json
files: ./packages/contracts/coverage.json
flags: unittests
name: graphprotocol-contracts
fail_ci_if_error: true
49 changes: 26 additions & 23 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
name: Run E2E tests
name: E2E

env:
CI: true

on:
push:
branches: [main]
branches: "*"
paths:
- packages/contracts/contracts/**
- packages/contracts/config/**
- packages/contracts/e2e/**
- packages/contracts/tasks/**
- packages/contracts/scripts/**
- packages/contracts/hardhat.config.ts
pull_request:
branches: "*"
paths:
- contracts/**
- config/**
- e2e/**
- cli/**
- tasks/**
- scripts/**
- hardhat.config.ts
pull_request: {}
- packages/contracts/contracts/**
- packages/contracts/config/**
- packages/contracts/e2e/**
- packages/contracts/tasks/**
- packages/contracts/scripts/**
- packages/contracts/hardhat.config.ts
workflow_dispatch:

jobs:
build:
test-e2e:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: yarn install --non-interactive --frozen-lockfile
- name: Checkout
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Run e2e tests
run: |
git clone https://github.com/edgeandnode/nitro
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/npmpublish.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish package to NPM

on:
workflow_dispatch:
inputs:
package:
description: 'Package to publish'
required: true
type: choice
options:
- contracts
- sdk
tag:
description: 'Tag to publish'
required: true
type: string
default: latest

jobs:
publish:
name: Publish package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Publish 🚀
shell: bash
run: |
pushd packages/${{ inputs.package }}
yarn npm publish --tag ${{ inputs.tag }} --access public
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
20 changes: 8 additions & 12 deletions .github/workflows/verifydeployed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ jobs:
name: Compile contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- run: yarn install --non-interactive --frozen-lockfile
- name: Checkout
uses: actions/checkout@v3
- name: Set up environment
uses: ./.github/actions/setup

- name: Compile contracts
run: yarn build
Expand All @@ -46,12 +44,10 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- run: yarn install --non-interactive --frozen-lockfile
- name: Checkout
uses: actions/checkout@v3
- name: Set up environment
uses: ./.github/actions/setup
- name: Get build artifacts
uses: actions/download-artifact@v3
with:
Expand Down
26 changes: 20 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# Logs
yarn-debug.log*
yarn-error.log*

# Dependency directories
node_modules/

# Ignore build stuff
cache/
build/
dist/
# Yarn
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions

# Hardhat cache
# Hardhat artifacts
artifacts/
cache/
cached/

# Build artifacts
dist/
build/

# Ignore solc bin output
bin/

Expand All @@ -28,4 +42,4 @@ tx-*.log
addresses-fork.json

# Keys
.keystore
.keystore
6 changes: 4 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# contracts
cd packages/contracts
npx --no-install lint-staged
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
Loading