-
Notifications
You must be signed in to change notification settings - Fork 8
feat(devnet): composable local devnet with scenarios, Docker image, and CI #7
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
Merged
Merged
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
5ffcf3c
Chore: Update editorconfig with specific rules
Quantumlyy 1fb31ae
Feat: Introduce core devnet utilities and prool dependency
Quantumlyy 5c0f40e
Feat: Add main devnet runner script
Quantumlyy 8208fa2
Chore: Prepare Docker environment for devnet
Quantumlyy fc891e7
Feat: Integrate devnet into Docker Compose configurations
Quantumlyy a800c50
Chore: Update package.json for devnet scripts and project details
Quantumlyy fbc009e
Test: Add EFP devnet integration tests
Quantumlyy 87e56e7
chore(deps): update bun lockfile
Quantumlyy bf9af22
ci(devnet): add workflow to build, test, and publish devnet image
Quantumlyy c644b32
Potential fix for pull request finding
Quantumlyy 22cad80
Apply suggestions from code review
Quantumlyy 2041d7e
chore(bun): update lockfile format to bun.lock
Quantumlyy 5384d43
refactor: Update SPDX license identifier to MIT in all Solidity files
Quantumlyy 72862fa
chore(dockerfiles): update to use bun.lock
Quantumlyy 0f63bd1
chore(dockerignore): explicitly include bun.lock for docker builds
Quantumlyy 8d72481
fix(devnet): remove extraneous brace in shutdown handlers
Quantumlyy 1dc38a2
Apply suggestions from code review
Quantumlyy c42bcf2
feat: Introduce 'blockTime' for Anvil interval mining
Quantumlyy 9bcb53d
refactor(devnet): Update SetupDevnetOptions to use 'blockTime'
Quantumlyy 898ed76
refactor(devnet): Use 'blockTime' in setupDevnet function
Quantumlyy 0e1e023
refactor(scripts): Replace --no-auto-mine with --block-time in runDevnet
Quantumlyy a49cfe0
ci(build-devnet): limit pull request triggers to relevant paths
Quantumlyy d50b269
style(scripts): remove extraneous closing brace
Quantumlyy 2bd9543
feat(devnet): integrate devnet tests into CI and refine runtime options
Quantumlyy 7140d24
chore(solidity): update SPDX license identifier to UNLICENSED
Quantumlyy 65a94a0
Update scripts/devnet/anvil.ts
Quantumlyy 94616d2
ci(build-devnet): update push trigger branch to master
Quantumlyy 5944bc3
feat(devnet): pin Foundry version in Dockerfile
Quantumlyy 91f847b
fix(devnet): improve private key security in deploy script
Quantumlyy e48f99b
fix(devnet): stop anvil on setup failure
Quantumlyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: build-devnet | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| paths: | ||
| - 'src/**' | ||
| - 'scripts/**' | ||
| - 'lib/**' | ||
| - 'generated/**' | ||
| - 'Dockerfile.devnet' | ||
| - '.dockerignore' | ||
| - 'compose.yml' | ||
| - 'compose.attach.yml' | ||
| - 'foundry.toml' | ||
| - 'package.json' | ||
| - 'bun.lock' | ||
| - '.github/workflows/build-devnet.yml' | ||
|
Quantumlyy marked this conversation as resolved.
Quantumlyy marked this conversation as resolved.
|
||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE: ghcr.io/${{ github.repository }}/devnet | ||
|
|
||
| concurrency: | ||
| group: build-devnet-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build & publish devnet image | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Docker metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.IMAGE }} | ||
| tags: | | ||
| type=ref,event=branch | ||
| type=ref,event=pr | ||
| type=sha,format=long | ||
| type=sha,format=short,prefix=${{ github.ref_name }}-,enable={{is_default_branch}} | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
|
|
||
| - name: Build image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: Dockerfile.devnet | ||
| load: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Smoke test (deploy + seed + health) | ||
| env: | ||
| IMAGE_REF: ${{ env.IMAGE }}:${{ steps.meta.outputs.version }} | ||
| run: | | ||
| docker run -d --name efp-devnet -p 8545:8545 -p 8000:8000 "$IMAGE_REF" | ||
| for i in $(seq 1 90); do | ||
| if curl -fsS http://localhost:8000/health >/dev/null; then | ||
| echo "Healthy after ${i}s" | ||
| exit 0 | ||
| fi | ||
| if [ -z "$(docker ps -q -f name=efp-devnet -f status=running)" ]; then | ||
| echo "::error::container exited early" | ||
| docker logs efp-devnet | ||
| exit 1 | ||
| fi | ||
| sleep 1 | ||
| done | ||
| echo "::error::devnet did not become healthy" | ||
| docker logs efp-devnet | ||
| exit 1 | ||
|
|
||
| - name: Tear down smoke test | ||
| if: always() | ||
| run: docker rm -f efp-devnet || true | ||
|
|
||
| - name: Log in to GHCR | ||
| if: github.event_name != 'pull_request' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Push image | ||
| if: github.event_name != 'pull_request' | ||
| run: docker push --all-tags "${IMAGE}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| FROM oven/bun:1.2.13 | ||
|
|
||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| curl \ | ||
| git \ | ||
| build-essential \ | ||
| ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Foundry | ||
| RUN curl -L https://foundry.paradigm.xyz | bash | ||
| ENV PATH="/root/.foundry/bin:${PATH}" | ||
| RUN foundryup | ||
|
Quantumlyy marked this conversation as resolved.
Outdated
|
||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Install dependencies | ||
| COPY package.json bun.lock ./ | ||
| RUN bun install --frozen-lockfile | ||
|
|
||
| # Copy source and build contracts | ||
| COPY . . | ||
| RUN forge install && forge build | ||
|
|
||
| EXPOSE 8545 8000 | ||
|
|
||
| ENV FOUNDRY_DISABLE_NIGHTLY_WARNING=true | ||
| # Bind to all interfaces inside the container; everything else is env-driven: | ||
| # DEVNET_RPC_URL attach to an existing node (e.g. http://devnet:8545) instead of spawning anvil | ||
| # DEVNET_SCENARIO composable scenario to seed (empty | minimal | demoGraph) | ||
| # DEVNET_CHAIN_ID chain id when spawning a node (default 31337) | ||
| ENV DEVNET_HOST=0.0.0.0 | ||
| ENV DEVNET_SCENARIO=demoGraph | ||
|
|
||
| CMD ["bun", "scripts/runDevnet.ts"] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.