From fad6e52d06e56bb6f92af6c6fc1c172e2cd1b22a Mon Sep 17 00:00:00 2001 From: Khaeljy Date: Thu, 12 Oct 2023 09:20:10 +0200 Subject: [PATCH] dev: pull compiled contracts of Kakarot system from kakarot CI artifacts instead of Git Submodule (#532) * pull compiled contracts of Kakarot * Remove .gitmodules * Make .env file optional * Update CI * Remove useless kakarot.yml workflow * Remove useless `export` --- .github/workflows/ci.yml | 5 ----- .github/workflows/kakarot.yml | 35 ----------------------------------- .github/workflows/test.yml | 10 ++++------ .gitmodules | 3 --- Makefile | 20 ++++++++++++++++---- 5 files changed, 20 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/kakarot.yml delete mode 100644 .gitmodules diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 538d0813..376dd07e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,11 +18,6 @@ jobs: checks: write contents: read - submodules: - name: Compile Kakarot contracts - uses: ./.github/workflows/kakarot.yml - tests: name: Rust tests uses: ./.github/workflows/test.yml - needs: submodules diff --git a/.github/workflows/kakarot.yml b/.github/workflows/kakarot.yml deleted file mode 100644 index 16198ddb..00000000 --- a/.github/workflows/kakarot.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Kakarot compilation caching - -on: - workflow_call: {} - -permissions: read-all - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-submodules - cancel-in-progress: true - -jobs: - submodules: - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true - - name: pull kakarot submodule and setup - run: make setup-kakarot - - name: Save compiled kakarot contracts - id: cached-contracts - uses: actions/cache/save@v3 - with: - path: ./lib/kakarot/build - key: ${{ runner.os }}-contracts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd506eea..e93f4b8a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,12 +16,6 @@ jobs: timeout-minutes: 45 steps: - uses: actions/checkout@v3 - - name: Load compiled kakarot contracts - id: cached-contracts - uses: actions/cache/restore@v3 - with: - path: ./lib/kakarot/build - key: ${{ runner.os }}-contracts - name: Setup rust env uses: actions-rs/toolchain@v1 with: @@ -32,6 +26,10 @@ jobs: uses: Swatinem/rust-cache@v2 - name: fetch ef tests run: make setup + - name: fetch Kakarot + run: make setup-kakarot + env: + GITHUB_TOKEN: ${{ github.token }} - uses: taiki-e/install-action@nextest - name: run tests run: make tests diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 629d95e3..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "kakarot"] - path = lib/kakarot - url = https://github.com/kkrt-labs/kakarot.git diff --git a/Makefile b/Makefile index 2607b1db..cd6b40de 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,19 @@ # Heavily inspired by Reth: https://github.com/paradigmxyz/reth/blob/main/Makefile +# Include .env file to get GITHUB_TOKEN +ifneq ("$(wildcard .env)","") + include .env +endif + # The release tag of https://github.com/ethereum/tests to use for EF tests EF_TESTS_TAG := v12.3 EF_TESTS_URL := https://github.com/ethereum/tests/archive/refs/tags/$(EF_TESTS_TAG).tar.gz EF_TESTS_DIR := ./crates/ef-testing/ethereum-tests +# Kakarot artifacts +KKRT_ARTIFACTS_URL = $(shell curl -sL -H "Authorization: token $(GITHUB_TOKEN)" "https://api.github.com/repos/kkrt-labs/kakarot/actions/workflows/ci.yml/runs?per_page=1&branch=main&event=push&status=success" | jq -r '.workflow_runs[0].artifacts_url') +KKRT_BUILD_ARTIFACT_URL = $(shell curl -sL -H "Authorization: token $(GITHUB_TOKEN)" "$(KKRT_ARTIFACTS_URL)" | jq -r '.artifacts[] | select(.name=="kakarot-build").url')/zip + # Downloads and unpacks Ethereum Foundation tests in the `$(EF_TESTS_DIR)` directory. # Requires `wget` and `tar` $(EF_TESTS_DIR): @@ -17,11 +26,14 @@ $(EF_TESTS_DIR): .PHONY: $(EF_TESTS_DIR) setup: $(EF_TESTS_DIR) -setup-kakarot: pull-kakarot - cd lib/kakarot && make setup && make build +setup-kakarot: clean-kakarot + @curl -sL -o kakarot-build.zip -H "Authorization: token $(GITHUB_TOKEN)" "$(KKRT_BUILD_ARTIFACT_URL)" + unzip -o kakarot-build.zip -d lib/kakarot/build + rm -f kakarot-build.zip -pull-kakarot: - git submodule update --init --recursive +clean-kakarot: + rm -rf lib/kakarot + mkdir -p lib/kakarot/build # Runs the repo tests tests: