Skip to content

Commit 2e6d986

Browse files
authored
Create dottest_autofix.yml
Added example of how CI/CD autofix solution can repair code in github pipeline
1 parent df29d6f commit 2e6d986

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# This workflow runs Parasoft dotTEST to analyze code
2+
# and display results with Github code scanning alerts.
3+
# Parasoft dotTEST is a testing tool that provides code analysis techniques
4+
# to improve code quality and ensure compliance with industry standards.
5+
# See https://github.com/parasoft/run-dottest-action for more information.
6+
7+
name: Parasoft dotTEST Code Analysis
8+
9+
on:
10+
# Allows you to run this workflow manually from the Actions tab.
11+
workflow_dispatch:
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel.
14+
jobs:
15+
# This workflow is made up of one job "run-dottest-action".
16+
run-dottest-action:
17+
# Specifies the name of the job.
18+
name: Run code analysis with dotTEST
19+
20+
# Specifies required permissions for upload-sarif action
21+
permissions:
22+
# required for all workflows
23+
security-events: write
24+
# only required for workflows in private repositories
25+
actions: read
26+
contents: read
27+
28+
# Specifies the type of runner that the job will run on.
29+
runs-on: self-hosted
30+
31+
# Steps represent a sequence of tasks that will be executed as part of the job.
32+
steps:
33+
34+
# Checks out your repository, so that your job can access it.
35+
- name: Check out code
36+
uses: actions/checkout@v4
37+
38+
# ---------------------------------------------------------------
39+
# Runs code analysis with dotTEST and generates a .sarif report.
40+
- name: Run Parasoft dotTEST
41+
id: dottest
42+
uses: parasoft/run-dottest-action@2.0.2
43+
with:
44+
# Path to the dotTEST installation directory, which contains dottestcli.exe. If not specified, dottestcli.exe will be searched for on PATH.
45+
#installDir: # optional
46+
# Path to the project to be analyzed when no solution is provided. Specify a semicolon-separated list of paths to analyze many projects. Supports ANT-style wildcards.
47+
testConfig: Recommended Rules
48+
#settings: # optional
49+
# A single configuration setting in the "key=value" format.
50+
#property: # optional
51+
# Solution configuration, e.g. "Debug".
52+
#solutionConfig: Debug
53+
# Target platform of the solution configuration (e.g."Any CPU") or project configuration (e.g. "AnyCPU").
54+
#targetPlatform: "Any CPU"
55+
# Path to the location where console output is saved.
56+
#out: ${{ github.workspace }}/.dottest/report/${{ github.run_number }}/output.txt
57+
58+
# ---------------------------------------------------------------
59+
# Uploads an archive that includes all report files (.xml, .html, .sarif).
60+
- name: Upload report artifacts
61+
uses: actions/upload-artifact@v3
62+
if: always()
63+
with:
64+
name: Report files
65+
path: ${{ steps.dottest.outputs.reportDir }}/*.*
66+
67+
# ---------------------------------------------------------------
68+
# Uploads analysis results in the SARIF format, so that they are displayed as GitHub code scanning alerts.
69+
- name: Upload results to GitHub
70+
uses: github/codeql-action/upload-sarif@v3
71+
if: always()
72+
with:
73+
sarif_file: ${{ steps.dottest.outputs.report }}
74+
75+
76+
# ---------------------------------------------------------------
77+
# Runs code autofix
78+
- name: Run code autofix
79+
if: always()
80+
shell: bash
81+
run: |
82+
python "${{ steps.dottest.outputs.installDir }}/integration/aider/DottestAutoFix.py" \
83+
--report "${{ steps.dottest.outputs.report }}" \
84+
--tool-home "${{ steps.dottest.outputs.installDir }}" \
85+
--solution "${{ steps.dottest.outputs.solution }}" \
86+
--fix-limit 3

0 commit comments

Comments
 (0)