Skip to content

Commit 0015b57

Browse files
committed
update workflows
1 parent 08a3d41 commit 0015b57

File tree

4 files changed

+176
-9
lines changed

4 files changed

+176
-9
lines changed

.github/workflows/check-build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
paths:
5+
- 'powertools-batch/**'
6+
- 'powertools-cloudformation/**'
7+
- 'powertools-core/**'
8+
- 'powertools-e2e-tests/**'
9+
- 'powertools-idempotency/**'
10+
- 'powertools-large-messages/**'
11+
- 'powertools-logging/**'
12+
- 'powertools-metrics/**'
13+
- 'powertools-parameters/**'
14+
- 'powertools-serialization/**'
15+
- 'powertools-sqs/**'
16+
- 'powertools-test-suite/**'
17+
- 'powertools-tracing/**'
18+
- 'powertools-validation/**'
19+
- 'examples/**'
20+
- 'pom.xml'
21+
- 'examples/pom.xml'
22+
- '.github/workflows/**'
23+
push:
24+
branches:
25+
- main
26+
paths:
27+
- 'powertools-batch/**'
28+
- 'powertools-cloudformation/**'
29+
- 'powertools-core/**'
30+
- 'powertools-e2e-tests/**'
31+
- 'powertools-idempotency/**'
32+
- 'powertools-large-messages/**'
33+
- 'powertools-logging/**'
34+
- 'powertools-metrics/**'
35+
- 'powertools-parameters/**'
36+
- 'powertools-serialization/**'
37+
- 'powertools-sqs/**'
38+
- 'powertools-test-suite/**'
39+
- 'powertools-tracing/**'
40+
- 'powertools-validation/**'
41+
- 'examples/**'
42+
- 'pom.xml'
43+
- 'examples/pom.xml'
44+
- '.github/workflows/**'
45+
46+
name: Build
47+
run-name: Build - ${{ github.event_name }}
48+
49+
jobs:
50+
...

.github/workflows/check-pmd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44
schedule:
55
- cron: '0 12 * * *' # Run daily at 12:00 UTC
6-
6+
77
name: PMD
88
run-name: PMD - ${{ github.event_name }}
99

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
paths:
6+
- 'powertools-cloudformation/**'
7+
- 'powertools-core/**'
8+
- 'powertools-serialization/**'
9+
- 'powertools-logging/**'
10+
- 'powertools-sqs/**'
11+
- 'powertools-tracing/**'
12+
- 'powertools-validation/**'
13+
- 'powertools-parameters/**'
14+
- 'powertools-idempotency/**'
15+
- 'powertools-metrics/**'
16+
- 'powertools-test-suite/**'
17+
- 'pom.xml'
18+
- '.github/workflows/**'
19+
20+
name: SpotBugs
21+
run-name: SpotBugs
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
codecheck:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
31+
- name: Setup java JDK 1.8
32+
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
33+
with:
34+
distribution: 'corretto'
35+
java-version: 8
36+
# https://github.com/jwgmeligmeyling/spotbugs-github-action/issues/6
37+
# https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/
38+
# Avoid complexity of git action with publishing report. Just build with spotbugs profile.
39+
# - name: Build with Maven for spotbugs check to gather reports
40+
# run: mvn -Pbuild-with-spotbugs -B install --file pom.xml -DskipTests -Dmaven.javadoc.skip=true -Dspotbugs.failOnError=false
41+
# - uses: jwgmeligmeyling/spotbugs-github-action@master
42+
# with:
43+
# path: '**/spotbugsXml.xml'
44+
# # Can be simplified post this issue is fixed https://github.com/jwgmeligmeyling/spotbugs-github-action/issues/9
45+
- name: Build with Maven for spotbugs check to mark build as fail if voilations found
46+
run: mvn -Pbuild-with-spotbugs -B install --file pom.xml -DskipTests -Dmaven.javadoc.skip=true -Dspotbugs.failOnError=true

.github/workflows/release.yml

Lines changed: 79 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ on:
88
type: boolean
99
description: Create snapshot release
1010
default: true
11+
skip_checks:
12+
type: boolean
13+
description: Skip quality checks
14+
default: false
1115
skip_publish:
1216
type: boolean
1317
description: Ship publish to Maven Central
1418
default: false
19+
conintue_on_error:
20+
type: boolean
21+
description:
22+
default: false
1523

1624
name: Release
1725
run-name: Release
@@ -22,6 +30,8 @@ permissions:
2230
jobs:
2331
version_seal:
2432
runs-on: ubuntu-latest
33+
outputs:
34+
source_hash: ${{ steps.upload_source.outputs.artifact-digest }}
2535
steps:
2636
- id: checkout
2737
name: Checkout repository
@@ -31,15 +41,76 @@ jobs:
3141
uses: ./.github/actions/version
3242
with:
3343
new_version: ${{ inputs.version }}
34-
- id: seal
35-
name: seal
36-
uses: ./.github/actions/seal
44+
- id: upload_source
45+
name: Upload artifacts
46+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
3747
with:
38-
prefix: source
39-
48+
if-no-files-found: error
49+
name: source
50+
path: |
51+
*
52+
!.git/*
53+
include-hidden-files: true
54+
retention-days: 1
55+
4056
quality:
4157
runs-on: ubuntu-latest
58+
needs:
59+
- version_seal
60+
if: ${{ inputs.skip_checks }}
61+
permissions:
62+
contents: write
63+
id-token: write
4264
steps:
43-
- id: restore
44-
name: restore
45-
uses: ./.github/restore
65+
- id: download_source
66+
name: Download artifacts
67+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.6.1
68+
with:
69+
name: source
70+
- name: Setup Java
71+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
72+
with:
73+
distribution: corretto
74+
java-version: 21
75+
cache: maven
76+
# non-exhuastive, but gives a fair indication if the final build will succeed, tests will run when we build later
77+
- name: Run unit tests
78+
run: mvn -B test --file pom.xml
79+
continue-on-error: ${{ inputs.conintue_on_error }}
80+
- name: Run Spotbugs
81+
run: mvn -Pbuild-with-spotbugs -B install --file pom.xml -DskipTests -Dmaven.javadoc.skip=true -Dspotbugs.failOnError=${{ inputs.conintue_on_error }}
82+
continue-on-error: ${{ inputs.conintue_on_error }}
83+
- uses: pmd/pmd-github-action@d9c1f3c5940cbf5923f1354e83fa858b4496ebaa # v2.0.0
84+
with:
85+
rulesets: '.github/pmd-ruleset.xml'
86+
token: ${{ secrets.GITHUB_TOKEN }}
87+
uploadSarifReport: false
88+
89+
build:
90+
runs-on: ubuntu-latest
91+
needs:
92+
- quality
93+
strategy:
94+
matrix:
95+
java_version:
96+
- 8
97+
- 11
98+
- 17
99+
- 21
100+
steps:
101+
- id: download_source
102+
name: Download artifacts
103+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.6.1
104+
with:
105+
name: source
106+
- name: Setup Java
107+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
108+
with:
109+
distribution: corretto
110+
java-version: ${{ matrix.java_version }}
111+
cache: maven
112+
- id: build-maven
113+
name: Build (Maven)
114+
run: |
115+
mvn -B install --file pom.xml
116+

0 commit comments

Comments
 (0)