mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
NOTE: This also requires upgrading to tox-lsr 3.10.0, and some hacks to workaround a podman issue in ubuntu. These tests run the role during a bootc container image build, deploy the container into a QEMU VM, boot that, and validate the expected configuration there. They run in two different tox environments, and thus have to be run in two steps (preparation in buildah, validation in QEMU). The preparation is expected to output a qcow2 image in `tests/tmp/TESTNAME/qcow2/disk.qcow2`, i.e. the output structure of <https://github.com/osbuild/bootc-image-builder>. There are two possibilities: * Have separate bootc end-to-end tests. These are tagged with `tests::bootc-e2` and are skipped in the normal qemu-* scenarios. They run as part of the container-* ones. * Modify an existing test: These need to build a qcow2 image exactly *once* (via calling `bootc-buildah-qcow.sh`) and skip setup/cleanup and role invocations in validation mode, i.e. when `__bootc_validation` is true. In the container scenario, run the QEMU validation as a separate step in the workflow. See https://issues.redhat.com/browse/RHEL-88396 Signed-off-by: Rich Megginson <rmeggins@redhat.com>
101 lines
2.9 KiB
YAML
101 lines
2.9 KiB
YAML
---
|
|
# 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:
|
|
pyver_os:
|
|
- ver: "2.7"
|
|
os: ubuntu-22.04
|
|
- ver: "3.9"
|
|
os: ubuntu-latest
|
|
- ver: "3.10"
|
|
os: ubuntu-latest
|
|
- ver: "3.11"
|
|
os: ubuntu-latest
|
|
- ver: "3.12"
|
|
os: ubuntu-latest
|
|
runs-on: ${{ matrix.pyver_os.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: Set up Python 2.7
|
|
if: ${{ matrix.pyver_os.ver == '2.7' }}
|
|
run: |
|
|
set -euxo pipefail
|
|
sudo apt install -y python2.7
|
|
|
|
- name: Set up Python 3
|
|
if: ${{ matrix.pyver_os.ver != '2.7' }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.pyver_os.ver }}
|
|
|
|
- name: Install platform dependencies, python, tox, tox-lsr
|
|
run: |
|
|
set -euxo pipefail
|
|
python -m pip install --upgrade pip
|
|
if [ "${{ matrix.pyver_os.ver }}" = 2.7 ]; then
|
|
# newer virtualenv cannot create python2 venvs
|
|
# newer tox requires newer virtualenv
|
|
tox='tox<4.15'
|
|
virtualenv='virtualenv<20.22.0'
|
|
else
|
|
tox=tox
|
|
virtualenv=virtualenv
|
|
fi
|
|
pip install "$tox" "$virtualenv" "git+https://github.com/linux-system-roles/tox-lsr@3.10.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: Run unit tests
|
|
run: |
|
|
set -euxo pipefail
|
|
toxpyver=$(echo "${{ matrix.pyver_os.ver }}" | tr -d .)
|
|
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@v5
|
|
|
|
python-26:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout PR
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run py26 tests
|
|
uses: linux-system-roles/lsr-gh-action-py26@1.0.2
|
|
env:
|
|
TOX_LSR: "git+https://github.com/linux-system-roles/tox-lsr@2.13.2"
|