Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: output fixes #102

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, synchronize, reopened]
jobs:
ansible-lint:
name: Compute ansible-lint score
name: Ansible-lint Check
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -29,28 +29,35 @@ jobs:
- name: Compare current branch vs main branch
# Run ansible-lint on this branch then compare vs main branch
run: |
set +e
set -x
# fix randomness
export PYTHONHASHSEED=42
git checkout -b branch
git fetch --unshallow origin main
cmd="ansible-lint --parseable --nocolor --profile=shared"
cmd="ansible-lint --parseable --force-color --profile=shared"
fredericlepied marked this conversation as resolved.
Show resolved Hide resolved
# don't want to annotate through GHA
unset GITHUB_ACTIONS
$cmd > branch.output || echo "Branch linting output written"
$cmd | tee branch.output
git checkout main
$cmd > main.output || echo "Main linting output written"
$cmd > main.output
fredericlepied marked this conversation as resolved.
Show resolved Hide resolved
export GITHUB_ACTIONS=true
set +ex
# export diff sans headers
diff -u0 branch.output main.output | tail -n +3 > diff.output
echo "## Improvements over main branch:" | tee -a ${GITHUB_STEP_SUMMARY}
echo '```diff' >> ${GITHUB_STEP_SUMMARY}
grep '^+' diff.output | sed -e 's/^+/+FIXED: /' | tee -a ${GITHUB_STEP_SUMMARY}
grep '^+' diff.output |
sed -e 's/^+/+FIXED: /' |
sed -r 's/\x1B\[[0-9]{1,2}(;[0-9]{1,2})?[mGK]//g' |
tee -a ${GITHUB_STEP_SUMMARY}
echo '```' >> ${GITHUB_STEP_SUMMARY}
echo "## Regressions from main branch:" | tee -a ${GITHUB_STEP_SUMMARY}
echo '```diff' >> ${GITHUB_STEP_SUMMARY}
grep '^-' diff.output | sed -e 's/^-/-ERROR: /' | tee -a ${GITHUB_STEP_SUMMARY}
grep '^-' diff.output |
sed -e 's/^-/-ERROR: /' |
sed -r 's/\x1B\[[0-9]{1,2}(;[0-9]{1,2})?[mGK]//g' |
tee -a ${GITHUB_STEP_SUMMARY}
echo '```' >> ${GITHUB_STEP_SUMMARY}
if grep -q '^-' diff.output; then
echo "> Fix regressions listed above" | tee -a ${GITHUB_STEP_SUMMARY}
Expand Down Expand Up @@ -122,8 +129,6 @@ jobs:
name: "Check all dependencies are merged"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Check all dependent Pull Requests are merged
uses: depends-on/depends-on-action@main
Expand Down