tests: Re-enable become/sudo tests, fix them on macOS runners #247
Workflow file for this run
This file contains 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
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
name: Tests | |
on: | |
pull_request: | |
push: | |
branches-ignore: | |
- docs-master | |
env: | |
#ANSIBLE_VERBOSITY: 3 | |
#MITOGEN_LOG_LEVEL: DEBUG | |
MITOGEN_TEST_IMAGE_TEMPLATE: "ghcr.io/mitogen-hq/%(distro)s-test" | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners | |
# https://github.com/actions/runner-images/blob/main/README.md#software-and-image-support | |
jobs: | |
linux: | |
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Mito_313 | |
python_version: '3.13' | |
tox_env: py313-mode_mitogen | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
if: ${{ matrix.python_version }} | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install build deps | |
run: | | |
set -o errexit -o nounset -o pipefail | |
sudo apt-get update | |
sudo apt-get install -y python2-dev python3-pip virtualenv | |
- name: Show Python versions | |
run: | | |
set -o errexit -o nounset -o pipefail | |
# macOS builders lack a realpath command | |
type python && python -c"import os.path;print(os.path.realpath('$(type -p python)'))" && python --version | |
type python2 && python2 -c"import os.path;print(os.path.realpath('$(type -p python2)'))" && python2 --version | |
type python3 && python3 -c"import os.path;print(os.path.realpath('$(type -p python3)'))" && python3 --version | |
echo | |
if [ -e /usr/bin/python ]; then | |
echo "/usr/bin/python: sys.executable: $(/usr/bin/python -c 'import sys; print(sys.executable)')" | |
fi | |
if [ -e /usr/bin/python2 ]; then | |
echo "/usr/bin/python2: sys.executable: $(/usr/bin/python2 -c 'import sys; print(sys.executable)')" | |
fi | |
if [ -e /usr/bin/python2.7 ]; then | |
echo "/usr/bin/python2.7: sys.executable: $(/usr/bin/python2.7 -c 'import sys; print(sys.executable)')" | |
fi | |
- name: Install tooling | |
run: | | |
set -o errexit -o nounset -o pipefail | |
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12) | |
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "${{ matrix.tox_env }}"))') | |
if [[ -z $PYTHON ]]; then | |
echo 1>&2 "Python interpreter could not be determined" | |
exit 1 | |
fi | |
if [[ $PYTHON == "python2.7" && $(uname) == "Darwin" ]]; then | |
"$PYTHON" -m ensurepip --user --altinstall --no-default-pip | |
"$PYTHON" -m pip install --user -r "tests/requirements-tox.txt" | |
elif [[ $PYTHON == "python2.7" ]]; then | |
curl "https://bootstrap.pypa.io/pip/2.7/get-pip.py" --output "get-pip.py" | |
"$PYTHON" get-pip.py --user --no-python-version-warning | |
# Avoid Python 2.x pip masking system pip | |
rm -f ~/.local/bin/{easy_install,pip,wheel} | |
"$PYTHON" -m pip install --user -r "tests/requirements-tox.txt" | |
else | |
"$PYTHON" -m pip install -r "tests/requirements-tox.txt" | |
fi | |
- name: Run tests | |
env: | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -o errexit -o nounset -o pipefail | |
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12) | |
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "${{ matrix.tox_env }}"))') | |
if [[ -z $PYTHON ]]; then | |
echo 1>&2 "Python interpreter could not be determined" | |
exit 1 | |
fi | |
"$PYTHON" -m tox -e "${{ matrix.tox_env }}" | |
macos: | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md | |
runs-on: macos-12 | |
timeout-minutes: 120 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Loc_313_old | |
python_version: '3.13' | |
tox_env: py313-mode_localhost-old | |
- name: Loc_313_new | |
python_version: '3.13' | |
tox_env: py313-mode_localhost-new | |
- name: Loc_313_bisect | |
python_version: '3.13' | |
tox_env: py313-mode_localhost-bisect | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
if: ${{ matrix.python_version }} | |
- name: Show Python versions | |
run: | | |
set -o errexit -o nounset -o pipefail | |
# macOS builders lack a realpath command | |
type python && python -c"import os.path;print(os.path.realpath('$(type -p python)'))" && python --version | |
type python2 && python2 -c"import os.path;print(os.path.realpath('$(type -p python2)'))" && python2 --version | |
type python3 && python3 -c"import os.path;print(os.path.realpath('$(type -p python3)'))" && python3 --version | |
echo | |
if [ -e /usr/bin/python ]; then | |
echo "/usr/bin/python: sys.executable: $(/usr/bin/python -c 'import sys; print(sys.executable)')" | |
fi | |
if [ -e /usr/bin/python2 ]; then | |
echo "/usr/bin/python2: sys.executable: $(/usr/bin/python2 -c 'import sys; print(sys.executable)')" | |
fi | |
if [ -e /usr/bin/python2.7 ]; then | |
echo "/usr/bin/python2.7: sys.executable: $(/usr/bin/python2.7 -c 'import sys; print(sys.executable)')" | |
fi | |
if [ -e /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 ]; then | |
# GitHub macOS 12 images: python2.7 is installed, but not on $PATH | |
echo "/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7: sys.executable: $(/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 -c 'import sys; print(sys.executable)')" | |
fi | |
- name: Install tooling | |
run: | | |
set -o errexit -o nounset -o pipefail | |
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12) | |
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "${{ matrix.tox_env }}"))') | |
if [[ -z $PYTHON ]]; then | |
echo 1>&2 "Python interpreter could not be determined" | |
exit 1 | |
fi | |
if [[ $PYTHON == "python2.7" && $(uname) == "Darwin" ]]; then | |
# GitHub macOS 12 images: python2.7 is installed, but not on $PATH | |
PYTHON="/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7" | |
"$PYTHON" -m ensurepip --user --altinstall --no-default-pip | |
"$PYTHON" -m pip install --user -r "tests/requirements-tox.txt" | |
elif [[ $PYTHON == "python2.7" ]]; then | |
curl "https://bootstrap.pypa.io/pip/2.7/get-pip.py" --output "get-pip.py" | |
"$PYTHON" get-pip.py --user --no-python-version-warning | |
# Avoid Python 2.x pip masking system pip | |
rm -f ~/.local/bin/{easy_install,pip,wheel} | |
"$PYTHON" -m pip install --user -r "tests/requirements-tox.txt" | |
else | |
"$PYTHON" -m pip install -r "tests/requirements-tox.txt" | |
fi | |
- name: Run tests | |
env: | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -o errexit -o nounset -o pipefail | |
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12) | |
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "${{ matrix.tox_env }}"))') | |
if [[ -z $PYTHON ]]; then | |
echo 1>&2 "Python interpreter could not be determined" | |
exit 1 | |
fi | |
if [[ $PYTHON == "python2.7" && $(uname) == "Darwin" ]]; then | |
# GitHub macOS 12 images: python2.7 is installed, but not on $PATH | |
PYTHON="/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7" | |
fi | |
export old_rev=2f647e9617067802647d2a461906c1241c5cac00 | |
export new_rev=a1a6550daf305ec9815a7b12db42c68b63426878 | |
if [[ "${{ matrix.tox_env }}" == "py313-mode_localhost-bisect" ]]; then | |
cd .. | |
git clone https://github.com/ansible/ansible | |
cd ansible | |
git checkout $old_rev | |
cd ../mitogen | |
fi | |
"$PYTHON" -m tox -e "${{ matrix.tox_env }}" | |
if [[ "${{ matrix.tox_env }}" != "py313-mode_localhost-bisect" ]]; then | |
exit 0 | |
fi | |
cd ../ansible | |
cat << EOF > bisect.sh | |
#!/usr/bin/env bash | |
set -o errexit -o nounset -o pipefail | |
"$PYTHON" setup.py clean | |
rm -vrf dist | |
cd ../mitogen | |
export FOO_OVERRIDE=1 | |
"$PYTHON" -m tox -r -e "${{ matrix.tox_env }}" && rc=\$? || rc=\$? | |
if [[ \$rc -ne 0 ]]; then | |
exit 0 | |
else | |
exit \$rc | |
fi | |
EOF | |
chmod +x bisect.sh | |
git bisect start | |
git bisect good $old_rev | |
git bisect bad $new_rev | |
git bisect run ./bisect.sh | |
# https://github.com/marketplace/actions/alls-green | |
check: | |
if: always() | |
needs: | |
- linux | |
- macos | |
runs-on: ubuntu-latest | |
steps: | |
- uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
# alex@uv2204:~/src/ansible$ git show --summary 2f647e9617067802647d2a461906c1241c5cac00 | |
# commit 2f647e9617067802647d2a461906c1241c5cac00 | |
# Author: Felix Fontein <[email protected]> | |
# Date: Fri Mar 31 23:14:35 2023 +0200 | |
# Implement semantic markup support for Ansible documentation in validate-modules. (#80243) | |
# create mode 100644 changelogs/fragments/80243-validate-modules.yml | |
# create mode 100644 test/integration/targets/ansible-test-sanity-validate-modules/ansible_collections/ns/col/plugins/modules/semantic_markup.py | |
# alex@uv2204:~/src/ansible$ git bisect good a1a6550daf305ec9815a7b12db42c68b63426878 | |
# You need to start by "git bisect start" | |
# Do you want me to do it for you [Y/n]? ^C | |
# alex@uv2204:~/src/ansible$ git show --summary a1a6550daf305ec9815a7b12db42c68b63426878 | |
# commit a1a6550daf305ec9815a7b12db42c68b63426878 | |
# Author: Abhijeet Kasurde <[email protected]> | |
# Date: Mon Sep 18 07:50:50 2023 -0700 | |
# inventory_ini: Handle SyntaxWarning in ini parsing (#81707) | |
# * handle SyntaxWarning ini inventory parsing | |
# Fixes: #81328 | |
# Signed-off-by: Abhijeet Kasurde <[email protected]> | |
# create mode 100644 changelogs/fragments/inventory_ini.yml |