Skip to content

Commit

Permalink
fail when new errors appear
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlepied committed Nov 23, 2023
1 parent 4b49276 commit cc961b9
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions .github/workflows/sanity-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,24 @@ jobs:
- name: Install ansible-base ${{ matrix.ansible }}
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

# Always succeeding sanity test until all errors are fixed
# Fail when new errors appear
- name: Run sanity test
run: |
sanity=$(\
ansible-test \
sanity \
--verbose \
--docker \
--color \
--coverage \
--failure-ok \
2>&1 \
)
echo "${sanity}"
echo errors=$(grep -c "ERROR: [rp]" <<< "${sanity}") >> $GITHUB_OUTPUT
set -e
git fetch origin main
git config user.name 'Fake' && git config user.email 'fake@localhost'
git merge origin/main --no-edit
ansible-test sanity --verbose --docker --coverage --failure-ok 2>&1 | tee branch.output
git checkout main
ansible-test sanity --verbose --docker --coverage --failure-ok > main.output 2>&1
for key in branch main; do
grep -E "^(ERROR|FATAL):" "$key.output" | \
grep -v "issue(s) which need to be resolved\|See error output above for details." > "$key.errors"
done
echo "============================================================"
if diff -u main.errors branch.errors|grep '^+'; then
echo "Fix the regressions listed above (starting with a '+')"
exit 1
fi
working-directory: ${{ matrix.ansible }}/ansible_collections/redhatci/ocp
id: sanity_test

- name: Error summary
run: |
echo "## Error summary" >> ${GITHUB_STEP_SUMMARY}
echo "" >> ${GITHUB_STEP_SUMMARY}
echo "Total Errors: ${{ steps.sanity_test.outputs.errors }}" >> ${GITHUB_STEP_SUMMARY}
echo "" >> ${GITHUB_STEP_SUMMARY}

0 comments on commit cc961b9

Please sign in to comment.