Skip to content

Commit

Permalink
Merge pull request #525 from blxdyx/alpha4
Browse files Browse the repository at this point in the history
Alpha4
  • Loading branch information
setunapo authored Oct 15, 2024
2 parents 4df9747 + 9f3ca6b commit aba2217
Show file tree
Hide file tree
Showing 2,794 changed files with 971,091 additions and 9,665 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/ci-cd-main-branch-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ run-name: "Commit id ${{ github.sha }}: CI-CD build and deploy docker images bas

env:
APPLICATION: "erigon"
BUILDER_IMAGE: "golang:1.22.6-alpine3.20"
TARGET_BASE_IMAGE: "alpine:3.20.2"
BUILDER_IMAGE: "golang:1.23.1-alpine3.20"
TARGET_BASE_IMAGE: "alpine:3.20.3"
APP_REPO: "erigontech/erigon"
CHECKOUT_REF: "main"
DOCKERHUB_REPOSITORY: "erigontech/erigon"
Expand Down Expand Up @@ -33,6 +33,14 @@ jobs:
ref: ${{ env.CHECKOUT_REF }}
path: 'erigon'

- name: Setup go env and cache
uses: actions/setup-go@v5
with:
go-version: '>=1.22'
go-version-file: 'erigon/go.mod'
cache-dependency-path: |
erigon/go.sum
- name: Get commit id
id: getCommitId
run: |
Expand All @@ -53,16 +61,42 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db ## v3.6.1

- name: Build arm64
run: |
docker run --platform linux/arm64 \
--rm -v $(pwd)/erigon:/erigon:ro \
-v $(pwd)/build-arm64:/erigon-build \
-v ${HOME}/.cache/go-build/arm64:/root/.cache/go-build \
-v ${HOME}/go/pkg/mod:/go/pkg/mod \
-w /erigon --entrypoint /bin/sh \
${{ env.BUILDER_IMAGE }} \
-c "apk update; apk add make git gcc libstdc++ build-base linux-headers bash ca-certificates; git config --global --add safe.directory /erigon; make GOARCH=arm64 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb,nosilkworm erigon integration rpcdaemon"
- name: Build amd64
run: |
docker run --platform linux/amd64 \
--rm -v $(pwd)/erigon:/erigon:ro \
-v $(pwd)/build-amd64:/erigon-build \
-v ${HOME}/.cache/go-build/amd64:/root/.cache/go-build \
-v ${HOME}/go/pkg/mod:/go/pkg/mod \
-w /erigon --entrypoint /bin/sh \
${{ env.BUILDER_IMAGE }} \
-c "apk update; apk add make git gcc libstdc++ build-base linux-headers bash ca-certificates; git config --global --add safe.directory /erigon; make GOARCH=amd64 GOAMD64=v2 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb,nosilkworm erigon integration rpcdaemon"
- name: Build and push multi-platform docker image based on the commit id ${{ steps.getCommitId.outputs.short_commit_id }} in the main branch
env:
BUILD_VERSION: "main-${{ steps.getCommitId.outputs.short_commit_id }}"
DOCKER_URL: ${{ env.DOCKERHUB_REPOSITORY }}
DOCKERFILE_PATH: Dockerfile.release
run: |
cp -vr build-amd64 erigon/
cp -vr build-arm64 erigon/
cd erigon
docker buildx build \
--file ${{ env.DOCKERFILE_PATH }} \
--target ci-cd-main-branch \
--attest type=provenance,mode=max \
--sbom=true \
--build-arg CI_CD_MAIN_TARGET_BASE_IMAGE=${{ env.TARGET_BASE_IMAGE }} \
--build-arg CI_CD_MAIN_BUILDER_IMAGE=${{ env.BUILDER_IMAGE }} \
--tag ${{ env.DOCKER_URL }}:${{ env.BUILD_VERSION }} \
Expand Down
133 changes: 133 additions & 0 deletions .github/workflows/ci-cd-main-branch-docker-images2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: 2CI-CD build and deploy docker images based on the last commit in the main branch
run-name: "Commit id ${{ github.sha }}: CI-CD build and deploy docker images based on the commit id in the main branch"

env:
APPLICATION: "erigon"
BUILDER_IMAGE: "golang:1.23.1-alpine3.20"
TARGET_BASE_IMAGE: "alpine:3.20.3"
APP_REPO: "erigontech/erigon"
CHECKOUT_REF: "main"
DOCKERHUB_REPOSITORY: "erigontech/erigon"
LABEL_DESCRIPTION: "[docker image built on a last commit id from the main branch] Erigon is an implementation of Ethereum (execution layer with embeddable consensus layer), on the efficiency frontier. Archive Node by default."

on:
push:
branches:
- 'kurtosis_fix4'
workflow_dispatch:

jobs:

Build:
runs-on: ubuntu-22.04
timeout-minutes: 45

steps:
- name: Fast checkout git repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 ## 4.1.7 release
with:
repository: ${{ env.APP_REPO }}
fetch-depth: 1
ref: ${{ env.CHECKOUT_REF }}
path: 'erigon'

- name: Setup go env and cache
uses: actions/setup-go@v5
with:
go-version: '>=1.22'
go-version-file: 'erigon/go.mod'
cache-dependency-path: |
erigon/go.sum
- name: Get commit id
id: getCommitId
run: |
cd erigon
echo "id=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "short_commit_id=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
cd ..
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 ## v3.3.0
with:
username: ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_USERNAME }}
password: ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf ## v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db ## v3.6.1

- name: Build arm64
run: |
docker run --platform linux/arm64 \
--rm -v $(pwd)/erigon:/erigon:ro \
-v $(pwd)/build-arm64:/erigon-build \
-v ${HOME}/.cache/go-build/arm64:/root/.cache/go-build \
-v ${HOME}/go/pkg/mod:/go/pkg/mod \
-w /erigon --entrypoint /bin/sh \
${{ env.BUILDER_IMAGE }} \
-c "apk update; apk add make git gcc libstdc++ build-base linux-headers bash ca-certificates; git config --global --add safe.directory /erigon; make GOARCH=arm64 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb,nosilkworm erigon integration rpcdaemon"
- name: Build amd64
run: |
docker run --platform linux/amd64 \
--rm -v $(pwd)/erigon:/erigon:ro \
-v $(pwd)/build-amd64:/erigon-build \
-v ${HOME}/.cache/go-build/amd64:/root/.cache/go-build \
-v ${HOME}/go/pkg/mod:/go/pkg/mod \
-w /erigon --entrypoint /bin/sh \
${{ env.BUILDER_IMAGE }} \
-c "apk update; apk add make git gcc libstdc++ build-base linux-headers bash ca-certificates; git config --global --add safe.directory /erigon; make GOARCH=amd64 GOAMD64=v2 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb,nosilkworm erigon integration rpcdaemon"
- name: Build and push multi-platform docker image based on the commit id ${{ steps.getCommitId.outputs.short_commit_id }} in the main branch
env:
BUILD_VERSION: "main-${{ steps.getCommitId.outputs.short_commit_id }}"
DOCKER_URL: ${{ env.DOCKERHUB_REPOSITORY }}
DOCKERFILE_PATH: Dockerfile.release
run: |
cp -vr build-amd64 erigon/
cp -vr build-arm64 erigon/
cd erigon
docker buildx build \
--file ${{ env.DOCKERFILE_PATH }} \
--target ci-cd-main-branch \
--attest type=provenance,mode=max \
--sbom=true \
--build-arg CI_CD_MAIN_TARGET_BASE_IMAGE=${{ env.TARGET_BASE_IMAGE }} \
--build-arg CI_CD_MAIN_BUILDER_IMAGE=${{ env.BUILDER_IMAGE }} \
--tag ${{ env.DOCKER_URL }}:${{ env.BUILD_VERSION }} \
--tag ${{ env.DOCKER_URL }}:main-latest \
--label org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--label org.opencontainers.image.authors="https://github.com/erigontech/erigon/graphs/contributors" \
--label org.opencontainers.image.url="https://github.com/erigontech/erigon/blob/main/Dockerfile" \
--label org.opencontainers.image.documentation="https://github.com/erigontech/erigon/blob/main/Dockerfile" \
--label org.opencontainers.image.source="https://github.com/erigontech/erigon/blob/main/Dockerfile" \
--label org.opencontainers.image.version=${{ steps.getCommitId.outputs.id }} \
--label org.opencontainers.image.revision=${{ steps.getCommitId.outputs.id }} \
--label org.opencontainers.image.vcs-ref-short=${{ steps.getCommitId.outputs.short_commit_id }} \
--label org.opencontainers.image.vendor="${{ github.repository_owner }}" \
--label org.opencontainers.image.description="${{ env.LABEL_DESCRIPTION }}" \
--label org.opencontainers.image.base.name="${{ env.TARGET_BASE_IMAGE }}" \
--push \
--platform linux/amd64,linux/arm64 .
- name: Print docker images published
run: |
echo The following docker images have been published:
echo "${{ env.DOCKERHUB_REPOSITORY }}:main-${{ steps.getCommitId.outputs.short_commit_id }}"
echo "${{ env.DOCKERHUB_REPOSITORY }}:main-latest"
## upload commit id for use in test-kurtosis-assertoor.yml
## reference: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: Save commit id
run: |
mkdir -p ./COMMIT_ID_DOCKER_BUILD
echo "${{ steps.getCommitId.outputs.short_commit_id }}" >> ./COMMIT_ID_DOCKER_BUILD/commit
- uses: actions/upload-artifact@v4
with:
name: commit
path: COMMIT_ID_DOCKER_BUILD

50 changes: 11 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: '1.22'
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
Expand All @@ -61,7 +61,6 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
skip-build-cache: true
args: --help

- name: Lint
Expand All @@ -86,15 +85,16 @@ jobs:
# os: [ windows-2022 ]
# runs-on: ${{ matrix.os }}

# steps:
# - name: configure Pagefile
# uses: al-cheb/[email protected]
# with:
# minimum-size: 8GB
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: '1.21'
#
# steps:
# - name: configure Pagefile
# uses: al-cheb/[email protected]
# with:
# minimum-size: 8GB
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: '1.22'

# - uses: actions/cache@v4
# with:
Expand All @@ -115,31 +115,3 @@ jobs:

# - name: Test erigon-lib
# run: cd erigon-lib && make test-no-fuzz

docker-build-check:
# don't run this on main - the PR must have run it to be merged and it misleads that this pushes the docker image
if: (${{ github.event_name == 'push' || !github.event.pull_request.draft }}) && ${{ github.ref != 'refs/heads/main' }}
runs-on: ubuntu-22.04

steps:
- uses: AutoModality/action-clean@v1
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch git tags for "git describe"

- name: make docker (see dockerhub for image builds)
run: DOCKER_TAG=thorax/erigon:ci-$GITHUB_SHA DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker

# check with root permissions, should be cached from previous build
- name: sudo make docker
run: sudo DOCKER_TAG=thorax/erigon:ci-$GITHUB_SHA DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker

# automated-tests:
# runs-on:
# ubuntu-22.04
# if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
# steps:
# - uses: actions/checkout@v4
#
# - name: run automated testing
# run: BUILD_ERIGON=1 ./tests/automated-testing/run.sh
2 changes: 0 additions & 2 deletions .github/workflows/docker-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:
- run: |
make release-dry-run
docker images
# docker image push --all-tags thorax/erigon
# docker image push --all-tags ghcr.io/erigontech/erigon
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${GITHUB_REF#refs/tags/}
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/hive-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ jobs:
with:
fetch-depth: 0 # fetch git tags for "git describe"

- name: build erigon image
run: DOCKER_TAG=thorax/erigon:ci-$GITHUB_SHA DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker

# check with root permissions, should be cached from previous build
- name: build erigon image (root permissions)
run: sudo DOCKER_TAG=thorax/erigon:ci-$GITHUB_SHA DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker

- name: run hive and parse output
run: |
sudo mkdir -p /results-${{ github.run_id }}
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${{ github.workspace }}:/work thorax/hive:latest --sim ethereum/engine --results-root=/work/results-${{ github.run_id }} --client erigon_ci-$GITHUB_SHA --exit.fail=false
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${{ github.workspace }}:/work thorax/hive:latest --sim ethereum/engine --results-root=/work/results-${{ github.run_id }} --client erigon --exit.fail=false
docker run --rm --pull always -v /var/run/docker.sock:/var/run/docker.sock -v ${{ github.workspace }}:/work --entrypoint /app/hivecioutput thorax/hive:latest --resultsdir=/work/results-${{ github.run_id }} --outdir=/work/results-${{ github.run_id }} --exclusionsfile=/work/hive/exclusions.json
- name: clean up containers
Expand Down
Loading

0 comments on commit aba2217

Please sign in to comment.