Skip to content

sepolia-Add build file for sepolia #137

sepolia-Add build file for sepolia

sepolia-Add build file for sepolia #137

Workflow file for this run

name: Tests
on:
pull_request:
branches:
- main
jobs:
build_docker_image:
runs-on: ubuntu-latest
outputs:
DOCKER_IMAGE: ${{ steps.build_docker.outputs.DOCKER_IMAGE }}
env:
architecture: "amd64"
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=4"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: temurin
- name: Set up QEMU for Docker
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Check Dockerfile syntax
run: |
docker run --rm -i hadolint/hadolint < docker/Dockerfile
- name: Build Docker image
id: build_docker
run: |
output=$(./gradlew distDocker)
echo "$output"
image=$(echo "$output" | grep "DOCKER_IMAGE=" | cut -d'=' -f2)
if [ -z "$image" ]; then
echo "Error: Docker image name could not be extracted."
exit 1
fi
echo "DOCKER_IMAGE=$image" >> "$GITHUB_OUTPUT"
echo "Docker image name: $image"
docker images
- name: Save Docker image
run: |
docker save ${{ steps.build_docker.outputs.DOCKER_IMAGE }} -o /tmp/docker-image.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docker-image
path: /tmp/docker-image.tar
retention-days: 1
prepare_tests:
runs-on: ubuntu-latest
needs: build_docker_image
outputs:
files: ${{ steps.list.outputs.files }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Split profiles
id: list
run: |
files=$(ls linea-besu/profiles/* | xargs -n 1 basename | sed 's/\.[^.]*$//')
files_json=$(echo "$files" | tr ' ' '\n' | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "files=$files_json" >> "$GITHUB_OUTPUT"
echo "Files: $files_json"
test-profile:
timeout-minutes: 4
runs-on: ubuntu-latest
continue-on-error: true
needs: [prepare_tests, build_docker_image]
strategy:
fail-fast: false
matrix:
file: ${{ fromJSON(needs.prepare_tests.outputs.files) }}
env:
CONTAINER_NAME: linea-besu-profile-check-${{ matrix.file }}
DOCKER_IMAGE: ${{needs.build_docker_image.outputs.DOCKER_IMAGE}}
steps:
- name: Check repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: docker-image
path: /tmp
- name: Load image
run: |
docker load --input /tmp/docker-image.tar
- name: Start container
run: |
COMMAND="docker run -d --name ${{ env.CONTAINER_NAME }} -e BESU_PROFILE=${{ matrix.file }} ${{ env.DOCKER_IMAGE }}"
echo $COMMAND
eval $COMMAND
- name: Verify besu container
run: bash .github/workflows/BesuContainerVerify.sh
env:
CONTAINER_NAME: ${{ env.CONTAINER_NAME }}
- name: Stop container
run: docker stop ${{ env.CONTAINER_NAME }}