-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (126 loc) · 4.83 KB
/
integration_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#
# 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]
- name: Test 1 - default
id: test_1
uses: AbsaOSS/filename-inspector@master
with:
name-patterns: '*UnitTest.*,*IntegrationTest.*'
paths: '**/src/test/java/**,**/src/test/scala/**'
- name: Test 2 - custom with multiple line inputs
id: test_2
uses: AbsaOSS/filename-inspector@master
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: AbsaOSS/filename-inspector@master
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: AbsaOSS/filename-inspector@master
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: AbsaOSS/filename-inspector@master
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)`);
}