Skip to content

Commit 2bc43bc

Browse files
authored
Use lower bound for expected findings in self-test-and-release.yml (#32)
This check breaks frequently when new rules get added or old rules get refined because the exact number of recommendations in these packages changes. Instead, use a lower bound. This still tests if the CLI returned a non-trivial number of recommendations, but it becomes less flaky when rules change.
1 parent 8957ced commit 2bc43bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ jobs:
6464
if: steps.iam-role.outcome == 'success'
6565
shell: bash
6666
env:
67-
EXPECTED: 103
67+
EXPECTED_MIN: 80
6868
run: |
69-
[[ $(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; }
69+
[[ $(jq -r '.runs[0].results[].ruleId' code-guru/recommendations.sarif.json | wc -l) -gt $EXPECTED_MIN ]] || { echo "Expected at least $EXPECTED_MIN recommendations but got $(jq -r '.runs[0].results[].ruleId' code-guru/recommendations.sarif.json | wc -l)"; exit 1; }
7070
7171
- name: Create file status_${{ matrix.os }}.txt and write the job status into it
7272
if: always()
@@ -141,9 +141,9 @@ jobs:
141141
if: steps.iam-role.outcome == 'success'
142142
shell: bash
143143
env:
144-
EXPECTED: 16
144+
EXPECTED_MIN: 10
145145
run: |
146-
[[ $(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; }
146+
[[ $(jq -r '.runs[0].results[].ruleId' code-guru/recommendations.sarif.json | wc -l) -gt $EXPECTED_MIN ]] || { echo "Expected at least $EXPECTED_MIN recommendations but got $(jq -r '.runs[0].results[].ruleId' code-guru/recommendations.sarif.json | wc -l)"; exit 1; }
147147
148148
- name: Create file status_${{ matrix.os }}.txt and write the job status into it
149149
if: always()

0 commit comments

Comments
 (0)