-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
109 lines (99 loc) · 4.24 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
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
name: "UTBot code analysis"
description: "UTBot code analysis allows adding tests and code analysis information by pull request"
branding:
icon: 'terminal'
color: 'blue'
on:
inputs:
add_tests:
description: 'Do tests need to be pushed'
required: true
refresh_tests:
description: 'Do old tests need to be deleted'
required: true
utbot_version:
description: 'UTBot version'
required: true
scope:
description: 'Run utbot to all project, directory or file'
required: true
path:
description: 'directory or file name'
required: true
runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Delete old tests
if: ${{ inputs.refresh_tests == 'true' }}
uses: EndBug/add-and-commit@v9
with:
remove: 'tests'
author_name: 'github-actions[utbot]'
message: 'UTBot code analysis delete old tests'
- name: Download server executable
run: |
mkdir "utbot-release-${{ inputs.utbot_version }}"
wget -qq "https://github.com/olezhabobrov/UTBotCpp/releases/download/v${{ inputs.utbot_version }}/utbot-release-${{ inputs.utbot_version }}.zip" -P "./utbot-release-${{ inputs.utbot_version }}"
unzip -qq "./utbot-release-${{ inputs.utbot_version }}/utbot-release-${{ inputs.utbot_version }}.zip" -d "./utbot-release-${{ inputs.utbot_version }}/"
chmod +x "./utbot-release-${{ inputs.utbot_version }}/unpack_and_run_utbot.sh"
cd "./utbot-release-${{ inputs.utbot_version }}" && ./unpack_and_run_utbot.sh
shell: sh
- name: Testing project
if: ${{ inputs.scope == 'project' }}
run: |
cd "./utbot-release-${{ inputs.utbot_version }}/utbot_distr"
export CURRENT_FOLDER="$( cd $( dirname . ) && pwd )"
RUN_SYSTEM_SCRIPT_PATH=$CURRENT_FOLDER/utbot_run_system.sh
UTBOT_CLI_OPTIONS="generate --project-path ../.. project"
$RUN_SYSTEM_SCRIPT_PATH "cli" $UTBOT_CLI_OPTIONS
shell: sh
- name: Testing file
if: ${{ inputs.scope == 'file' }}
run: |
cd "./utbot-release-${{ inputs.utbot_version }}/utbot_distr"
export CURRENT_FOLDER="$( cd $( dirname . ) && pwd )"
RUN_SYSTEM_SCRIPT_PATH=$CURRENT_FOLDER/utbot_run_system.sh
UTBOT_CLI_OPTIONS="generate --project-path ../.. file --file-path ../../${{ inputs.path }}"
$RUN_SYSTEM_SCRIPT_PATH "cli" $UTBOT_CLI_OPTIONS
shell: sh
- name: Testing directory
if: ${{ inputs.scope == 'directory' }}
run: |
cd "./utbot-release-${{ inputs.utbot_version }}/utbot_distr"
export CURRENT_FOLDER="$( cd $( dirname . ) && pwd )"
RUN_SYSTEM_SCRIPT_PATH=$CURRENT_FOLDER/utbot_run_system.sh
UTBOT_CLI_OPTIONS="generate --project-path ../../${{ inputs.path }} folder --folder-path ../../${{ inputs.path }}"
$RUN_SYSTEM_SCRIPT_PATH "cli" $UTBOT_CLI_OPTIONS
ls
shell: sh
- name: Create Pull Request with tests and codeAnalysis information
uses: peter-evans/create-pull-request@v4
if: ${{ inputs.add_tests == 'true' }}
with:
add-paths: |
tests/
codeAnalysis/
commit-message: UTBot code analysis add tests and codeAnalysis information
branch-suffix: short-commit-hash
branch: utbote-code-analysis
title: UTBot code analysis
body: UTBot code analysis add tests and codeAnalysis information
delete-branch: true
- name: Create Pull Request with tests and codeAnalysis information
uses: peter-evans/create-pull-request@v4
if: ${{ inputs.add_tests != 'true' }}
with:
add-paths: |
codeAnalysis/
commit-message: UTBot code analysis add tests and codeAnalysis information
branch-suffix: short-commit-hash
branch: utbote-code-analysis
title: UTBot code analysis
body: UTBot code analysis add tests and codeAnalysis information
delete-branch: true
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: codeAnalysis/project_code_analysis.sarif