Tests for multiple OS families #14
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
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 | |
apt-get install -y python3.11 python3.11-venv | |
else | |
add-apt-repository ppa:deadsnakes/ppa | |
apt-get update | |
apt-get install -y python3.11 python3.11-venv python3.11-distutils | |
fi | |
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 | |
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 | |
update-alternatives --set python3 /usr/bin/python3.11 | |
python3 -m pip install pipx --break-system-packages | |
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 . |