Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .github/workflows/maven-progress-compare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: 'Maven download progress: v5.4.0 vs v5.5.0 (#1053)'

# Runs an IDENTICAL real Maven build under v5.4.0 and v5.5.0 so you can compare
# the logs directly. The only difference between the two jobs is the pinned
# setup-java commit:
# - v5.4.0 -> no -ntp in MAVEN_ARGS -> Maven prints "Downloading from ..." /
# "Progress (N): ... kB" transfer-progress lines.
# - v5.5.0 -> -ntp injected into MAVEN_ARGS by default -> those lines are gone.
#
# Each job builds with a fresh, isolated local repository so EVERY dependency and
# plugin is downloaded, maximizing the transfer-progress output that v5.5.0
# suppresses. Full build logs are uploaded as artifacts, and a summary job prints
# the transfer-progress line counts side by side.

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build-v540:
name: 'v5.4.0 real build (shows download progress)'
runs-on: ubuntu-latest
outputs:
maven_args: ${{ steps.build.outputs.maven_args }}
progress_lines: ${{ steps.build.outputs.progress_lines }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
with:
distribution: temurin
java-version: '21'
- name: Build with forced downloads
id: build
working-directory: maven-sample-project
shell: bash
run: |
set -uo pipefail
echo "MAVEN_ARGS='${MAVEN_ARGS:-}'"
# Empty, isolated local repo forces every dependency + plugin to download.
LR="$RUNNER_TEMP/m2-v540"
rm -rf "$LR"; mkdir -p "$LR"
mvn -B -Dmaven.repo.local="$LR" compile 2>&1 | tee build-v5.4.0.log
progress=$(grep -Ec "Downloading from|Downloaded from|Progress \(|[0-9]+/[0-9]+ [kKMG]?B" build-v5.4.0.log || true)
echo "maven_args=${MAVEN_ARGS:-}" >> "$GITHUB_OUTPUT"
echo "progress_lines=$progress" >> "$GITHUB_OUTPUT"
{
echo "### v5.4.0 real build"
echo ""
echo "- \`MAVEN_ARGS\` = \`${MAVEN_ARGS:-<empty>}\`"
echo "- Transfer-progress lines in log: **$progress**"
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload v5.4.0 build log
uses: actions/upload-artifact@v4
with:
name: build-log-v5.4.0
path: maven-sample-project/build-v5.4.0.log

build-v550:
name: 'v5.5.0 real build (progress suppressed by default)'
runs-on: ubuntu-latest
outputs:
maven_args: ${{ steps.build.outputs.maven_args }}
progress_lines: ${{ steps.build.outputs.progress_lines }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@0f481fcb613427c0f801b606911222b5b6f3083a # v5.5.0
with:
distribution: temurin
java-version: '21'
- name: Build with forced downloads
id: build
working-directory: maven-sample-project
shell: bash
run: |
set -uo pipefail
echo "MAVEN_ARGS='${MAVEN_ARGS:-}'"
# Empty, isolated local repo forces every dependency + plugin to download.
LR="$RUNNER_TEMP/m2-v550"
rm -rf "$LR"; mkdir -p "$LR"
mvn -B -Dmaven.repo.local="$LR" compile 2>&1 | tee build-v5.5.0.log
progress=$(grep -Ec "Downloading from|Downloaded from|Progress \(|[0-9]+/[0-9]+ [kKMG]?B" build-v5.5.0.log || true)
echo "maven_args=${MAVEN_ARGS:-}" >> "$GITHUB_OUTPUT"
echo "progress_lines=$progress" >> "$GITHUB_OUTPUT"
{
echo "### v5.5.0 real build"
echo ""
echo "- \`MAVEN_ARGS\` = \`${MAVEN_ARGS:-<empty>}\`"
echo "- Transfer-progress lines in log: **$progress**"
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload v5.5.0 build log
uses: actions/upload-artifact@v4
with:
name: build-log-v5.5.0
path: maven-sample-project/build-v5.5.0.log

compare:
name: 'Compare logs'
needs: [build-v540, build-v550]
runs-on: ubuntu-latest
steps:
- name: Download both build logs
uses: actions/download-artifact@v4
with:
path: logs
- name: Summarize the difference
shell: bash
run: |
set -uo pipefail
v540="${{ needs.build-v540.outputs.progress_lines }}"
v550="${{ needs.build-v550.outputs.progress_lines }}"
echo "v5.4.0 transfer-progress lines: $v540"
echo "v5.5.0 transfer-progress lines: $v550"

{
echo "## Maven download progress: v5.4.0 vs v5.5.0"
echo ""
echo "| setup-java | MAVEN_ARGS | Transfer-progress lines |"
echo "|------------|------------|-------------------------|"
echo "| v5.4.0 | \`${{ needs.build-v540.outputs.maven_args }}\` | $v540 |"
echo "| v5.5.0 | \`${{ needs.build-v550.outputs.maven_args }}\` | $v550 |"
echo ""
echo "Download the \`build-log-v5.4.0\` and \`build-log-v5.5.0\` artifacts to diff the full logs."
} >> "$GITHUB_STEP_SUMMARY"

# Sanity check: v5.4.0 should show progress, v5.5.0 should not.
if [ "${v550}" != "0" ]; then
echo "::warning::Expected 0 transfer-progress lines for v5.5.0 but got ${v550}"
fi
if [ "${v540}" = "0" ]; then
echo "::warning::Expected transfer-progress lines for v5.4.0 but got 0"
fi
echo ""
echo "----- v5.4.0 download lines (sample) -----"
grep -E "Downloading from|Progress \(" "logs/build-log-v5.4.0/build-v5.4.0.log" | head -n 20 || true
echo ""
echo "----- v5.5.0 download lines (sample) -----"
grep -E "Downloading from|Progress \(" "logs/build-log-v5.5.0/build-v5.5.0.log" | head -n 20 || echo "(none - suppressed by -ntp)"
Loading