Skip to content

Commit

Permalink
Add pull request option
Browse files Browse the repository at this point in the history
  • Loading branch information
slawa4s authored Jun 5, 2022
1 parent cd936a1 commit 7557360
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,17 @@ on:
test_push_info:
description: 'Do tests need to be pushed'
required: true
default: 'true'
type: choice
options:
- yes
- no
default: true
type: boolean
test_delete_info:
description: 'Do old tests need to be deleted'
required: true
default: 'false'
type: choice
options:
- yes
- no
default: false
type: boolean

env:
utbot_version: "1.0.1"
repository_name: "olezhabobrov"

jobs:
build:
Expand All @@ -34,46 +29,59 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Delete old tests
if: github.event.inputs.test_delete_info == 'true'
uses: EndBug/add-and-commit@v9
with:
remove: 'tests'
author_name: 'github-actions[utbot]'
message: 'UTBot code analysis delete old tests'
push: true

- name: Download server executable
run: |
mkdir "utbot-release-${{ env.utbot_version }}"
wget "https://github.com/olezhabobrov/UTBotCpp/releases/download/v${{ env.utbot_version }}/utbot-release-${{ env.utbot_version }}.zip" -P "${{ github.workspace }}/utbot-release-${{ env.utbot_version }}"
wget "https://github.com/${{ env.repository_name }}/UTBotCpp/releases/download/v${{ env.utbot_version }}/utbot-release-${{ env.utbot_version }}.zip" -P "${{ github.workspace }}/utbot-release-${{ env.utbot_version }}"
unzip "${{ github.workspace }}/utbot-release-${{ env.utbot_version }}/utbot-release-${{ env.utbot_version }}.zip" -d "${{ github.workspace }}/utbot-release-${{ env.utbot_version }}/"
chmod +x "${{ github.workspace }}/utbot-release-${{ env.utbot_version }}/unpack_and_run_utbot.sh"
cd "${{ github.workspace }}/utbot-release-${{ env.utbot_version }}" && ./unpack_and_run_utbot.sh
- name: Testing project
run: |
cd "${{ github.workspace }}/utbot-release-${{ env.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 ${{ github.workspace }} project"
$RUN_SYSTEM_SCRIPT_PATH "cli" $UTBOT_CLI_OPTIONS
- name: Push into master with tests
if: github.event.inputs.test_push_info == 'true'
uses: EndBug/add-and-commit@v9
with:
add: 'tests codeAnalysis'
author_name: 'github-actions[utbot]'
message: 'UTBot code analysis add sarif and tests'
push: true
- name: Push into master without tests
if: github.event.inputs.test_push_info == 'false'
uses: EndBug/add-and-commit@v9
with:
add: 'codeAnalysis'
author_name: 'github-actions[utbot]'
message: 'UTBot code analysis add sarif'
push: true
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: codeAnalysis/project_code_analysis.sarif


- name: Create Pull Request with tests and codeAnalysis information
if: github.event.inputs.test_push_info == 'true'
uses: peter-evans/create-pull-request@v4
with:
add-paths: |
tests/
codeAnalysis/
commit-message: UTBot code analysis add tests and codeAnalysis information
branch-suffix: timestamp
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 codeAnalysis information
if: github.event.inputs.test_push_info == 'false'
uses: peter-evans/create-pull-request@v4
with:
add-paths: |
codeAnalysis/
commit-message: UTBot code analysis add codeAnalysis information
branch-suffix: timestamp
branch: utbote-code-analysis
title: UTBot code analysis
body: UTBot code analysis add codeAnalysis information
delete-branch: true

0 comments on commit 7557360

Please sign in to comment.