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(public): SDK monorepo initial migration #1

Merged
merged 67 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
e2a24f1
monorepo adaptation work
adjkant Dec 7, 2023
8ee6d2a
package json cleanup and standardization
adjkant Dec 29, 2023
d394842
remove unused package in publishing
adjkant Dec 29, 2023
761354f
remove unused files
adjkant Jan 9, 2024
b534cd8
v2 all passing
adjkant Jan 9, 2024
7869f12
linting for v3 sdk
adjkant Jan 9, 2024
3e84b3d
permit2 and submodules
adjkant Jan 9, 2024
a498fa3
router sdk linted and cleaned up
adjkant Jan 9, 2024
23dfa63
sdk-core linting
adjkant Jan 9, 2024
37de380
dedupe, x
adjkant Jan 9, 2024
48676c3
working jest
adjkant Jan 9, 2024
5cc71b6
fixes and tuning
adjkant Jan 9, 2024
595a242
cleanup universal router
adjkant Jan 9, 2024
7501cb5
prettier
adjkant Jan 9, 2024
08108ce
ignore prettier on dist
adjkant Jan 9, 2024
59b0912
add top level eslint plugin
adjkant Jan 9, 2024
40578a7
file change
adjkant Jan 10, 2024
a8e46b2
add CI check for build/test/lint
adjkant Jan 10, 2024
8e1040a
yarn install properly
adjkant Jan 10, 2024
92e786d
newline
adjkant Jan 10, 2024
9c9fb36
rename to not be unit test specific
adjkant Jan 10, 2024
865fb85
add nvmrc
adjkant Jan 10, 2024
1067a7d
add env variable for CI
adjkant Jan 10, 2024
25e332d
install forge
adjkant Jan 10, 2024
f7b188e
add node caching, action cleanup
adjkant Jan 10, 2024
c31753d
remove covered workflows
adjkant Jan 10, 2024
d9c8cd7
fixes for merge for lint and new factories
adjkant Mar 11, 2024
c627b7e
add some basic integrity checks
adjkant Mar 11, 2024
7988d77
fix integrity install, fix router packages on merge
adjkant Mar 11, 2024
2d68b99
fix versions on UR
adjkant Mar 11, 2024
59e49fe
fix lint
adjkant Mar 11, 2024
00d9227
fix deps standardization
adjkant Mar 11, 2024
e094568
fix non-internal manypkg
adjkant Mar 11, 2024
707d058
rename files for consistency
adjkant Mar 11, 2024
964c9fd
final manypkg resolutions
adjkant Mar 11, 2024
7a6e811
try removing an ignore
adjkant Mar 11, 2024
9df6b20
remove depcheck (too noisy)
adjkant Mar 11, 2024
4edcbf9
real CODEOWNERS
adjkant Mar 11, 2024
d72cedc
cleanup pass
adjkant Mar 11, 2024
0d59e50
remove baseBranch
adjkant Mar 11, 2024
1028938
beta branch
adjkant Mar 11, 2024
60db34c
vscode config addition
adjkant Mar 11, 2024
cfc2a7d
tune main to be beta
adjkant Mar 11, 2024
606627d
ensure any public scope releases
adjkant Mar 11, 2024
9c309ad
lint, renaming packages properly
adjkant Mar 12, 2024
406496e
patch manypkg to account for unique monorepo structure
adjkant Mar 12, 2024
82b4582
add PR template
adjkant Mar 12, 2024
c96f388
update PR template
adjkant Mar 12, 2024
2acb939
remove unneeded loose dependency
adjkant Mar 12, 2024
8938a99
tune README and PR's
adjkant Mar 13, 2024
3b16ec2
add semgrep as drafted in #2
adjkant Mar 13, 2024
f7006a4
submodules checkout for actions
adjkant Mar 15, 2024
89c7d99
update command for ur to install before forge test
adjkant Mar 18, 2024
30c6840
fixes
adjkant Mar 18, 2024
aef60c8
lint fix
adjkant Mar 18, 2024
675337e
add secret loading
adjkant Apr 10, 2024
e40cc68
fix dupe in lockfile
adjkant Apr 10, 2024
9e6fb40
fix snapshot format
adjkant Apr 10, 2024
4d13b07
README change
adjkant Apr 10, 2024
89ac89e
undo readme change
adjkant Apr 10, 2024
a2f42be
try more verbose
adjkant Apr 10, 2024
c6ab255
confirm secret exists
adjkant Apr 10, 2024
ca3dd15
try again
adjkant Apr 10, 2024
838ddc4
try 16
adjkant Apr 10, 2024
ce11a7b
remove testing changes
adjkant Apr 10, 2024
2a1361c
try backoff
adjkant Apr 10, 2024
fcd962f
retry whole step
adjkant Apr 10, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
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
mr-uniswap marked this conversation as resolved.
Show resolved Hide resolved
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
Loading