Skip to content

Commit

Permalink
chore: convert repo into a yarn workspaces monorepo and add sdk packa…
Browse files Browse the repository at this point in the history
…ge (#888)

* chore: convert repo into a yarn workspaces monorepo

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* chore: add sdk

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* chore: fix cross reference dependencies and add readme

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* ci: fix setup action

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* ci: use yarn v4

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* ci: add missing property to setup action

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* ci: add more missing properties

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* ci: refactor corepack enable

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* ci: run for all branches and prs

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* ci: fix coverage file path

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* ci: add workflow dispatch trigger

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* chore: trigger ci

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* chore: update README

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* test: fix failing tests

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* chore: minor nits

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* chore: fixup prettier config

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* chore: roll back prettier-plugin-solidity to old version to avoid reformatting

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* chore: bump packages versions and add publish ci action

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

* docs: update readme with versioning and publishing instructions

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>

---------

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
  • Loading branch information
tmigone authored Dec 15, 2023
1 parent ca06ef3 commit 93a2a46
Show file tree
Hide file tree
Showing 466 changed files with 26,546 additions and 15,067 deletions.
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

0 comments on commit 93a2a46

Please sign in to comment.