Skip to content

Commit d2cf9a7

Browse files
committed
Added skip_tests option for package JAR
1 parent d887dc0 commit d2cf9a7

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

.github/workflows/shared-publish-docker-versioned.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ on:
2727
description: If 'yes', will force the creation a release, if 'no' will not create a release. 'branch' will use release_type and the branch to determine if a release should be created.
2828
type: string
2929
default: 'branch'
30+
skip_tests:
31+
description: If true, will skip tests when packaging JAR. Defaults to false. Set to true for test-only repos.
32+
type: boolean
33+
default: false
3034
outputs:
3135
version_number_output:
3236
description: The complete version number
@@ -108,7 +112,11 @@ jobs:
108112
- name: Package JAR
109113
id: package
110114
run: |
111-
mvn -B package -P ${{ inputs.cloud_provider }}
115+
if [[ "${{ inputs.skip_tests }}" == "false" ]]; then
116+
mvn -B package -P ${{ inputs.cloud_provider }}
117+
else
118+
mvn -B package -P ${{ inputs.cloud_provider }} -DskipTests
119+
fi
112120
echo "jar_version=$(mvn help:evaluate -Dexpression=project.version | grep -e '^[1-9][^\[]')" >> $GITHUB_OUTPUT
113121
echo "git_commit=$(git show --format="%h" --no-patch)" >> $GITHUB_OUTPUT
114122

.github/workflows/shared-validate-image.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ on:
2222
upload_vulnerabilities:
2323
type: boolean
2424
default: true
25+
skip_tests:
26+
description: If true, will skip tests when packaging JAR. Defaults to false. Set to true for test-only repos.
27+
type: boolean
28+
default: false
2529

2630
env:
2731
REGISTRY: ghcr.io
@@ -57,7 +61,11 @@ jobs:
5761
id: package
5862
shell: bash
5963
run: |
60-
mvn -B package -P ${{ inputs.cloud_provider }}
64+
if [[ "${{ inputs.skip_tests }}" == "false" ]]; then
65+
mvn -B package -P ${{ inputs.cloud_provider }}
66+
else
67+
mvn -B package -P ${{ inputs.cloud_provider }} -DskipTests
68+
fi
6169
echo "jar_version=$(mvn help:evaluate -Dexpression=project.version | grep -e '^[1-9][^\[]')" >> $GITHUB_OUTPUT
6270
echo "git_commit=$(git show --format="%h" --no-patch)" >> $GITHUB_OUTPUT
6371

0 commit comments

Comments
 (0)