Skip to content

Commit 06b67c7

Browse files
authored
Print summary of findings, update expected counts (#21)
* Print summary of findings, update expected counts * Fix filename
1 parent f910d96 commit 06b67c7

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

.github/workflows/self-test-and-release.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
name: Self Test on ${{ matrix.os }}
16+
name: Self Test Python on ${{ matrix.os }}
1717
steps:
1818
- uses: actions/checkout@v2
1919
- name: Set up JDK 1.8
@@ -45,13 +45,21 @@ jobs:
4545
run: |
4646
./build/install/aws-codeguru-cli/bin/aws-codeguru-cli --region us-west-2 -r python-code --no-prompt -c "c5f9c93d5605bfe3a4de02896a26b7b91eb7c007:a574f23f6ea3fe607a6d33cc6c8fe28d81ab37a2"
4747
48+
- name: Print Summary of Findings Linux
49+
if: steps.iam-role.outcome == 'success'
50+
run: |
51+
echo "detector,filePath,lineNumber" > summary-of-results.csv
52+
jq -r '.runs[0].results[] | {ruleId: .ruleId, firstFile: .locations[0].physicalLocation.artifactLocation.uri, firstLine: .locations[0].physicalLocation.region.startLine} | join(",")' \
53+
code-guru/recommendations.sarif.json | sort >> summary-of-results.csv
54+
cat summary-of-results.csv
55+
4856
- name: Validate Findings Linux
4957
if: steps.iam-role.outcome == 'success'
5058
shell: bash
5159
env:
52-
EXPECTED: 95
60+
EXPECTED: 112
5361
run: |
54-
[[ $(grep "filePath" code-guru/recommendations.json | wc -l) -eq $EXPECTED ]] || { echo "Expected $EXPECTED recommendations. but got $(grep "filePath" code-guru/recommendations.json | wc -l)."; exit 1; }
62+
[[ $(jq -r '.runs[0].results[].ruleId' code-guru/recommendations.sarif.json | wc -l) -eq $EXPECTED ]] || { echo "Expected $EXPECTED recommendations but got $(jq -r '.runs[0].results[].ruleId' code-guru/recommendations.sarif.json | wc -l)"; exit 1; }
5563
5664
- name: Create file status_${{ matrix.os }}.txt and write the job status into it
5765
if: always()
@@ -69,7 +77,7 @@ jobs:
6977
strategy:
7078
matrix:
7179
os: [ubuntu-latest, windows-latest]
72-
name: Self Test on ${{ matrix.os }}
80+
name: Self Test Java on ${{ matrix.os }}
7381
steps:
7482
- uses: actions/checkout@v2
7583
- name: Set up JDK 1.8
@@ -107,13 +115,21 @@ jobs:
107115
run: |
108116
./build/install/aws-codeguru-cli/bin/aws-codeguru-cli --region us-west-2 -r amazon-codeguru-samples -s amazon-codeguru-samples/src/main/java -b amazon-codeguru-samples/build/libs --no-prompt
109117
118+
- name: Print Summary of Findings Linux
119+
if: steps.iam-role.outcome == 'success'
120+
run: |
121+
echo "detector,filePath,lineNumber" > summary-of-results.csv
122+
jq -r '.runs[0].results[] | {ruleId: .ruleId, firstFile: .locations[0].physicalLocation.artifactLocation.uri, firstLine: .locations[0].physicalLocation.region.startLine} | join(",")' \
123+
code-guru/recommendations.sarif.json | sort >> summary-of-results.csv
124+
cat summary-of-results.csv
125+
110126
- name: Validate Findings Linux
111127
if: steps.iam-role.outcome == 'success'
112128
shell: bash
113129
env:
114-
EXPECTED: 12
115-
run: |
116-
[[ $(grep "filePath" code-guru/recommendations.json | wc -l) -eq $EXPECTED ]] || { echo "Expected $EXPECTED recommendations but got $(grep "filePath" code-guru/recommendations.json | wc -l)."; exit 1; }
130+
EXPECTED: 15
131+
run: |
132+
[[ $(jq -r '.runs[0].results[].ruleId' code-guru/recommendations.sarif.json | wc -l) -eq $EXPECTED ]] || { echo "Expected $EXPECTED recommendations but got $(jq -r '.runs[0].results[].ruleId' code-guru/recommendations.sarif.json | wc -l)"; exit 1; }
117133
118134
- name: Create file status_${{ matrix.os }}.txt and write the job status into it
119135
if: always()
@@ -172,4 +188,4 @@ jobs:
172188
Version ${{ steps.version.outputs.TAG_NAME }} of the AWS CodeGuru Reviewer CLI.
173189
files: |
174190
./build/distributions/aws-codeguru-cli.zip
175-
LICENSE
191+
LICENSE

0 commit comments

Comments
 (0)