1+ name : Artifacts Size
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - master
7+ paths :
8+ - ' powertools-cloudformation/**'
9+ - ' powertools-core/**'
10+ - ' powertools-serialization/**'
11+ - ' powertools-logging/**'
12+ - ' powertools-sqs/**'
13+ - ' powertools-tracing/**'
14+ - ' powertools-validation/**'
15+ - ' powertools-parameters/**'
16+ - ' powertools-idempotency/**'
17+ - ' powertools-metrics/**'
18+ - ' pom.xml'
19+ jobs :
20+ codecheck :
21+ runs-on : ubuntu-latest
22+ steps :
23+ - uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
24+ - name : Setup java JDK 11
25+ uses : actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
26+ with :
27+ distribution : ' corretto'
28+ java-version : 11
29+ - name : Build with Maven
30+ run : mvn clean package --file pom.xml -DskipTests
31+ - name : Get artifacts size & build report
32+ id : artifacts-size-report
33+ run : |
34+ echo '## :floppy_disk: Artifacts Size Report' > report.md
35+ echo '| Module | Version | Size (KB) |' >> report.md
36+ echo '| --- | --- | --- |' >> report.md
37+ artifact_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
38+ for artifact in $(cat target/powertools-parent-*.buildinfo | grep 'outputs.*.jar' | grep -v 'sources.jar'); do
39+ artifact_name=$(echo "$artifact" | cut -d '=' -f2)
40+ artifact_name=${artifact_name%-$artifact_version.jar}
41+ artifact_size=$(grep "${artifact%%.filename*}.length" target/powertools-parent-*.buildinfo | cut -d '=' -f2)
42+ printf "| %s | %s | %.2f |\n" "$artifact_name" "$artifact_version" "$(bc <<< "scale=2; $artifact_size/1000")" >> report.md
43+ done
44+ - name : Find potential existing report
45+ uses : peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # 2.4.0
46+ id : find-comment
47+ with :
48+ issue-number : ${{ github.event.pull_request.number }}
49+ comment-author : ' github-actions[bot]'
50+ body-includes : Artifacts Size Report
51+ - name : Write artifacts size report in comment
52+ uses : peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # 3.0.2
53+ with :
54+ comment-id : ${{ steps.find-comment.outputs.comment-id }}
55+ issue-number : ${{ github.event.pull_request.number }}
56+ body-path : ' report.md'
57+ edit-mode : replace
0 commit comments