-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (103 loc) · 3.34 KB
/
develop.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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 }}