Skip to content

merge queue support #353

merge queue support

merge queue support #353

Workflow file for this run

---
name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened]
merge_group:
jobs:
ansible-lint:
name: Ansible-lint Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Install ansible-lint
# Install ansible-lint from same branch as GHA
run: >
pip install
"ansible-lint[lock] @
git+https://github.com/ansible/ansible-lint@v6"
- name: Install requirements for plugins
run: pip install junitparser junit_xml jmespath
- 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 --force-color --profile=shared"
# don't want to annotate through GHA
unset GITHUB_ACTIONS
$cmd | tee branch.output
git checkout main
$cmd > main.output
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: /' |
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: /' |
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}
exit 1
fi
sanity:
name: Sanity Check
strategy:
matrix:
ansible:
- stable-2.9 # used by DCI on RHEL8
- stable-2.16 # latest stable version
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ matrix.ansible }}/ansible_collections/redhatci/ocp
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Install ansible-base ${{ matrix.ansible }}
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
# Fail when new errors appear
- name: Run sanity test
run: |
set -x
git checkout -b branch
git fetch --unshallow origin main
# extract all the supported python versions from the error message, excluding 3.5
PY_VERS=$(ansible-test sanity --verbose --docker --python 1.0 --color --coverage --failure-ok 2>&1 |
grep -Po "invalid.*?\K'3.*\d'" |
tr -d ,\' |
sed -e 's/3.5 //g')
for version in $PY_VERS; do
ansible-test sanity --verbose --docker --python $version --color --coverage --failure-ok
done 2>&1 | tee -a branch.output
git checkout main
for version in $PY_VERS; do
ansible-test sanity --verbose --docker --python $version --color --coverage --failure-ok
done >> 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." |
sed -r 's/\x1B\[[0-9]{1,2}[mGK]//g' > "$key.errors"
done
set +ex
echo "## Improvements are listed below" | tee -a ${GITHUB_STEP_SUMMARY}
echo "\`\`\`diff" >> ${GITHUB_STEP_SUMMARY}
diff -u0 branch.errors main.errors | grep '^+[^+]' | sed -e 's/ERROR/FIXED/' | tee -a ${GITHUB_STEP_SUMMARY}
echo "\`\`\`" >> ${GITHUB_STEP_SUMMARY}
echo "## Regressions are listed below" | tee -a ${GITHUB_STEP_SUMMARY}
echo "\`\`\`diff" >> ${GITHUB_STEP_SUMMARY}
diff -u0 branch.errors main.errors | grep '^-[^-]' | tee -a ${GITHUB_STEP_SUMMARY}
echo "\`\`\`" >> ${GITHUB_STEP_SUMMARY}
if diff -u0 branch.errors main.errors | grep -q '^-[^-]'; then
echo "> Fix the regression errors listed above" | tee -a ${GITHUB_STEP_SUMMARY}
exit 1
fi
working-directory: ${{ matrix.ansible }}/ansible_collections/redhatci/ocp
check-all-dependencies-are-merged:
name: "Check all dependencies are merged"
runs-on: ubuntu-latest
steps:
- name: Check all dependent Pull Requests are merged
uses: depends-on/depends-on-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
check-unmerged-pr: true
...