-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
81 lines (66 loc) · 2.92 KB
/
action.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
name: "UTBot static code analysis"
description: "The GitHub action for generating tests and creating SARIF reports based on UTBotJava"
branding:
icon: 'coffee'
color: 'red'
inputs:
pushTests:
description: "Push generated tests to the repository or not."
default: 'true'
targetClasses:
description: "Classes for which the SARIF-report will be created. Uses all source classes from the user project if this list is empty."
default: 'all'
generatedTestsRelativeRoot:
description: "Relative path (against repository root) to the root of the generated tests."
default: '.utbot/test'
testFramework:
description: "The name of the test framework to be used. Options: ['junit4', 'junit5', 'testng']."
default: 'junit5'
generationTimeout:
description: "Time budget for generating tests for one class (in milliseconds)."
default: '60000'
codegenLanguage:
description: "The language of the generated tests. Options: ['java', 'kotlin']."
default: 'java'
mockStrategy:
description: "The mock strategy to be used. Options: ['no-mocks', 'other-packages', 'other-classes']."
default: 'other-packages'
staticsMocking:
description: "Use static methods mocking or not. Options: ['do-not-mock-statics', 'mock-statics']."
default: 'mock-statics'
forceStaticMocking:
description: "Forces mocking static methods and constructors for classesToMockAlways classes or not. Options: ['force', 'do-not-force']."
default: 'force'
classesToMockAlways:
description: "Classes to force mocking theirs static methods and constructors. By default, some internal classes are used."
default: '[]'
runs:
using: 'composite'
steps:
- name: Run generateTestsAndSarifReport task
run: gradle generateTestsAndSarifReport
-PtargetClasses="${{ inputs.targetClasses }}"
-PgeneratedTestsRelativeRoot=${{ inputs.generatedTestsRelativeRoot }}
-PsarifReportsRelativeRoot='.utbot/sarif'
-PtestFramework=${{ inputs.testFramework }}
-PgenerationTimeout=${{ inputs.generationTimeout }}
-PcodegenLanguage=${{ inputs.codegenLanguage }}
-PmockStrategy=${{ inputs.mockStrategy }}
-PstaticsMocking=${{ inputs.staticsMocking }}
-PforceStaticMocking=${{ inputs.forceStaticMocking }}
-PclassesToMockAlways="${{ inputs.classesToMockAlways }}"
-PmergedSarifReportFileName='utbot-report.sarif'
shell: bash
- name: Commit and push generated tests
if: ${{ inputs.pushTests == 'true' }}
uses: EndBug/add-and-commit@v9
with:
add: ${{ inputs.generatedTestsRelativeRoot }}
message: "[UTBot]: Add generated tests"
author_name: github-actions[bot]
author_email: 41898282+github-actions[bot]@users.noreply.github.com
push: true
- name: Upload SARIF report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: .utbot/sarif/utbot-report.sarif