Add script build-image.sh (#273)

This commit is contained in:
Han
2026-01-27 11:27:14 +09:00
committed by GitHub
parent a9fb04dea8
commit 54ec4894a6
40 changed files with 591 additions and 205 deletions

View File

@@ -1,5 +1,9 @@
name: Check formatting
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:

View File

@@ -1,5 +1,9 @@
name: Test and clippy common crates
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:

View File

@@ -1,9 +1,15 @@
name: Test and clippy Airbender
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,5 +20,4 @@ jobs:
packages: write
with:
zkvm: airbender
toolchain: nightly
skip_prove_test: true

View File

@@ -1,9 +1,15 @@
name: Test and clippy Jolt
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,4 +20,3 @@ jobs:
packages: write
with:
zkvm: jolt
toolchain: 1.88.0

View File

@@ -1,9 +1,15 @@
name: Test and clippy Miden
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,4 +20,3 @@ jobs:
packages: write
with:
zkvm: miden
toolchain: 1.90.0

View File

@@ -1,9 +1,15 @@
name: Test and clippy Nexus
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,4 +20,3 @@ jobs:
packages: write
with:
zkvm: nexus
toolchain: nightly-2025-04-06

View File

@@ -1,9 +1,15 @@
name: Test and clippy OpenVM
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,4 +20,3 @@ jobs:
packages: write
with:
zkvm: openvm
toolchain: nightly

View File

@@ -1,9 +1,15 @@
name: Test and clippy Pico
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,4 +20,3 @@ jobs:
packages: write
with:
zkvm: pico
toolchain: nightly-2025-08-04

View File

@@ -1,9 +1,15 @@
name: Test and clippy Risc0
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,4 +20,3 @@ jobs:
packages: write
with:
zkvm: risc0
toolchain: 1.88.0

View File

@@ -1,9 +1,15 @@
name: Test and clippy SP1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,4 +20,3 @@ jobs:
packages: write
with:
zkvm: sp1
toolchain: 1.88.0

View File

@@ -1,9 +1,15 @@
name: Test and clippy Ziren
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,4 +20,3 @@ jobs:
packages: write
with:
zkvm: ziren
toolchain: nightly

View File

@@ -1,9 +1,15 @@
name: Test and clippy ZisK
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
jobs:
@@ -14,5 +20,4 @@ jobs:
packages: write
with:
zkvm: zisk
toolchain: 1.88.0
skip_prove_test: true

View File

@@ -7,11 +7,6 @@ on:
description: 'zkVM to test'
required: true
type: string
toolchain:
description: 'Rust toolchain to use'
required: false
type: string
default: 1.88.0
# Remove when we use larger runners, currently only needed to skip for zisk
skip_prove_test:
description: 'Whether to skip prove test and ere-dockerized test or not'
@@ -44,9 +39,6 @@ jobs:
- name: Free up disk space
run: bash .github/scripts/free-up-disk-space.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
@@ -59,24 +51,26 @@ jobs:
uses: tj-actions/changed-files@v46
with:
files: |
docker/Dockerfile.base
docker/${{ inputs.zkvm }}/**
scripts/sdk_installers/install_${{ inputs.zkvm }}_sdk.sh
docker/**
scripts/**
- name: Get image metadata
id: image_meta
run: |
ZKVM_CRATE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "ere-${{ inputs.zkvm }}") | .version')
TAG="${{ github.ref_name }}"
SHA="${{ github.sha }}"
GIT_REV="${{ github.sha }}"
if [ "${{ github.event_name }}" == "pull_request" ] && [ "${{ steps.changed_files.outputs.any_changed }}" == "false" ]; then
CACHED_GIT_REV="${{ github.event.pull_request.base.sha }}"
if [ "${{ github.ref_type }}" == "tag" ]; then
IMAGE_TAG="${TAG#v}"
else
CACHED_GIT_REV="$GIT_REV"
IMAGE_TAG="${SHA:0:7}"
fi
IMAGE_TAG="$ZKVM_CRATE_VERSION-${GIT_REV:0:7}"
CACHED_IMAGE_TAG="$ZKVM_CRATE_VERSION-${CACHED_GIT_REV:0:7}"
CACHED_IMAGE_TAG=""
if [ "${{ github.event_name }}" == "pull_request" ] && [ "${{ steps.changed_files.outputs.any_changed }}" == "false" ]; then
CACHED_IMAGE_TAG="${{ github.event.pull_request.base.sha }}"
CACHED_IMAGE_TAG="${CACHED_IMAGE_TAG:0:7}"
fi
IMAGE_REGISTRY="ghcr.io/${{ github.repository }}"
BASE_IMAGE="$IMAGE_REGISTRY/ere-base:$IMAGE_TAG"
@@ -92,47 +86,36 @@ jobs:
echo "compiler_zkvm_image=$COMPILER_ZKVM_IMAGE" >> $GITHUB_OUTPUT
echo "server_zkvm_image=$SERVER_ZKVM_IMAGE" >> $GITHUB_OUTPUT
- name: Build ere-base image
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event.pull_request.head.repo.full_name == github.repository && steps.changed_files.outputs.any_changed == 'true')
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.base
push: true
tags: ${{ steps.image_meta.outputs.base_image }}
- name: Build and push ere-base and ere-base-${{ inputs.zkvm }} images
if: github.event_name == 'push'
run: |
bash .github/scripts/build-image.sh \
--zkvm ${{ inputs.zkvm }} \
--registry ${{ steps.image_meta.outputs.image_registry }} \
--tag ${{ steps.image_meta.outputs.image_tag }} \
--base
docker push ${{ steps.image_meta.outputs.base_image }}
docker push ${{ steps.image_meta.outputs.base_zkvm_image }}
- name: Build ere-base-${{ inputs.zkvm }} image
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event.pull_request.head.repo.full_name == github.repository && steps.changed_files.outputs.any_changed == 'true')
uses: docker/build-push-action@v6
with:
context: .
file: docker/${{ inputs.zkvm }}/Dockerfile.base
push: true
tags: ${{ steps.image_meta.outputs.base_zkvm_image }}
build-args: |
BASE_IMAGE=${{ steps.image_meta.outputs.base_image }}
- name: Build and push ere-compiler-${{ inputs.zkvm }} image
if: github.event_name == 'push'
run: |
bash .github/scripts/build-image.sh \
--zkvm ${{ inputs.zkvm }} \
--registry ${{ steps.image_meta.outputs.image_registry }} \
--tag ${{ steps.image_meta.outputs.image_tag }} \
--compiler
docker push ${{ steps.image_meta.outputs.compiler_zkvm_image }}
- name: Build ere-compiler-${{ inputs.zkvm }} image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: docker/build-push-action@v6
with:
context: .
file: docker/${{ inputs.zkvm }}/Dockerfile.compiler
push: true
tags: ${{ steps.image_meta.outputs.compiler_zkvm_image }}
build-args: |
BASE_ZKVM_IMAGE=${{ steps.image_meta.outputs.base_zkvm_image }}
- name: Build ere-server-${{ inputs.zkvm }} image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: docker/build-push-action@v6
with:
context: .
file: docker/${{ inputs.zkvm }}/Dockerfile.server
push: true
tags: ${{ steps.image_meta.outputs.server_zkvm_image }}
build-args: |
BASE_ZKVM_IMAGE=${{ steps.image_meta.outputs.base_zkvm_image }}
- name: Build and push ere-server-${{ inputs.zkvm }} image
if: github.event_name == 'push'
run: |
bash .github/scripts/build-image.sh \
--zkvm ${{ inputs.zkvm }} \
--registry ${{ steps.image_meta.outputs.image_registry }} \
--tag ${{ steps.image_meta.outputs.image_tag }} \
--server
docker push ${{ steps.image_meta.outputs.server_zkvm_image }}
clippy_via_docker:
name: Clippy via Docker
@@ -148,15 +131,20 @@ jobs:
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: rust-${{ inputs.toolchain }}-${{ inputs.zkvm }}-${{ hashFiles('Cargo.lock') }}
key: rust-${{ inputs.zkvm }}-${{ hashFiles('Cargo.lock') }}
- name: Pull base zkvm image or build locally
if: github.event_name == 'pull_request'
run: |
bash .github/scripts/pull-or-build-base-zkvm-image.sh \
${{ inputs.zkvm }} \
${{ needs.build_image.outputs.image_registry }} \
${{ needs.build_image.outputs.image_tag }} \
${{ needs.build_image.outputs.cached_image_tag }}
--zkvm ${{ inputs.zkvm }} \
--registry ${{ needs.build_image.outputs.image_registry }} \
--tag ${{ needs.build_image.outputs.image_tag }} \
--cached-tag "${{ needs.build_image.outputs.cached_image_tag }}"
- name: Pull base zkvm image
if: github.event_name == 'push'
run: docker pull ${{ needs.build_image.outputs.base_zkvm_image }}
- name: Run cargo clippy for ere-${{ inputs.zkvm }} via Docker
run: |
@@ -197,15 +185,20 @@ jobs:
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: rust-${{ inputs.toolchain }}-${{ inputs.zkvm }}-${{ hashFiles('Cargo.lock') }}
key: rust-${{ inputs.zkvm }}-${{ hashFiles('Cargo.lock') }}
- name: Pull base zkvm image or build locally
if: github.event_name == 'pull_request'
run: |
bash .github/scripts/pull-or-build-base-zkvm-image.sh \
${{ inputs.zkvm }} \
${{ needs.build_image.outputs.image_registry }} \
${{ needs.build_image.outputs.image_tag }} \
${{ needs.build_image.outputs.cached_image_tag }}
--zkvm ${{ inputs.zkvm }} \
--registry ${{ needs.build_image.outputs.image_registry }} \
--tag ${{ needs.build_image.outputs.image_tag }} \
--cached-tag "${{ needs.build_image.outputs.cached_image_tag }}"
- name: Pull base zkvm image
if: github.event_name == 'push'
run: docker pull ${{ needs.build_image.outputs.base_zkvm_image }}
- name: Run cargo test for ere-${{ inputs.zkvm }} via Docker
run: |
@@ -244,40 +237,32 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ inputs.toolchain }}
toolchain: 1.88.0
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
key: rust-${{ inputs.toolchain }}-${{ inputs.zkvm }}-${{ hashFiles('Cargo.lock') }}
key: rust-${{ inputs.zkvm }}-${{ hashFiles('Cargo.lock') }}
- name: Pull images or build locally
if: github.event_name == 'pull_request'
run: |
bash .github/scripts/pull-or-build-base-zkvm-image.sh \
${{ inputs.zkvm }} \
${{ needs.build_image.outputs.image_registry }} \
${{ needs.build_image.outputs.image_tag }} \
${{ needs.build_image.outputs.cached_image_tag }}
--zkvm ${{ inputs.zkvm }} \
--registry ${{ needs.build_image.outputs.image_registry }} \
--tag ${{ needs.build_image.outputs.image_tag }} \
--cached-tag "${{ needs.build_image.outputs.cached_image_tag }}"
# Build ere-compiler-${{ inputs.zkvm }}
echo "Building ere-compiler-${{ inputs.zkvm }}"
docker build \
--file docker/${{ inputs.zkvm }}/Dockerfile.compiler \
--tag ${{ needs.build_image.outputs.compiler_zkvm_image }} \
--build-arg BASE_ZKVM_IMAGE=${{ needs.build_image.outputs.base_zkvm_image }} \
.
# Build ere-server-${{ inputs.zkvm }}
echo "Building ere-server-${{ inputs.zkvm }}"
docker build \
--file docker/${{ inputs.zkvm }}/Dockerfile.server \
--tag ${{ needs.build_image.outputs.server_zkvm_image }} \
--build-arg BASE_ZKVM_IMAGE=${{ needs.build_image.outputs.base_zkvm_image }} \
.
# Build ere-compiler-${{ inputs.zkvm }} and ere-server-${{ inputs.zkvm }}
bash .github/scripts/build-image.sh \
--zkvm ${{ inputs.zkvm }} \
--registry ${{ needs.build_image.outputs.image_registry }} \
--tag ${{ needs.build_image.outputs.image_tag }} \
--compiler \
--server
- name: Pull ere-compiler-${{ inputs.zkvm }} and ere-server-${{ inputs.zkvm }} images
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'push'
run: |
docker pull ${{ needs.build_image.outputs.compiler_zkvm_image }}
docker pull ${{ needs.build_image.outputs.server_zkvm_image }}