Skip to content

Commit

Permalink
chore(public): SDK monorepo initial migration (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
adjkant authored Apr 10, 2024
1 parent 483f8fe commit e501b23
Show file tree
Hide file tree
Showing 149 changed files with 21,845 additions and 56,091 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @uniswap/protocols
24 changes: 24 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## PR Scope

Please title your PR according to the following types and scopes following [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/):

- `fix(SDK name):` will trigger a patch version
- `<type>(public):` will trigger a patch version for non-code changes (e.g. README changes)
- `feat(SDK name):` will trigger a minor version
- `feat(!):` will trigger a major version for a breaking change

## Description

_[Summary of the change, motivation, and context]_

## How Has This Been Tested?

_[e.g. Manually, E2E tests, unit tests, Storybook]_

## (Optional) Feedback Focus

_[Specific parts of this PR you'd like feedback on, or that reviewers should pay closer attention to]_

## (Optional) Follow Ups

_[Things that weren't addressed in this PR, ways you plan to build on this work, or other ways this work could be extended]_
66 changes: 66 additions & 0 deletions .github/workflows/monorepo-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "Code Quality Checks"

on:
workflow_call:

pull_request:
types:
- opened
- synchronize
- reopened

jobs:
build-and-test:
name: Lint, Build, and Test
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
defaults:
run:
working-directory: ./

steps:
- name: ✅ Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
submodules: "true"
fetch-depth: 2

- name: 💽 Node and Caching
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7
with:
cache: yarn
node-version: 18

- name: 📥 yarn install
shell: bash
working-directory: ./
run: |
yarn --immutable
env:
# CI optimizations. Overrides yarnrc.yml options (or their defaults) in the CI action.
YARN_ENABLE_GLOBAL_CACHE: "false" # Use local cache folder to keep downloaded archives
YARN_NM_MODE: "hardlinks-local" # Hardlinks-local reduces io / node_modules size
HUSKY: "0" # By default do not run HUSKY install

- name: 🔬 Lint
run: yarn g:lint

- name: 🏗 Build
run: yarn g:build

- name: 🪨 Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: 🧪 Testing
uses: nick-fields/retry@7d4a37704547a311dbb66ebdf5b23ec19374a767
env:
FORK_URL: ${{ secrets.FORK_URL }}
with:
timeout_minutes: 20
retry_wait_seconds: 2
max_attempts: 3
command: yarn g:test
49 changes: 49 additions & 0 deletions .github/workflows/monorepo-integrity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Monorepo Integrity"

on:
pull_request:
branches:
- "**"
push:
branches:
- main

jobs:
monorepo-integrity:
name: Check monorepo integrity
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
fetch-depth: 2
submodules: "true"

- name: 💽 Node and Caching
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7
with:
cache: yarn
node-version: 18

- name: 📥 yarn install
shell: bash
working-directory: ./
run: |
yarn --immutable
env:
# CI optimizations. Overrides yarnrc.yml options (or their defaults) in the CI action.
YARN_ENABLE_GLOBAL_CACHE: "false" # Use local cache folder to keep downloaded archives
YARN_NM_MODE: "hardlinks-local" # Hardlinks-local reduces io / node_modules size
HUSKY: "0" # By default do not run HUSKY install

- name: 👬🏽 Check for conflicting versions across the monorepo
run: yarn g:check:deps:mismatch

- name: 👬🏽 Check for duplicate dependencies in lock file
run: yarn dedupe --check

- name: 🧑‍⚖️ Check for yarn constraints.pro
run: yarn constraints
45 changes: 45 additions & 0 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
name: Release
environment:
name: production
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
submodules: "true"
fetch-depth: 2

- name: Setup Node
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7
with:
cache: yarn
node-version: 18

- name: Install dependencies
run: yarn --immutable

- name: Build SDK's
run: yarn g:build

- name: Load Secrets
uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0
with:
# Export loaded secrets as environment variables
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
NPM_TOKEN: op://sdk-npm-deploys/npm-token/secret

- name: Release Needed SDK's
env:
NPM_CONFIG_USERCONFIG: /dev/null
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ env.NPM_TOKEN }}
run: yarn g:release
22 changes: 22 additions & 0 deletions .github/workflows/semgrep.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Semgrep
on:
workflow_dispatch: {}
pull_request: {}
push:
branches:
- main
schedule:
# random HH:MM to avoid a load spike on GitHub Actions at 00:00
- cron: "35 11 * * *"
jobs:
semgrep:
name: semgrep/ci
runs-on: ubuntu-20.04
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
container:
image: returntocorp/semgrep
if: (github.actor != 'dependabot[bot]')
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- run: semgrep ci
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# .yarn files
.yarn/cache
.yarn/versions
.yarn/install-state.gz

# Turbo
.turbo

# dependencies
node_modules
25 changes: 25 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Permit2 SDK
[submodule "sdks/permit2-sdk/permit2"]
path = sdks/permit2-sdk/permit2
url = https://github.com/Uniswap/permit2
[submodule "sdks/permit2-sdk/lib/forge-std"]
path = sdks/permit2-sdk/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "sdks/permit2-sdk/lib/solmate"]
path = sdks/permit2-sdk/lib/solmate
url = https://github.com/transmissions11/solmate

# Universal Router
[submodule "sdks/universal-router-sdk/lib/forge-std"]
path = sdks/universal-router-sdk/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "sdks/universal-router-sdk/lib/solmate"]
path = sdks/universal-router-sdk/lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "sdks/universal-router-sdk/lib/permit2"]
path = sdks/universal-router-sdk/lib/permit2
url = https://github.com/Uniswap/permit2
[submodule "sdks/universal-router-sdk/lib/openzeppelin-contracts"]
path = sdks/universal-router-sdk/lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
branch = v4.8.0
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib",
"solidity.compileUsingRemoteVersion": "v0.8.17",
"solidity.formatter": "forge",
"files.insertFinalNewline": true,
"editor.formatOnSave": true,
"eslint.workingDirectories": [
"./sdks/permit2-sdk",
"./sdks/router-sdk",
"./sdks/sdk-core",
"./sdks/uniswapx-sdk",
"./sdks/universal-router-sdk",
"./sdks/v2-sdk",
"./sdks/v3-sdk",
],
"testing.openTesting": "neverOpen"
}
Loading

0 comments on commit e501b23

Please sign in to comment.