Skip to content

Commit

Permalink
build: github action
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkAfCod committed Jul 21, 2024
1 parent 090846f commit a6d4a10
Show file tree
Hide file tree
Showing 12 changed files with 450 additions and 24 deletions.
11 changes: 11 additions & 0 deletions .github/actions/capture_test_logs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: capture_test_logs
description: "Capture test logs"
runs:
using: composite
steps:
- uses: actions/[email protected]
with:
path: acceptance-tests/tests/build/acceptanceTestLogs
- uses: actions/[email protected]
with:
path: acceptance-tests/tests/build/jvmErrorLogs
26 changes: 26 additions & 0 deletions .github/actions/capture_test_results/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: capture_test_results
description: "Capture test results"
runs:
using: composite
steps:
- name: Jacoco
run: "./gradlew --no-daemon jacocoTestReport"
shell: bash
- name: Gather test results
run: |-
FILES=`find . -name test-results`
for FILE in $FILES
do
MODULE=`echo "$FILE" | sed -e 's@./\(.*\)/build/test-results@\1@'`
TARGET="build/test-results/$MODULE"
mkdir -p "$TARGET"
cp -rf ${FILE}/*/* "$TARGET"
done
if: always()
shell: bash
- uses: actions/[email protected]
with:
path: build/test-results
- uses: actions/[email protected]
with:
path: besu/build/reports/jacoco
14 changes: 14 additions & 0 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: prepare
description: "Prepare the environment for the build"
runs:
using: composite
steps:
- uses: actions/[email protected]
- name: Install Packages - LibSodium, nssdb
shell: bash
run: |-
sudo apt-get update
sudo apt-get install -y libsodium23 libsodium-dev libjemalloc-dev apt-transport-https haveged libnss3-tools
sudo service haveged restart
java --version
- uses: "./.github/actions/restore_gradle_cache"
14 changes: 14 additions & 0 deletions .github/actions/restore_gradle_cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: restore_gradle_cache
description: "Restore the gradle cache"
runs:
using: composite
steps:
- name: restore_cache
uses: actions/[email protected]
with:
key: deps-{{ checksum "gradle/versions.gradle" }}-{{ .Branch }}-{{ .Revision }}
path: UPDATE_ME
restore-keys: |-
deps-{{ checksum "gradle/versions.gradle" }}-{{ .Branch }}-{{ .Revision }}
deps-{{ checksum "gradle/versions.gradle" }}
deps-
323 changes: 323 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
name: default
on:
push:
branches:
- op-stack
- main
pull_request:
jobs:
assemble:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: "./.github/actions/prepare"
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
cache-disabled: true
- name: Assemble
run: "./gradlew --no-daemon clean compileJava compileTestJava assemble"
- name: save_cache
uses: actions/[email protected]
with:
path: |-
.gradle
~/.gradle
key: deps-{{ checksum "gradle/versions.gradle" }}-{{ .Branch }}-{{ .Revision }}
- uses: actions/[email protected]
with:
path: build/assemble
- uses: actions/[email protected]
with:
path: build/distributions
unitTests:
runs-on: ubuntu-latest
needs:
- assemble
steps:
- uses: actions/[email protected]
- uses: "./.github/actions/prepare"
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 21
- uses: actions/[email protected]
with:
path: build/assemble
- name: Build
run: "./gradlew --no-daemon build -x test"
- uses: "./.github/actions/capture_test_results"
# testWindows:
# runs-on: windows-latest
# needs:
# - assemble
# steps:
# - uses: actions/[email protected]
# with:
# path: build/assemble
# - name: Unzip Windows build
# run: |-
# cd build/distributions
# unzip besu-*.zip -d besu-tmp
# cd besu-tmp
# mv besu-* ../besu
# - name: Test Besu Windows executable
# run: |-
# build\distributions\besu\bin\besu.bat --help
# build\distributions\besu\bin\besu.bat --version
referenceTests:
runs-on: ubuntu-latest
needs:
- assemble
steps:
- uses: actions/[email protected]
- uses: "./.github/actions/prepare"
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 21
- uses: actions/[email protected]
with:
path: build/assemble
- name: ReferenceTests
run: |-
git submodule update --init --recursive
./gradlew --no-daemon referenceTest
- uses: "./.github/actions/capture_test_results"
integrationTests:
runs-on: ubuntu-latest
needs:
- assemble
steps:
- uses: actions/[email protected]
- uses: "./.github/actions/prepare"
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 21
- uses: actions/[email protected]
with:
path: build/assemble
- name: IntegrationTests
run: "./gradlew --no-daemon integrationTest"
- name: CompileJmh
run: "./gradlew --no-daemon compileJmh"
- uses: "./.github/actions/capture_test_results"
# acceptanceTests:
# runs-on: ubuntu-latest
# container:
# image: cimg/openjdk:17.0
# needs:
# - assemble
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: build/assemble
# - name: AcceptanceTests (Mainnet)
# run: |-
# ./gradlew --no-daemon acceptanceTestMainnet
# - uses: "./.github/actions/capture_test_results"
# - uses: "./.github/actions/capture_test_logs"
# acceptanceTestsCliqueBft:
# runs-on: ubuntu-latest
# container:
# image: cimg/openjdk:17.0
# needs:
# - assemble
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: build/assemble
# - name: AcceptanceTests (Non-Mainnet)
# run: |-
# ./gradlew --no-daemon acceptanceTestCliqueBft
# - uses: "./.github/actions/capture_test_results"
# - uses: "./.github/actions/capture_test_logs"
# acceptanceTestsPrivacy:
# runs-on: ubuntu-latest
# container:
# image: cimg/openjdk:17.0
# needs:
# - assemble
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: build/assemble
# - name: AcceptanceTests (Non-Mainnet)
# run: |-
# ./gradlew --no-daemon acceptanceTestPrivacy
# - uses: "./.github/actions/capture_test_results"
# - uses: "./.github/actions/capture_test_logs"
# acceptanceTestsPermissioning:
# runs-on: ubuntu-latest
# container:
# image: cimg/openjdk:17.0
# needs:
# - assemble
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: build/assemble
# - name: AcceptanceTests (Non-Mainnet)
# run: |-
# ./gradlew --no-daemon acceptanceTestPermissioning
# - uses: "./.github/actions/capture_test_results"
# - uses: "./.github/actions/capture_test_logs"
# buildDocker:
# runs-on: ubuntu-latest
# container:
# image: cimg/openjdk:17.0
# needs:
# - assemble
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: build/assemble
## # 'setup_remote_docker' was not transformed because there is no suitable equivalent in GitHub Actions
# - name: hadoLint_openjdk_17
# run: docker run --rm -i hadolint/hadolint < docker/openjdk-17/Dockerfile
# - name: hadoLint_openjdk_17_debug
# run: docker run --rm -i hadolint/hadolint < docker/openjdk-17-debug/Dockerfile
# - name: hadoLint_openjdk_latest
# run: docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile
# - name: hadoLint_graalvm
# run: docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile
# - name: build image
# run: "./gradlew --no-daemon distDocker"
# - name: test image
# run: |-
# mkdir -p docker/reports
# curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.9/goss-linux-amd64 -o ./docker/tests/goss-linux-amd64
# ./gradlew --no-daemon testDocker
# buildArm64Docker:
# runs-on: ubuntu-latest
# needs:
# - assemble
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: build/assemble
# - name: hadoLint_openjdk_17
# run: docker run --rm -i hadolint/hadolint < docker/openjdk-17/Dockerfile
# - name: hadoLint_openjdk_latest
# run: docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile
# - name: hadoLint_graalvm
# run: docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile
# - name: Java_17
# run: |-
# sudo apt install -q --assume-yes openjdk-17-jre-headless openjdk-17-jdk-headless
# sudo update-java-alternatives -a
# - name: build image
# run: "./gradlew --no-daemon distDocker"
# - name: test image
# run: |-
# mkdir -p docker/reports
# curl -L https://github.com/aelsabbahy/goss/releases/download/v0.3.9/goss-linux-arm -o ./docker/tests/goss-linux-arm64
# ./gradlew --no-daemon testDocker

# publish:
# if: # GitHub does not currently support regular expressions inside if conditions
## github.ref == 'refs/heads/main' || github.ref == 'refs/heads//^release-.*/'
# runs-on: ubuntu-latest
# container:
# image: cimg/openjdk:17.0
# needs:
# - assemble
# - integrationTests
# - unitTests
# - acceptanceTests
# - referenceTests
# - buildDocker
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: "~/project"
# - name: Publish
# run: "./gradlew --no-daemon artifactoryPublish"
# publishDocker:
# if: # GitHub does not currently support regular expressions inside if conditions
## github.ref == 'refs/heads/main' || github.ref == 'refs/heads//^release-.*/'
# runs-on: ubuntu-latest
# container:
# image: cimg/openjdk:17.0
# needs:
# - assemble
# - integrationTests
# - unitTests
# - acceptanceTests
# - referenceTests
# - buildDocker
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: "~/project"
## # 'setup_remote_docker' was not transformed because there is no suitable equivalent in GitHub Actions
# - name: Publish Docker
# run: |-
# docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
# ./gradlew --no-daemon "-Pbranch=${{ github.ref }}" dockerUpload
# publishArm64Docker:
# if: # GitHub does not currently support regular expressions inside if conditions
## github.ref == 'refs/heads/main' || github.ref == 'refs/heads//^release-.*/'
# runs-on: ubuntu-latest
# needs:
# - integrationTests
# - unitTests
# - acceptanceTests
# - referenceTests
# - buildArm64Docker
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
# - uses: actions/[email protected]
# with:
# path: "~/project"
# - name: Java_17
# run: |-
# sudo apt install -q --assume-yes openjdk-17-jre-headless openjdk-17-jdk-headless
# sudo update-java-alternatives -a
# - name: Publish Docker
# run: |-
# docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
# ./gradlew --no-daemon "-Pbranch=${{ github.ref }}" dockerUpload
# manifestDocker:
# if: # GitHub does not currently support regular expressions inside if conditions
## github.ref == 'refs/heads/main' || github.ref == 'refs/heads//^release-.*/'
# runs-on: ubuntu-latest
# container:
# image: cimg/openjdk:17.0
# needs:
# - publishDocker
# - publishArm64Docker
# steps:
# - uses: actions/[email protected]
# - uses: "./.github/actions/prepare"
## # 'setup_remote_docker' was not transformed because there is no suitable equivalent in GitHub Actions
# - name: Create and publish docker manifest
# run: |-
# docker login --username "${DOCKER_USER_RW}" --password "${DOCKER_PASSWORD_RW}"
# ./gradlew --no-daemon "-Pbranch=${{ github.ref }}" --parallel manifestDocker
Loading

0 comments on commit a6d4a10

Please sign in to comment.