Pull Request #3662
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Pull Request | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
merge_group: | |
jobs: | |
ansible-lint: | |
name: Ansible-lint Check | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependent PRs if needed | |
uses: depends-on/depends-on-action@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
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 -r meta/requirements.txt | |
- 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="hack/ansible-lint.sh -d" | |
# don't want to annotate through GHA | |
unset GITHUB_ACTIONS | |
echo "=== Incoming branch ===" | |
$cmd | tee branch.output | |
git checkout main | |
echo "=== Main branch ===" | |
$cmd | tee main.output | |
export GITHUB_ACTIONS=true | |
set +ex | |
# remove line numbers | |
sed -i -r 's/:[0-9]+:/::/' branch.output main.output | |
# export diff sans headers | |
diff -u0 branch.output main.output | tail -n +3 > diff.raw | |
# Get warnings out of the diff | |
grep -P '\x1B\[33m|\(warning\)(\x1B\[0m)?$' diff.raw > diff.warnings | |
grep -vP '\x1B\[33m|\(warning\)(\x1B\[0m)?$' diff.raw > 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} | |
echo "## Warnings from main branch:" | tee -a ${GITHUB_STEP_SUMMARY} | |
echo '```diff' >> ${GITHUB_STEP_SUMMARY} | |
grep '^-' diff.warnings | | |
sed -e 's/^-/-WARNING: /' | | |
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.18 # 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: Install dependent PRs if needed | |
uses: depends-on/depends-on-action@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: ${{ matrix.ansible }}/ansible_collections/redhatci/ocp | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
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 ansible-test sanity/units/integration | |
run: | | |
set -x | |
# Prefer using podman over docker | |
sudo apt-get update | |
apt-get download podman-docker | |
sudo dpkg --force-all -i podman-docker*.deb 2>/dev/null | |
./hack/run_ansible_test.sh | |
working-directory: ${{ matrix.ansible }}/ansible_collections/redhatci/ocp | |
check-all-dependencies-are-merged: | |
name: "Check all dependencies are merged" | |
runs-on: ubuntu-24.04 | |
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 | |
check-docs: | |
name: Check version, documentation and README | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependent PRs if needed | |
uses: depends-on/depends-on-action@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check roles are documented in main README | |
run: | | |
./hack/check_doc.sh | |
- name: Check versions are consistent | |
run: | | |
echo "# Inconsistent versions" > "${GITHUB_STEP_SUMMARY}" | |
./hack/check_version.sh | |
... |