Skip to content

Commit 3972ba9

Browse files
authored
Skip no test run (#159)
1 parent d1dbdd3 commit 3972ba9

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

.github/workflows/shared-build-and-test.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
description: The path to the pom.xml file.
2121
type: string
2222
default: '.'
23+
skip_tests:
24+
description: If true, will skip tests when building and running unit tests. Defaults to false. Set to true for test-only repos.
25+
type: boolean
26+
default: false
2327

2428
jobs:
2529
build:
@@ -44,11 +48,17 @@ jobs:
4448
java-version: ${{ inputs.java_version }}
4549

4650
- name: Build and run unit tests
47-
if: ${{ inputs.vulnerability_scan_only == 'false' }}
51+
if: ${{ inputs.vulnerability_scan_only == 'false' && inputs.skip_tests == 'false' }}
4852
working-directory: ${{ inputs.working_dir }}
4953
run: |
5054
bash uid2-shared-actions/scripts/compile_java_test_and_verify.sh
5155
56+
- name: Build without unit tests
57+
if: ${{ inputs.vulnerability_scan_only == 'false' && inputs.skip_tests == 'true' }}
58+
working-directory: ${{ inputs.working_dir }}
59+
run: |
60+
mvn -B clean compile -DskipTests
61+
5262
- name: Generate code coverage
5363
if: ${{ inputs.vulnerability_scan_only == 'false' }}
5464
run: mvn jacoco:report

.github/workflows/shared-publish-to-maven-versioned.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
description: The severity to fail the workflow if such vulnerability is detected. DO NOT override it unless a Jira ticket is raised. Must be one of ['CRITICAL', 'CRITICAL,HIGH' or 'CRITICAL,HIGH,MEDIUM'] (without space in between).
2626
type: string
2727
default: 'CRITICAL,HIGH'
28+
skip_tests:
29+
description: If true, will skip tests when compiling. Defaults to false. Set to true for test-only repos.
30+
type: boolean
31+
default: false
2832

2933
env:
3034
IS_RELEASE: ${{ (inputs.release_type == 'Major' || inputs.release_type == 'Minor' || inputs.release_type == 'Patch') && (github.event.repository.default_branch == github.ref_name ) }}
@@ -119,13 +123,19 @@ jobs:
119123
mvn -B -s settings.xml -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" clean deploy
120124
121125
- name: Compile
122-
if: ${{ inputs.publish_to_maven != true }}
126+
if: ${{ inputs.publish_to_maven != true && inputs.skip_tests == false }}
123127
env:
124128
EXTRA_FLAGS: "-s settings.xml -Dgpg.passphrase=\"${{ secrets.GPG_PASSPHRASE }}\""
125129
run: |
126130
cd ./${{ inputs.working_dir }}
127131
bash uid2-shared-actions/scripts/compile_java_test_and_verify.sh -s settings.xml -D gpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
128132
133+
- name: Compile with no tests
134+
if: ${{ inputs.publish_to_maven != true && inputs.skip_tests == true }}
135+
run: |
136+
cd ./${{ inputs.working_dir }}
137+
mvn -B -s settings.xml -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" clean compile -DskipTests
138+
129139
- name: Commit pom.xml and version.json
130140
if: ${{ steps.checkRelease.outputs.is_release != 'true' }}
131141
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v2

0 commit comments

Comments
 (0)