Skip to content

Commit 41d6c3f

Browse files
initial commit and unit and integration tests in one place
Signed-off-by: Joshua Fernandes <joshua.fernandes@consensys.net>
1 parent 0a8bbfa commit 41d6c3f

14 files changed

Lines changed: 374 additions & 176 deletions

.github/workflows/acceptance-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
path: tmp/junit-xml-reports-downloaded
6060
if_no_artifact_found: ignore
6161
- name: Split tests
62-
run: .github/workflows/splitTestsByTime.sh tmp/junit-xml-reports-downloaded "tmp/junit-xml-reports-downloaded/acceptance-node-.*-test-results" "TEST-" ${{env.total-runners}} ${{ matrix.runner_index }} > testList.txt
62+
run: .github/scripts/splitTestsByTime.sh tmp/junit-xml-reports-downloaded "tmp/junit-xml-reports-downloaded/acceptance-node-.*-test-results" "TEST-" ${{env.total-runners}} ${{ matrix.runner_index }} > testList.txt
6363
- name: format gradle args
6464
# we do not need the module task here
6565
run: cat testList.txt | cut -f 2- -d ' ' | tee gradleArgs.txt
Lines changed: 76 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pre-review
1+
name: CI
22

33
on:
44
merge_group:
@@ -17,6 +17,7 @@ env:
1717
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.parallel=true"
1818

1919
jobs:
20+
2021
repolint:
2122
name: "Repository Linting"
2223
runs-on: ubuntu-latest
@@ -28,6 +29,7 @@ jobs:
2829
ref: ${{ github.event.pull_request.head.sha || github.ref }}
2930
- name: Lint Repo
3031
run: bundle exec /app/bin/repolinter.js --rulesetUrl https://raw.githubusercontent.com/hyperledger-labs/hyperledger-community-management-tools/main/repo_structure/repolint.json --format markdown
32+
3133
gradle-wrapper:
3234
name: "Gradle Wrapper Validation"
3335
runs-on: ubuntu-latest
@@ -36,6 +38,7 @@ jobs:
3638
with:
3739
ref: ${{ github.event.pull_request.head.sha || github.ref }}
3840
- uses: gradle/actions/wrapper-validation@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6.0.1
41+
3942
spotless-checkLicense:
4043
name: "Spotless & Check License"
4144
runs-on: ubuntu-latest
@@ -62,6 +65,7 @@ jobs:
6265
with:
6366
name: checkLicense
6467
path: build/reports/dependency-license
68+
6569
compile:
6670
runs-on: ubuntu-latest
6771
timeout-minutes: 30
@@ -82,6 +86,31 @@ jobs:
8286
cache-disabled: true
8387
- name: Gradle Compile
8488
run: ./gradlew build -x test -x spotlessCheck
89+
- name: Upload tar.gz
90+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
91+
with:
92+
name: besu-tar
93+
path: build/distributions/besu-*.tar.gz
94+
retention-days: 10
95+
- name: Upload zip
96+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
97+
with:
98+
name: besu-zip
99+
path: build/distributions/besu-*.zip
100+
retention-days: 10
101+
- name: Upload workspace build
102+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
103+
with:
104+
name: assemble-output
105+
path: |
106+
./
107+
!./.git/**
108+
retention-days: 1
109+
include-hidden-files: 'true'
110+
111+
# Supply chain security: verifies that source JARs for all dependencies are recorded
112+
# in verification-metadata.xml. Prevents tampered or undeclared source artifacts
113+
# from being introduced without explicit sign-off.
85114
verify-source-metadata:
86115
name: "Verify Dependency Source Metadata"
87116
runs-on: ubuntu-latest
@@ -102,59 +131,67 @@ jobs:
102131
cache-disabled: true
103132
- name: Verify source artifacts recorded in verification-metadata.xml
104133
run: ./gradlew verifySourceArtifacts
134+
135+
# Tests
105136
unitTests:
106-
runs-on: besu-research-ubuntu-16 # more cores
107-
timeout-minutes: 30
108-
needs: [spotless-checkLicense, gradle-wrapper, repolint]
137+
needs: compile
138+
permissions:
139+
actions: read
140+
contents: read
141+
uses: ./.github/workflows/matrix-tests-template.yml
142+
with:
143+
assemble_output_run_id: ${{ github.run_id }}
144+
stage_name: Unit Tests
145+
stage_key: unit
146+
gradle_task: test
147+
src_pattern: "*/src/test/java/*"
148+
src_root: "src/test/java"
149+
runner: besu-research-ubuntu-16
150+
151+
unittests-passed:
152+
name: unittests-passed
153+
runs-on: ubuntu-latest
154+
needs: [unitTests]
109155
permissions:
110156
checks: write
111157
statuses: write
112-
strategy:
113-
fail-fast: true
158+
if: always()
159+
steps:
160+
- name: Fail on workflow error
161+
run: exit 1
162+
if: >-
163+
${{
164+
contains(needs.*.result, 'failure')
165+
|| contains(needs.*.result, 'cancelled')
166+
|| contains(needs.*.result, 'skipped')
167+
}}
168+
169+
integrationTests:
170+
runs-on: ubuntu-latest
171+
timeout-minutes: 30
172+
needs: compile
173+
permissions:
174+
statuses: write
175+
checks: write
114176
steps:
115177
- name: Checkout Repo
116178
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
117179
with:
118180
ref: ${{ github.event.pull_request.head.sha || github.ref }}
119-
- name: Set up Java
120-
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
121-
with:
122-
distribution: temurin
123-
java-version: 25
124-
- name: Install required packages
125-
run: sudo apt-get install -y xmlstarlet
126-
- name: Setup Gradle
127-
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6.0.1
128-
with:
129-
cache-disabled: true
130-
add-job-summary: on-failure
131-
- name: run unit tests
132-
env:
133-
# reducing JVM forks to increase reuse of setup code such as SignatureAlgorithm
134-
GRADLE_MAX_TEST_FORKS: 2 # besu-research-ubuntu-16 will use 8 by default
135-
run: ./gradlew -Dorg.gradle.parallel=true -Dorg.gradle.caching=true test
136-
- name: Upload Unit Test Results
137-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
138-
with:
139-
name: unit-test-results
140-
path: '**/test-results/**/TEST-*.xml'
141-
- name: Upload Unit Test HTML Reports
142-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
143-
if: success() || failure()
144-
with:
145-
name: unit-test-html-reports
146-
path: '**/build/reports/tests/test/**'
147-
unittests-passed:
148-
name: "unittests-passed"
181+
- name: Setup Java and Gradle
182+
uses: consensys/github-actions/java-setup-gradle@727fd33127a4dc399532450bf9a62f2cfe9fa949
183+
- name: Run integration tests and compile JMH benchmarks
184+
run: ./gradlew integrationTest compileJmh
185+
186+
integration-passed:
187+
name: integration-passed
149188
runs-on: ubuntu-latest
150-
needs: [compile, unitTests, verify-source-metadata]
189+
needs: [integrationTests]
151190
permissions:
152191
checks: write
153192
statuses: write
154193
if: always()
155194
steps:
156-
# Fail if any `needs` job was not a success.
157-
# Along with `if: always()`, this allows this job to act as a single required status check for the entire workflow.
158195
- name: Fail on workflow error
159196
run: exit 1
160197
if: >-
@@ -163,17 +200,3 @@ jobs:
163200
|| contains(needs.*.result, 'cancelled')
164201
|| contains(needs.*.result, 'skipped')
165202
}}
166-
- name: Checkout Repo
167-
if: always()
168-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
169-
with:
170-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
171-
- name: Download all unit test results
172-
if: always()
173-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
174-
with:
175-
pattern: unit-test-results
176-
merge-multiple: true
177-
- name: Report 10 slowest tests
178-
if: always()
179-
run: python3 .github/workflows/reportSlowestTests.sh 10

.github/workflows/container-verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
docker run -d $PLATFORM_OPT --name ${{ env.CONTAINER_NAME }} hyperledger/besu:${{ matrix.combination.tag }}
4848
4949
- name: Verify besu container
50-
run: bash .github/workflows/BesuContainerVerify.sh
50+
run: bash .github/scripts/BesuContainerVerify.sh
5151
env:
5252
TAG: ${{ matrix.combination.tag }}
5353
VERSION: ${{ inputs.version }}

.github/workflows/docker-promote.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
- name: Checkout
9191
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9292
with:
93-
sparse-checkout: '.github/workflows/BesuContainerVerify.sh'
93+
sparse-checkout: '.github/scripts/BesuContainerVerify.sh'
9494

9595
- name: Start container
9696
run: |
@@ -99,7 +99,7 @@ jobs:
9999
docker run -d $PLATFORM_OPT --name ${{ env.CONTAINER_NAME }} ${{ secrets.DOCKER_ORG }}/besu:${{ matrix.combination.tag }}
100100
101101
- name: Verify besu container
102-
run: bash .github/workflows/BesuContainerVerify.sh
102+
run: bash .github/scripts/BesuContainerVerify.sh
103103
env:
104104
TAG: ${{ matrix.combination.tag }}
105105
VERSION: ${{ env.RELEASE_VERSION }}

.github/workflows/draft-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ jobs:
298298
- name: Checkout
299299
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
300300
with:
301-
sparse-checkout: '.github/workflows/BesuContainerVerify.sh'
301+
sparse-checkout: '.github/scripts/BesuContainerVerify.sh'
302302

303303
- name: Start container
304304
run: |
@@ -307,7 +307,7 @@ jobs:
307307
docker run -d $PLATFORM_OPT --name ${{ env.CONTAINER_NAME }} ${{ secrets.DOCKER_ORG }}/besu:${{ matrix.combination.tag }}
308308
309309
- name: Verify besu container
310-
run: bash .github/workflows/BesuContainerVerify.sh
310+
run: bash .github/scripts/BesuContainerVerify.sh
311311
env:
312312
TAG: ${{ matrix.combination.tag }}
313313
VERSION: ${{ env.RELEASE_VERSION }}
@@ -406,4 +406,4 @@ jobs:
406406
run: pip install requests argparse
407407

408408
- name: Run the script
409-
run: python3 .github/workflows/verify_artifacts.py --besu_version="${{ needs.validate.outputs.release_version }}"
409+
run: python3 .github/scripts/verify_artifacts.py --besu_version="${{ needs.validate.outputs.release_version }}"

.github/workflows/integration-tests.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)