Skip to content

Commit

Permalink
SDK (#542)
Browse files Browse the repository at this point in the history
Co-authored-by: Trajan0x <[email protected]>
  • Loading branch information
trajan0x and trajan0x authored Mar 7, 2023
1 parent c114971 commit 3d4e13b
Show file tree
Hide file tree
Showing 110 changed files with 199,514 additions and 18,599 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ module.exports = {
browser: true,
es6: true,
},
ignorePatterns: ['dist', 'coverage', 'packages/contracts-core/hardhat'],
ignorePatterns: ['dist', 'coverage'],
extends: ['plugin:prettier/recommended'],
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
es6: true,
ecmaVersion: 6,
sourceType: 'module',
requireConfigFile: false,
},
plugins: [
'eslint-plugin-import',
Expand All @@ -25,7 +26,7 @@ module.exports = {
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
project: './packages/**/tsconfig.json',
sourceType: 'module',
allowAutomaticSingleRunInference: true,
},
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,20 @@ jobs:
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvmrc

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: 'Use NodeJS by nvmrc'
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '${{steps.nvmrc.outputs.NVMRC}}'
cache: 'yarn'


- name: Initialize Yarn cache
uses: actions/cache@v2
id: yarn-cache
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install Node Dependencies
run: yarn install --frozen-lockfile --check-files
run: yarn install --immutable

- name: Changeset Status
run: npx changeset status
35 changes: 35 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Vercel Preview Deployment
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
VERCEL_TOKEN: '${{ secrets.VERCEL_TOKEN }}'
VERCEL_ORG_ID: '${{ secrets.VERCEL_ORG_ID }}'
VERCEL_PROJECT_ID: '${{ secrets.DOCS_VERCEL_PROJECT_ID }}'
WORKING_DIRECTORY: 'packages/docs'
NODE_ENV: 'production'
on:
push:
branches-ignore:
- master
jobs:
Deploy-Preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvmrc

- name: 'Use NodeJS by nvmrc'
uses: actions/setup-node@v3
with:
node-version: '${{steps.nvmrc.outputs.NVMRC}}'
cache: 'yarn'

- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
20 changes: 7 additions & 13 deletions .github/workflows/foundry-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,21 @@ jobs:
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvmrc

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: 'Use NodeJS by nvmrc'
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '${{steps.nvmrc.outputs.NVMRC}}'
cache: 'yarn'


- name: Initialize Yarn cache
uses: actions/cache@v2
id: yarn-cache
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Installing dependencies
working-directory: ./packages/contracts-core
run: yarn install --frozen-lockfile --check-files
run: yarn install --immutable

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
62 changes: 20 additions & 42 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ jobs:
with:
include_deps: true
github_token: ${{ secrets.WORKFLOW_PAT }}
timeout: '10m'

- uses: docker://ghcr.io/synapsecns/sanguine/git-changes-action:latest
id: filter_go_nodeps
with:
include_deps: false
github_token: ${{ secrets.WORKFLOW_PAT }}
timeout: '10m'

- name: Check For Solidity Changes
id: filter_solidity
Expand Down Expand Up @@ -103,7 +105,7 @@ jobs:
run: docker run -p 8045:8545 -d -v /tmp/keys/:/tmp/keys/ --name rinkeby --restart always trufflesuite/ganache-cli ganache-cli --accounts 10 --account_keys_path /tmp/keys/rinkeby --chainId 4 # --fork https://rinkeby-light.eth.linkpool.io (no need to actually fork)

- name: Go modules cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
# see https://github.com/mvdan/github-actions-golang
path: |
Expand Down Expand Up @@ -185,7 +187,7 @@ jobs:
go-version: ${{ matrix.go-version }}

- name: Go modules cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
# see https://github.com/mvdan/github-actions-golang
path: |
Expand Down Expand Up @@ -311,42 +313,31 @@ jobs:
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvmrc

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: 'Use NodeJS by nvmrc'
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '${{steps.nvmrc.outputs.NVMRC}}'
cache: 'yarn'

- name: Initialize Yarn cache
uses: actions/cache@v2
id: yarn-cache
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install Node Dependencies
run: yarn install --frozen-lockfile --check-files

- name: Install dependencies
run: |
npx lerna bootstrap
run: yarn install --immutable

# Generate flattened files
- name: Run flattener
run: npx lerna exec npm run build:go
run: npx lerna exec npm run build:go --parallel

# Setup Go
- uses: actions/setup-go@v3
with:
go-version: 1.20.x

- name: Go modules cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
# see https://github.com/mvdan/github-actions-golang
path: |
Expand Down Expand Up @@ -428,36 +419,23 @@ jobs:
id: nvmrc
if: ${{ contains(matrix.package, 'agents') }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
if: ${{ contains(matrix.package, 'agents') }}

- name: 'Use NodeJS by nvmrc'
uses: actions/setup-node@v2
uses: actions/setup-node@v3
if: ${{ contains(matrix.package, 'agents') }}
with:
node-version: '${{steps.nvmrc.outputs.NVMRC}}'
if: ${{ contains(matrix.package, 'agents') }}
cache: 'yarn'

- name: Initialize Yarn cache
uses: actions/cache@v2
id: yarn-cache
if: ${{ contains(matrix.package, 'agents') }}
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install Node Dependencies
run: yarn install --frozen-lockfile --check-files
run: yarn install --immutable
if: ${{ contains(matrix.package, 'agents') }}

- name: Install dependencies
if: ${{ contains(matrix.package, 'agents') }}
run: |
npx lerna bootstrap
# Generate flattened files
- name: Run flattener
run: npx lerna exec npm run build:go
Expand All @@ -469,7 +447,7 @@ jobs:
go-version: 1.20.x

- name: Go modules cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
# see https://github.com/mvdan/github-actions-golang
path: |
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/lerna.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish Lerna
on:
pull_request:
types: [closed]
paths:
- 'packages/**'
branches:
- development
- main

jobs:
publish:
# TODO: remove true at the end
if: github.event.pull_request.merged == true || true
runs-on: ubuntu-latest

steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'

- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvmrc

- name: 'Use NodeJS by nvmrc'
uses: actions/setup-node@v3
with:
node-version: '${{steps.nvmrc.outputs.NVMRC}}'
cache: 'yarn'

- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install Node Dependencies
run: yarn install --immutable --immutable-cache --check-cache

- name: Authenticate with private NPM package
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
echo "always-auth=true" >> ~/.npmrc
- name: 'Version and publish' # Interesting step
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# we're not authed with any repository yet so this shouldn't do anything
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor}}@users.noreply.github.com"
if [ ${{ github.base_ref }} = development ]; then
npx lerna version --conventional-commits --conventional-prerelease --preid beta --yes
else
npx lerna version --conventional-commits --conventional-graduate --yes
fi
npx lerna publish from-git --yes --no-verify-access
Loading

0 comments on commit 3d4e13b

Please sign in to comment.