Skip to content

Commit bdc6613

Browse files
authored
Main upgrades in preparation for contract PRs (#1184)
- Upgrade to pnpm, improving package management and converging with Horizon. - Restructure packages to remove dependency cycles. Instead of the sdk depending on contracts and contracts on sdk, contracts has child packages contracts-test and contracts-task that depend on sdk but that sdk does not depend on. These child packages depend on sdk, while contracts does not. A common package has also been created for shared dependencies of contract packages. There are now no dependency cycles, no SKIP_LOAD compiles, and dynamic loading has been converted to static imports. - Numerous lint issues have been fixed. ESLint upgraded to v9 and natspec-smells linting added. - GH workflows have been simplified. One for linting, one for build, test, and coverage test. Workflows use pnpm to find build, test, and test:coverage targets rather than needing separate configuration or per package workflows.
1 parent cbda0fc commit bdc6613

File tree

385 files changed

+34184
-34336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+34184
-34336
lines changed

.changeset/smooth-balloons-stare.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.devcontainer/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ RUN curl -L https://foundry.paradigm.xyz | bash && \
6161
chmod 755 /usr/local/bin/forge && \
6262
chmod 755 /usr/local/bin/chisel
6363

64-
# Set up yarn and pnpm
64+
# Set up pnpm
6565
RUN corepack enable && \
66-
corepack prepare [email protected] --activate && \
6766
corepack prepare [email protected] --activate
6867

6968
# Ensure all users have access to the tools

.devcontainer/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The container uses a conservative caching approach to prevent cache corruption i
3333
- Python packages: `/home/vscode/.cache/pip`
3434

3535
3. **Intentionally Not Cached**: These tools use their default cache locations to avoid contamination
36-
- NPM, Yarn (different dependency versions per branch)
36+
- NPM (different dependency versions per branch)
3737
- Foundry, Solidity (different compilation artifacts per branch)
3838
- Hardhat (different build artifacts per branch)
3939

@@ -49,7 +49,7 @@ To start the dev container:
4949

5050
When the container starts, the `project-setup.sh` script will automatically run and:
5151

52-
- Install project dependencies using yarn
52+
- Install project dependencies using pnpm
5353
- Configure Git to use SSH signing with your forwarded SSH key
5454
- Source shell customizations if available in PATH
5555

@@ -79,8 +79,8 @@ These environment variables are needed for Git commit signing to work properly.
7979
If you encounter build or compilation issues that seem related to cached artifacts:
8080

8181
1. **Rebuild the container**: This will start with fresh local caches
82-
2. **Clean project caches**: Run `yarn clean` to clear project-specific build artifacts
83-
3. **Clear node modules**: Delete `node_modules` and run `yarn install` again
82+
2. **Clean project caches**: Run `pnpm clean` to clear project-specific build artifacts
83+
3. **Clear node modules**: Delete `node_modules` and run `pnpm install` again
8484

8585
### Git SSH Signing Issues
8686

.devcontainer/docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ services:
2424
- GH_CONFIG_DIR=/home/vscode/.cache/github
2525
- PIP_CACHE_DIR=/home/vscode/.cache/pip
2626

27-
# Note: NPM, Yarn, Foundry, and Solidity caches are intentionally not set
27+
# pnpm cache is safe to share due to content-addressable storage
28+
- PNPM_HOME=/home/vscode/.local/share/pnpm
29+
- PNPM_CACHE_DIR=/home/vscode/.cache/pnpm
30+
31+
# Note: NPM, Foundry, and Solidity caches are intentionally not set
2832
# to avoid cross-branch contamination. Tools will use their default locations.
2933
volumes:
3034
# Git repo root

.devcontainer/project-setup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ echo "User directories set up with proper permissions"
2424
# Install project dependencies
2525
echo "Installing project dependencies..."
2626
if [ -f "$REPO_ROOT/package.json" ]; then
27-
echo "Running yarn to install dependencies..."
27+
echo "Running pnpm to install dependencies..."
2828
cd "$REPO_ROOT"
29-
# Note: With set -e, if yarn fails, the script will exit
29+
# Note: With set -e, if pnpm fails, the script will exit
3030
# This is desirable as we want to ensure dependencies are properly installed
31-
yarn
31+
pnpm install
3232
else
3333
echo "No package.json found in the root directory, skipping dependency installation"
3434
fi

.github/actions/setup/action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ runs:
99
run: |
1010
sudo apt-get update
1111
sudo apt-get install -y libudev-dev libusb-1.0-0-dev
12-
- name: Enable corepack for modern yarn
12+
- name: Install Foundry
13+
uses: foundry-rs/foundry-toolchain@v1
14+
- name: Enable Corepack
1315
shell: bash
1416
run: corepack enable
1517
- name: Install Node.js
1618
uses: actions/setup-node@v4
1719
with:
1820
node-version: 20
19-
cache: 'yarn'
21+
cache: 'pnpm'
22+
- name: Set up pnpm via Corepack
23+
shell: bash
24+
run: corepack prepare [email protected] --activate
2025
- name: Install dependencies
2126
shell: bash
22-
run: yarn --immutable
27+
run: pnpm install --frozen-lockfile

.github/workflows/build-test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Test
2+
3+
env:
4+
CI: true
5+
STUDIO_API_KEY: ${{ secrets.STUDIO_API_KEY }}
6+
7+
on:
8+
pull_request:
9+
branches: '*'
10+
workflow_dispatch:
11+
12+
jobs:
13+
test:
14+
name: Build and Test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
22+
- name: Set up environment
23+
uses: ./.github/actions/setup
24+
25+
- name: Build all packages
26+
run: pnpm -r --sequential run build
27+
28+
- name: Test all packages
29+
run: pnpm -r --sequential run test
30+
31+
- name: Test with coverage
32+
run: pnpm -r --sequential run test:coverage
33+
34+
- name: Find coverage files
35+
id: coverage_files
36+
run: |
37+
# Find all coverage-final.json files
38+
COVERAGE_FILES=$(find ./packages -name "coverage-final.json" -path "*/reports/coverage/*" | tr '\n' ',' | sed 's/,$//')
39+
echo "files=$COVERAGE_FILES" >> $GITHUB_OUTPUT
40+
echo "Found coverage files: $COVERAGE_FILES"
41+
42+
- name: Upload coverage reports
43+
if: steps.coverage_files.outputs.files != ''
44+
uses: codecov/codecov-action@v3
45+
with:
46+
token: ${{ secrets.CODECOV_TOKEN }}
47+
files: ${{ steps.coverage_files.outputs.files }}
48+
flags: unittests
49+
name: graphprotocol-contracts
50+
fail_ci_if_error: true

.github/workflows/build.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/ci-contracts.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/ci-data-edge.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)