Skip to content

Commit

Permalink
ci: add on release trigger for docker image (#751)
Browse files Browse the repository at this point in the history
* add on release trigger for docker image

* match kakarot docker release workflow

* fix dockerfile path

* add ref name on the tags

* feat: add env token

* feat: add env token bis

* feat: add env token last

* ignore clippy terrorism

* fix docker fix commit

---------

Co-authored-by: Elias Tazartes <elias.tazartes@gmail.com>
  • Loading branch information
d-roak and Eikix authored Feb 3, 2024
1 parent b499179 commit 776e3bb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 87 deletions.
90 changes: 7 additions & 83 deletions .github/workflows/kakarot_rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,109 +2,33 @@
name: RPC

on:
workflow_call:
release:
types: [published]

env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}/node

permissions:
packages: write

jobs:
build:
runs-on: ubuntu-latest-16-cores
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=latest
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push by digest
id: build
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}, ${{ env.REGISTRY_IMAGE }}:latest
context: .
file: ./docker/rpc/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ env.REGISTRY_IMAGE }}:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},name-canonical=true,push=true

- 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@v3
with:
name: digests
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v3
with:
name: digests
path: /tmp/digests

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:latest \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest
platforms: linux/amd64,linux/arm64
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ jobs:
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Setup the Kakarot submodule
run: make setup
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create dump
- name: Create dump
run: ./scripts/make_with_env.sh && make dump-katana
run: ./scripts/make_with_env.sh dump-katana
- name: Lint
run: |
cargo check &&
Expand All @@ -74,4 +76,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: false
fail_ci_if_error: false
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ services:

kakarot-deployer:
image: ghcr.io/kkrt-labs/kakarot/deployer:latest
# Always pull the latest image, until we use release tags
pull_policy: always
environment:
- ACCOUNT_ADDRESS=0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973
- PRIVATE_KEY=0x1800000000300000180000000000030000000000003006001800006600
Expand Down
12 changes: 10 additions & 2 deletions docker/rpc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM python:3.9.13 as compiler
# install poetry
ENV POETRY_VERSION=1.7.1
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="$PATH:/root/.local/bin:/root/.foundry/bin"
ARG GITHUB_TOKEN
ENV GITHUB_TOKEN=$GITHUB_TOKEN

RUN curl -sSL https://install.python-poetry.org | python3 -
RUN poetry config virtualenvs.create false

WORKDIR /usr/src/compiler
Expand All @@ -12,7 +15,12 @@ RUN curl -L https://foundry.paradigm.xyz -o foundry.sh \
&& chmod +x foundry.sh \
&& ./foundry.sh \
&& foundryup \
&& apt-get update && apt-get install -y jq
&& apt-get update && apt-get install -y \
jq \
wget \
tar \
unzip \
zip

COPY .git ./.git
COPY .gitmodules .gitmodules
Expand Down
1 change: 1 addition & 0 deletions src/eth_provider/starknet/kakarot_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::{
abigen_legacy!(Proxy, "./artifacts/proxy.json");
abigen_legacy!(ContractAccount, "./artifacts/contract_account.json");

#[allow(clippy::too_many_arguments)]
pub mod core {
use super::*;
abigen_legacy!(KakarotCore, "./artifacts/kakarot.json");
Expand Down

0 comments on commit 776e3bb

Please sign in to comment.