@@ -62,12 +62,40 @@ jobs:
6262 java-version : ${{ matrix.java }}
6363 cache : ' maven'
6464 - name : Build with Maven
65- run : mvn -Pbuild-without-spotbugs -B package --file pom.xml
65+ run : mvn -Pbuild-without-spotbugs -B package artifact:buildinfo --file pom.xml
6666 - name : Upload coverage to Codecov
6767 uses : codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # 3.1.1
6868 if : ${{ matrix.java == '11.0.x' }} # publish results once
6969 with :
7070 files : ./powertools-cloudformation/target/site/jacoco/jacoco.xml,./powertools-core/target/site/jacoco/jacoco.xml,./powertools-idempotency/target/site/jacoco/jacoco.xml,./powertools-logging/target/site/jacoco/jacoco.xml,./powertools-metrics/target/site/jacoco/jacoco.xml,./powertools-parameters/target/site/jacoco/jacoco.xml,./powertools-serialization/target/site/jacoco/jacoco.xml,./powertools-sqs/target/site/jacoco/jacoco.xml,./powertools-tracing/target/site/jacoco/jacoco.xml,./powertools-validation/target/site/jacoco/jacoco.xml
71+ - name : Get artifacts size & build report
72+ id : artifacts-size-report
73+ if : ${{ matrix.java == '11.0.x' }} # do it once
74+ run : |
75+ report='## Artifacts Size Report\n\n'
76+ report+='| Module | Version | Size |\n'
77+ report+='| --- | --- | --- |\n'
78+ artifact_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
79+ grep 'outputs.*.jar' target/powertools-parent-*.buildinfo | grep -v 'sources.jar' | while IFS= read -r artifact; do
80+ artifact_name=$(echo "$artifact" | cut -d '=' -f2)
81+ artifact_name=${artifact_name%-$artifact_version.jar}
82+ artifact_size=$(grep "${artifact%%.filename*}.length" target/powertools-parent-*.buildinfo | cut -d '=' -f2)
83+ echo "$artifact_name = $artifact_size"
84+ report+="| $artifact_name | $artifact_version | $artifact_size |\n"
85+ done
86+ echo "ARTIFACT_REPORT=$report" >> "$GITHUB_OUTPUT"
87+ - name : Comment artifacts size report
88+ if : ${{ matrix.java == '11.0.x' }} # do it once
89+ uses : actions/github-script@v6
90+ with :
91+ script : |
92+ github.rest.issues.createComment({
93+ issue_number: context.issue.number,
94+ owner: context.repo.owner,
95+ repo: context.repo.repo,
96+ body: ${{ steps.artifacts-size-report.outputs.ARTIFACT_REPORT }}
97+ })
98+
7199 savepr :
72100 runs-on : ubuntu-latest
73101 name : Save PR number if running on PR by dependabot
0 commit comments