-
Notifications
You must be signed in to change notification settings - Fork 1k
178 lines (174 loc) · 6.65 KB
/
pre-review.yml
File metadata and controls
178 lines (174 loc) · 6.65 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: pre-review
on:
merge_group:
pull_request:
branches:
- main
- release-*
- verkle
- performance
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.parallel=true"
jobs:
repolint:
name: "Repository Linting"
runs-on: ubuntu-latest
container: ghcr.io/todogroup/repolinter:v0.11.2
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Lint Repo
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
gradle-wrapper:
name: "Gradle Wrapper Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- uses: gradle/actions/wrapper-validation@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6.0.1
spotless-checkLicense:
name: "Spotless & Check License"
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6.0.1
with:
cache-disabled: true
- name: run spotless
run: ./gradlew spotlessCheck
- name: run checkLicense
run: ./gradlew --no-parallel checkLicense # no-parallel due to https://github.com/jk1/Gradle-License-Report/issues/337
- name: upload license report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: checkLicense
path: build/reports/dependency-license
compile:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [spotless-checkLicense, gradle-wrapper, repolint]
steps:
- name: Checkout Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6.0.1
with:
cache-disabled: true
- name: Gradle Compile
run: ./gradlew build -x test -x spotlessCheck
verify-source-metadata:
name: "Verify Dependency Source Metadata"
runs-on: ubuntu-latest
needs: [spotless-checkLicense, gradle-wrapper, repolint]
steps:
- name: Checkout Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6.0.1
with:
cache-disabled: true
- name: Verify source artifacts recorded in verification-metadata.xml
run: ./gradlew verifySourceArtifacts
unitTests:
runs-on: besu-research-ubuntu-16 # more cores
needs: [spotless-checkLicense, gradle-wrapper, repolint]
permissions:
checks: write
statuses: write
strategy:
fail-fast: true
steps:
- name: Checkout Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: 21
- name: Install required packages
run: sudo apt-get install -y xmlstarlet
- name: Setup Gradle
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6.0.1
with:
cache-disabled: true
add-job-summary: on-failure
- name: run unit tests
env:
# reducing JVM forks to increase reuse of setup code such as SignatureAlgorithm
GRADLE_MAX_TEST_FORKS: 2 # besu-research-ubuntu-16 will use 8 by default
run: ./gradlew -Dorg.gradle.parallel=true -Dorg.gradle.caching=true test
- name: Upload Unit Test Results
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: unit-test-results
path: '**/test-results/**/TEST-*.xml'
- name: Upload Unit Test HTML Reports
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: success() || failure()
with:
name: unit-test-html-reports
path: '**/build/reports/tests/test/**'
unittests-passed:
name: "unittests-passed"
runs-on: ubuntu-latest
needs: [compile, unitTests, verify-source-metadata]
permissions:
checks: write
statuses: write
if: always()
steps:
# Fail if any `needs` job was not a success.
# Along with `if: always()`, this allows this job to act as a single required status check for the entire workflow.
- name: Fail on workflow error
run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
- name: Checkout Repo
if: always()
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Download all unit test results
if: always()
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: unit-test-results
merge-multiple: true
- name: Report 10 slowest tests
if: always()
run: python3 .github/workflows/reportSlowestTests.sh 10