Skip to content

ci: tests update for pcs-0.12 and pacemaker-3 #313

ci: tests update for pcs-0.12 and pacemaker-3

ci: tests update for pcs-0.12 and pacemaker-3 #313

---
# 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:
include:
- os: ubuntu-22.04
pcs_version: v0.11.4
- os: ubuntu-22.04
pcs_version: v0.11.5
- os: ubuntu-22.04
pcs_version: v0.11.6
- os: ubuntu-22.04
pcs_version: v0.11.7
- os: ubuntu-22.04
pcs_version: v0.11.8
- os: ubuntu-24.04
pcs_version: main
# pcs_version 0.12.x will go to ubuntu 24.04 only
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/[email protected]"
# 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)
# remove pcs which is installed as a dependency of pacemaker (since
# ubuntu 23.10) and conflicts with pcs built from source
sudo dpkg --force-depends --purge pcs
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