Skip to content

Feature/prepare for release #41

Feature/prepare for release

Feature/prepare for release #41

#
# Copyright 2024 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Integration Tests
on:
pull_request:
branches:
- '**'
types: [ opened, synchronize, reopened ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Test 1 - default
id: test_1
uses: ./
with:
name-patterns: '*UnitTest.*,*IntegrationTest.*'
paths: '**/src/test/java/**,**/src/test/scala/**'
- name: Test 2 - custom with multiple line inputs
id: test_2
uses: ./
with:
name-patterns: |
*UnitTest.*,
*IntegrationTest.*
paths: |
**/src/test/java/**,
**/src/test/scala/**
excludes: |
src/exclude_dir/*.py,
tests/exclude_file.py
report-format: 'console'
verbose-logging: 'true'
fail-on-violation: 'false'
- name: Check output violation count from Test 1
uses: actions/github-script@v7
with:
script: |
const violationCount = parseInt('${{ steps.test_1.outputs.violation-count }}');
console.log(`Test 1 violation count: ${violationCount}`);
if (violationCount !== 5) {
core.setFailed(`Wrong amount '${violationCount}' of violations detected in 'Test 1' (5 expected)`);
}
- name: Check output violation count from Test 2
uses: actions/github-script@v7
with:
script: |
const violationCount = parseInt('${{ steps.test_2.outputs.violation-count }}');
console.log(`Test 2 violation count: ${violationCount}`);
if (violationCount !== 5) {
core.setFailed(`Wrong amount '${violationCount}' of violations detected in 'Test 2' (5 expected)`);
}
- name: Test 3 - csv report
id: test_3
uses: ./
with:
name-patterns: '*UnitTest.*,*IntegrationTest.*'
paths: '**/src/test/java/**,**/src/test/scala/**'
report-format: 'csv'
- name: Check output violation report path from Test 3
uses: actions/github-script@v7
with:
script: |
const reportPath = '${{ steps.test_3.outputs.report-path }}'
console.log(`Test 3 report path: ${reportPath}`);
if (reportPath !== 'violations.csv') {
core.setFailed(`Wrong report path value '${reportPath}' detected in 'Test 3'`);
}
- name: Test 4 - json report
id: test_4
uses: ./
with:
name-patterns: '*UnitTest.*,*IntegrationTest.*'
paths: '**/src/test/java/**,**/src/test/scala/**'
report-format: 'json'
- name: Check output violation report path from Test 4
uses: actions/github-script@v7
with:
script: |
const reportPath = '${{ steps.test_4.outputs.report-path }}'
console.log(`Test 4 report path: ${reportPath}`);
if (reportPath !== 'violations.json') {
core.setFailed(`Wrong report path value '${reportPath}' detected in 'Test 4'`);
}
- name: Test 5 - custom with multiple line inputs
id: test_5
uses: ./
with:
name-patterns: |
*UnitTest.*,
*IntegrationTest.*
paths: |
**/src/test/java/**,
**/src/test/scala/**
excludes: |
*/*ttest*.java,
*/src/test/java/*Unittest*.java,
*/src/test/java/*Tests.java,
*/src/test/java/test*.java,
*/src/test/java/AnotherUnittests.java
report-format: 'console'
verbose-logging: 'true'
fail-on-violation: 'true'
- name: Check output violation count from Test 5 - success
uses: actions/github-script@v7
with:
script: |
const violationCount = parseInt('${{ steps.test_5.outputs.violation-count }}');
console.log(`Test 5 violation count: ${violationCount}`);
if (violationCount !== 0) {
core.setFailed(`Wrong amount '${violationCount}' of violations detected in 'Test 5' (0 expected)`);
}