@@ -35,6 +35,33 @@ concurrency: |
35 | 35 | cancel-in-progress: true |
36 | 36 |
|
37 | 37 | jobs: |
| 38 | + # Figures out which modules are touched by the PR so the (expensive) test legs below can be restricted |
| 39 | + # to them. See .github/scripts/detect_affected_modules.sh for the rules, anything that can't be mapped to |
| 40 | + # a module results in a full build. |
| 41 | + detect-affected: |
| 42 | + runs-on: ubuntu-24.04 |
| 43 | + outputs: |
| 44 | + modules: ${{ steps.detect.outputs.modules }} |
| 45 | + steps: |
| 46 | + # Pinned to v5.1.0 |
| 47 | + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 |
| 48 | + with: |
| 49 | + # For pull requests this is the merge commit, we need its first parent (the base branch) to diff against. |
| 50 | + fetch-depth: 2 |
| 51 | + |
| 52 | + - name: Detect affected modules |
| 53 | + id: detect |
| 54 | + run: | |
| 55 | + modules=ALL |
| 56 | + if [ "${{ github.event_name }}" = "pull_request" ]; then |
| 57 | + modules=$(./.github/scripts/detect_affected_modules.sh HEAD^1) || { |
| 58 | + echo "::warning::Could not detect the affected modules, falling back to a full build" |
| 59 | + modules=ALL |
| 60 | + } |
| 61 | + fi |
| 62 | + echo "modules=$modules" >> "$GITHUB_OUTPUT" |
| 63 | + echo "Affected modules: $modules" | tee -a "$GITHUB_STEP_SUMMARY" |
| 64 | +
|
38 | 65 | verify-pr: |
39 | 66 | runs-on: ubuntu-22.04 |
40 | 67 | steps: |
|
69 | 96 | build-pr-windows: |
70 | 97 | runs-on: windows-2022 |
71 | 98 | name: windows-x86_64-java11-boringssl |
72 | | - needs: verify-pr |
| 99 | + needs: [verify-pr, detect-affected] |
73 | 100 | env: |
74 | 101 | # Let's limit the amount of ram that is used to unpack rustup as we saw |
75 | 102 | # failures sometimes due the fact that not enough memory could be reserved. |
@@ -122,7 +149,14 @@ jobs: |
122 | 149 | uses: testlens-app/setup-testlens@d29a2be31512b3aeda3adcef09fbe0d55af90c51 # Pin 1.9.4 |
123 | 150 |
|
124 | 151 | - name: Build project |
125 | | - run: ./mvnw.cmd -B -ntp --file pom.xml clean package -Pboringssl -DskipHttp2Testsuite=true -DskipAutobahnTestsuite=true |
| 152 | + # Run through bash (git bash is part of the runner image) as mvn_affected.sh is a bash script. |
| 153 | + # install (not package) as the modules that are not part of the affected set are resolved from the local repository. |
| 154 | + shell: bash |
| 155 | + env: |
| 156 | + # ALL, NONE or the comma separated list of modules, see .github/scripts/mvn_affected.sh |
| 157 | + NETTY_AFFECTED_MODULES: ${{ needs.detect-affected.outputs.modules }} |
| 158 | + NETTY_MVN: ./mvnw.cmd |
| 159 | + run: ./.github/scripts/mvn_affected.sh -B -ntp --file pom.xml clean install -Pboringssl -DskipHttp2Testsuite=true -DskipAutobahnTestsuite=true |
126 | 160 |
|
127 | 161 | - name: print JVM thread dumps when cancelled |
128 | 162 | uses: ./.github/actions/thread-dump-jvms |
@@ -211,42 +245,44 @@ jobs: |
211 | 245 | include: |
212 | 246 | - setup: linux-x86_64-java11 |
213 | 247 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml build" |
214 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml run build" |
| 248 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml run build-affected-only" |
215 | 249 | - setup: linux-x86_64-java21-graal |
216 | 250 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.graalvm121.yaml build" |
217 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.graalvm121.yaml run build" |
| 251 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.graalvm121.yaml run build-affected-only" |
218 | 252 | - setup: linux-x86_64-java17 |
219 | 253 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.117.yaml build" |
220 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.117.yaml run build" |
| 254 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.117.yaml run build-affected-only" |
221 | 255 | - setup: linux-x86_64-java21 |
222 | 256 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.21.yaml build" |
223 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.21.yaml run build-with-oio-testsuite" |
| 257 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.21.yaml run build-with-oio-testsuite-affected-only" |
224 | 258 | - setup: linux-x86_64-java24 |
225 | 259 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.24.yaml build" |
226 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.24.yaml run build" |
| 260 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.24.yaml run build-affected-only" |
227 | 261 | - setup: linux-x86_64-java25 |
228 | 262 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.25.yaml build" |
229 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.25.yaml run build" |
| 263 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.25.yaml run build-affected-only" |
230 | 264 | - setup: linux-x86_64-java26 |
231 | 265 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.26.yaml build" |
232 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.26.yaml run build" |
| 266 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.26.yaml run build-affected-only" |
| 267 | + # The one leg that always builds and tests everything (with leak detection), so leaks in modules |
| 268 | + # depending on a changed one are still found. All the other legs only build the affected modules. |
233 | 269 | - setup: linux-x86_64-java11-boringssl |
234 | 270 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml build" |
235 | 271 | docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml run build-leak-boringssl-static" |
236 | 272 | - setup: linux-x86_64-java11-pooled |
237 | 273 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml build" |
238 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml run build-leak-pooled" |
| 274 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml run build-leak-pooled-affected-only" |
239 | 275 | - setup: linux-x86_64-java11-boringssl-jdk8-tests |
240 | 276 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml build" |
241 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml run build-boringssl-static-jdk8-tests" |
| 277 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.centos-7.111.yaml run build-boringssl-static-jdk8-tests-affected-only" |
242 | 278 | - setup: linux-x86_64-java11-awslc |
243 | 279 | docker-compose-build: "-f docker/docker-compose.yaml -f docker/docker-compose.al2023.yaml build" |
244 | 280 | docker-compose-install-tcnative: "-f docker/docker-compose.yaml -f docker/docker-compose.al2023.yaml run install-tcnative" |
245 | 281 | docker-compose-update-tcnative-version: "-f docker/docker-compose.yaml -f docker/docker-compose.al2023.yaml run update-tcnative-version" |
246 | | - docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.al2023.yaml run build" |
| 282 | + docker-compose-run: "-f docker/docker-compose.yaml -f docker/docker-compose.al2023.yaml run build-affected-only" |
247 | 283 |
|
248 | 284 | name: ${{ matrix.setup }} build |
249 | | - needs: verify-pr |
| 285 | + needs: [verify-pr, detect-affected] |
250 | 286 | permissions: |
251 | 287 | contents: read |
252 | 288 | packages: write # to push the docker build cache to ghcr.io; no-op (ignored) for fork PRs |
@@ -331,6 +367,10 @@ jobs: |
331 | 367 | run: docker compose ${{ matrix.docker-compose-update-tcnative-version }} |
332 | 368 |
|
333 | 369 | - name: Build project with leak detection |
| 370 | + env: |
| 371 | + # ALL, NONE or the comma separated list of modules, only used by the build-affected-only service |
| 372 | + # (see .github/scripts/mvn_affected.sh), all other services always build everything. |
| 373 | + NETTY_AFFECTED_MODULES: ${{ needs.detect-affected.outputs.modules }} |
334 | 374 | run: docker compose ${{ matrix.docker-compose-run }} | tee build-leak.output |
335 | 375 |
|
336 | 376 | - name: Checking for test failures |
|