Skip to content

ci: ansible-test action now requires ansible-core version #293

ci: ansible-test action now requires ansible-core version

ci: ansible-test action now requires ansible-core version #293

---
# yamllint disable rule:line-length
name: Python Unit Tests
on: # yamllint disable-line rule:truthy
pull_request:
merge_group:
branches:
- main
types:
- checks_requested
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
python:
strategy:
matrix:
os:
- ubuntu-22.04
- ubuntu-latest
pcs_version:
- v0.11.4
- v0.11.5
- v0.11.6
- main
runs-on: ${{ matrix.os }}
steps:
- name: Update git
run: |
set -euxo pipefail
sudo apt update
sudo apt install -y git
- name: checkout PR
uses: actions/checkout@v4
- name: Install platform dependencies, python, tox, tox-lsr
run: |
set -euxo pipefail
python -m pip install --upgrade pip
pip install "git+https://github.com/linux-system-roles/tox-lsr@3.4.0"
# If you have additional OS dependency packages e.g. libcairo2-dev
# then put them in .github/config/ubuntu-requirements.txt, one
# package per line.
if [ -f .github/config/ubuntu-requirements.txt ]; then
sudo apt-get install -y $(cat .github/config/ubuntu-requirements.txt)
fi
- name: Clone pcs
uses: actions/checkout@v4
with:
repository: ClusterLabs/pcs
ref: ${{ matrix.pcs_version }}
path: pcs-upstream
- name: Build and install pcs
run: |
set -euxo pipefail
pcs_dir="${RUNNER_TEMP}/pcs"
mkdir -p pcs_dir
cd pcs-upstream
if [ "x${{ matrix.pcs_version }}" == "xmain" ]; then
echo "0.0.1+ci" > .tarball-version
fi
./autogen.sh && ./configure --prefix "$pcs_dir" && make && make install
cd ..
rm -rf pcs-upstream
site_pkgs_dir=`python -m site --user-site`
pyver=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
echo "${pcs_dir}/lib/python${pyver}/site-packages/" > "${site_pkgs_dir}/pcs.pth"
python -c 'from pcs import settings; print(settings.pcs_version)'
- name: Run unit tests
run: |
set -euxo pipefail
toxpyver=$(python -c 'import sys; print(f"{sys.version_info.major}{sys.version_info.minor}")')
toxenvs="py${toxpyver}"
# NOTE: The use of flake8, pylint, black with specific
# python envs is arbitrary and must be changed in tox-lsr
case "$toxpyver" in
310) toxenvs="${toxenvs},coveralls,flake8,pylint,black" ;;
*) toxenvs="${toxenvs},coveralls" ;;
esac
TOXENV="$toxenvs" lsr_ci_runtox
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4