v0.7.6-2 #33
Workflow file for this run
This file contains 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
--- | |
name: release | |
on: | |
release: | |
types: [published] | |
env: | |
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/node | |
DOCKER_USERNAME: ${{ github.actor }} | |
INDEXER_IMAGE: ghcr.io/${{ github.repository }}/indexer | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest-16-cores | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Install Foundry | |
- name: install foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
# Install UV | |
- uses: astral-sh/setup-uv@v2 | |
with: | |
enable-cache: true | |
cache-dependency-glob: lib/kakarot/uv.lock | |
- uses: actions/setup-python@v5 | |
with: | |
python-version-file: lib/kakarot/.python-version | |
- name: Install asdf & tools | |
uses: asdf-vm/actions/setup@v3 | |
- name: install scarb | |
run: | | |
asdf plugin add scarb | |
asdf install scarb 2.6.5 | |
asdf install scarb 0.7.0 | |
- name: Setup the Kakarot submodule | |
run: make setup | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: ./.kakarot | |
include-hidden-files: true | |
# Inspired by Reth CI. | |
# <https://github.com/paradigmxyz/reth/blob/027d50fc105fd527dca0bf56fe51b7240f119e66/.github/workflows/docker.yml> | |
build: | |
runs-on: ubuntu-latest-16-cores | |
needs: prepare | |
strategy: | |
matrix: | |
include: | |
- platform: amd64 | |
target: x86_64-unknown-linux-gnu | |
- platform: arm64 | |
target: aarch64-unknown-linux-gnu | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: ./.kakarot | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
toolchain: 1.82.0 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- uses: taiki-e/install-action@cross | |
- name: Build | |
run: | | |
RUSTFLAGS="-C link-arg=-lgcc -Clink-arg=-static-libgcc" \ | |
cross build --bin kakarot-rpc --release --target ${{ matrix.target }} | |
mkdir -p ./bin/${{ matrix.platform }} | |
mv target/${{ matrix.target }}/release/kakarot-rpc ./bin/${{ matrix.platform }}/kakarot-rpc | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.platform }} | |
path: ./bin/${{ matrix.platform }}/kakarot-rpc | |
build-push-docker: | |
runs-on: ubuntu-latest | |
needs: build | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-amd64 | |
path: ./bin/amd64/kakarot-rpc | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-arm64 | |
path: ./bin/arm64/kakarot-rpc | |
- name: Log in to Docker | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username ${DOCKER_USERNAME} --password-stdin | |
- name: Set up Docker builder | |
run: | | |
docker run --privileged --rm tonistiigi/binfmt --install amd64,arm64 | |
docker buildx create --use --name cross-builder | |
- name: Build and push image, tag as "latest" | |
run: | | |
docker buildx build \ | |
--file ./docker/rpc/Dockerfile.cross . \ | |
--platform linux/amd64,linux/arm64 \ | |
--tag ${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }} \ | |
--tag ${{ env.REGISTRY_IMAGE }}:latest \ | |
--push | |
build-push-indexer-docker: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
include: | |
- platform: linux/amd64 | |
apibara_download_url: https://github.com/apibara/dna/releases/download/sink-mongo%2Fv0.9.2/sink-mongo-x86_64-linux.gz | |
- platform: linux/arm64 | |
apibara_download_url: https://github.com/apibara/dna/releases/download/sink-mongo%2Fv0.9.2/sink-mongo-aarch64-linux.gz | |
steps: | |
- name: Prepare | |
run: | | |
platform=${{ matrix.platform }} | |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.INDEXER_IMAGE }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ env.DOCKER_USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: ${{ matrix.platform }} | |
file: ./docker/indexer/Dockerfile | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: | |
type=image,name=${{ env.INDEXER_IMAGE | |
}},push-by-digest=true,name-canonical=true,push=true | |
build-args: | | |
APIBARA_DOWNLOAD_URL=${{ matrix.apibara_download_url }} | |
- name: Export digest | |
run: | | |
mkdir -p /tmp/digests | |
digest="${{ steps.build.outputs.digest }}" | |
touch "/tmp/digests/${digest#sha256:}" | |
- name: Upload digest | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-${{ env.PLATFORM_PAIR }} | |
path: /tmp/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
merge-indexer: | |
runs-on: ubuntu-latest | |
needs: | |
- build-push-indexer-docker | |
steps: | |
- name: Download digests | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/digests | |
pattern: digests-* | |
merge-multiple: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.INDEXER_IMAGE }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ env.DOCKER_USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create manifest list and push | |
working-directory: /tmp/digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf '${{ env.INDEXER_IMAGE }}@sha256:%s ' *) | |
- name: Inspect image | |
run: | | |
docker buildx imagetools inspect ${{ env.INDEXER_IMAGE }}:${{ steps.meta.outputs.version }} |