Skip to content

Tests for multiple OS families #11

Tests for multiple OS families

Tests for multiple OS families #11

Workflow file for this run

name: Linux Distro Tests
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test-distros:
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/security"]
steps:
- uses: actions/checkout@v4
- name: Install Python and Poetry
run: |
if [ -f /etc/os-release ]; then
. /etc/os-release
export DEBIAN_FRONTEND=noninteractive # Set debconf to noninteractive mode
if [ "$ID" = "ubuntu" ]; then
apt-get update
apt-get install -y software-properties-common curl
# Install necessary Perl modules for debconf
apt-get install -y libterm-readline-gnu-perl libterm-readline-perl-perl
if [ "$VERSION_ID" = "24.04" ]; then
# Install Python 3.12 and its components directly from Ubuntu repositories
apt-get install -y python3.12 python3.12-venv
# Handle missing python3.12-distutils
curl -O https://bootstrap.pypa.io/pip/3.12/get-pip.py
python3.12 get-pip.py
else
# Add deadsnakes PPA for Python 3.12
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt-get install -y python3.12 python3.12-venv python3.12-distutils
fi
# Install pip for Python 3.12
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
# Update alternatives to use python3.12
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
update-alternatives --set python3 /usr/bin/python3.12
python3 -m pip install --upgrade pip
python3 -m pip install pipx
elif [ "$ID" = "alpine" ]; then
apk add --no-cache bash python3 py3-pip gcc g++ musl-dev libffi-dev
python3 -m pip install --upgrade pip
python3 -m pip install pipx
elif [ "$ID" = "arch" -o "$ID" = "archlinux" ]; then
pacman -Syu --noconfirm python python-pip python-pipx
elif [ "$ID" = "fedora" ]; then
dnf install -y python3 python3-pip pipx poetry
elif [ "$ID" = "gentoo" ]; then
# Initialize and sync Gentoo repository
emerge-webrsync
emerge --sync
emerge --update --newuse dev-lang/python dev-python/pipx poetry
elif [ "$ID" = "kali" -o "$ID" = "parrot" -o "$ID" = "debian" ]; then
apt-get update
apt-get install -y python3 python3-pip pipx
else
echo "Unsupported Linux distribution"
exit 1
fi
else
echo "Operating system not recognized"
exit 1
fi
python3 -m pipx ensurepath
pipx install poetry
- name: Install dependencies
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry install
- name: Run tests
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG .