-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add Docker support for running upgrade scripts #65
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
base: main
Are you sure you want to change the base?
Changes from all commits
c750bda
1f0f4f3
eea7623
c5948fa
4c8edb8
9cb07c5
c445d7d
15b87cf
a8adfeb
4d391f9
c5520f7
c93b86f
92fbc31
e3addac
596182b
9dc0108
6dd231f
aaa6eea
ead0814
7977435
2f30dde
05c1282
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Dependencies (will be installed fresh in container) | ||
| node_modules/ | ||
|
|
||
| # Build artifacts (will be built fresh in container) | ||
| out/ | ||
| cache_forge/ | ||
| cache/ | ||
| artifacts/ | ||
| typechain-types/ | ||
|
|
||
| # Environment files (contain secrets) | ||
| .env | ||
| .env.* | ||
| !.env.example | ||
|
|
||
| # Git | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
|
|
||
| # Test artifacts | ||
| broadcast/ | ||
| coverage/ | ||
|
|
||
| # Docker | ||
| Dockerfile | ||
| .dockerignore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| lib/ | ||
| dist/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Publish Docker | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: ['v*'] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Build and Push Docker Image | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: stable | ||
|
|
||
| - name: Install forge dependencies | ||
| run: forge install | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Extract metadata for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: offchainlabs/chain-actions | ||
| tags: | | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
| type=semver,pattern={{version}} | ||
| type=semver,pattern={{major}}.{{minor}} | ||
| type=ref,event=branch | ||
|
Comment on lines
+37
to
+43
|
||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Test Docker | ||
|
|
||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test-docker: | ||
| name: Test Docker Image | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: stable | ||
|
|
||
| - name: Install forge dependencies | ||
| run: forge install | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| load: true | ||
| tags: orbit-actions:test | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Run Docker smoke tests | ||
| run: ./test/docker/test-docker.bash | ||
| env: | ||
| DOCKER_IMAGE: orbit-actions:test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| node_modules | ||
| .env | ||
| .DS_Store | ||
|
|
||
| # TypeScript build output | ||
| /dist | ||
|
|
||
| # Hardhat files | ||
| /cache | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||||
| FROM node:18-slim | ||||||||
|
|
||||||||
| # Install dependencies for Foundry, git, and jq (for JSON parsing in upgrade scripts) | ||||||||
| RUN apt-get update && apt-get install -y \ | ||||||||
| curl \ | ||||||||
| git \ | ||||||||
| jq \ | ||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||
|
|
||||||||
| # Install Foundry | ||||||||
| ENV PATH="/root/.foundry/bin:${PATH}" | ||||||||
| RUN curl -L https://foundry.paradigm.xyz | bash && foundryup | ||||||||
|
|
||||||||
| # Install Yarn Classic (v1) - matches the repo's yarn.lock format | ||||||||
| RUN npm install -g --force yarn@1.22.22 | ||||||||
|
|
||||||||
| WORKDIR /app | ||||||||
|
|
||||||||
| # Copy package files first for better layer caching | ||||||||
| COPY package.json yarn.lock ./ | ||||||||
|
|
||||||||
| # --ignore-scripts: forge install runs separately after full copy | ||||||||
| RUN yarn install --frozen-lockfile --ignore-scripts | ||||||||
|
|
||||||||
| COPY . . | ||||||||
|
||||||||
| COPY . . | |
| COPY . . | |
| RUN forge install |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| pragma solidity 0.8.16; | ||
|
|
||
| import "forge-std/Script.sol"; | ||
|
|
||
| interface IRollupCore { | ||
| function wasmModuleRoot() external view returns (bytes32); | ||
| } | ||
|
|
||
| /** | ||
| * @title VerifyNitroContracts1Point2Point1Upgrade | ||
| * @notice Verifies the upgrade to Nitro Contracts 1.2.1 by checking the wasmModuleRoot | ||
| */ | ||
| contract VerifyNitroContracts1Point2Point1Upgrade is Script { | ||
| function run() public view { | ||
| address rollup = vm.envAddress("ROLLUP"); | ||
| bytes32 wasmRoot = IRollupCore(rollup).wasmModuleRoot(); | ||
| console.log("wasmModuleRoot:"); | ||
| console.logBytes32(wasmRoot); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| pragma solidity 0.8.16; | ||
|
|
||
| import "forge-std/Script.sol"; | ||
|
|
||
| interface IRollupCore { | ||
| function wasmModuleRoot() external view returns (bytes32); | ||
| } | ||
|
|
||
| /** | ||
| * @title VerifyNitroContracts2Point1Point0Upgrade | ||
| * @notice Verifies the upgrade to Nitro Contracts 2.1.0 by checking the wasmModuleRoot | ||
| */ | ||
| contract VerifyNitroContracts2Point1Point0Upgrade is Script { | ||
| function run() public view { | ||
| address rollup = vm.envAddress("ROLLUP"); | ||
| bytes32 wasmRoot = IRollupCore(rollup).wasmModuleRoot(); | ||
| console.log("wasmModuleRoot:"); | ||
| console.logBytes32(wasmRoot); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| pragma solidity 0.8.16; | ||
|
|
||
| import "forge-std/Script.sol"; | ||
|
|
||
| interface IInbox { | ||
| function bridge() external view returns (address); | ||
| } | ||
|
|
||
| interface IBridge { | ||
| function nativeTokenDecimals() external view returns (uint8); | ||
| } | ||
|
|
||
| /** | ||
| * @title VerifyNitroContracts2Point1Point2Upgrade | ||
| * @notice Verifies the upgrade to Nitro Contracts 2.1.2 by checking nativeTokenDecimals | ||
| */ | ||
| contract VerifyNitroContracts2Point1Point2Upgrade is Script { | ||
| function run() public view { | ||
| address inbox = vm.envAddress("INBOX_ADDRESS"); | ||
| address bridge = IInbox(inbox).bridge(); | ||
| uint8 decimals = IBridge(bridge).nativeTokenDecimals(); | ||
| console.log("nativeTokenDecimals:", decimals); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.