Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ci: add caches for the wheel tests #24

ci: add caches for the wheel tests

ci: add caches for the wheel tests #24

Workflow file for this run

# This workflow will install libdebug on various distros and check the result
name: Distro Build Check
on:
push:
branches: [ "main", "dev", "enable-wheel-distrib" ]
workflow_dispatch:
permissions:
contents: read
jobs:
build_on_distros:
name: Build on ${{ matrix.distro_image }} (Python ${{ matrix.python-version }}, ${{ matrix.build_scenario }})
runs-on: ubuntu-latest
needs: []
timeout-minutes: 30
strategy:
fail-fast: false # Allow all distro builds to complete
matrix:
distro_image:
- 'ubuntu:20.04'
- 'ubuntu:22.04'
- 'ubuntu:24.04'
- 'ubuntu:latest'
- 'debian:bookworm'
- 'debian:sid'
- 'fedora:41'
- 'fedora:42'
- 'archlinux:latest'
- 'opensuse/tumbleweed:latest'
- 'alpine:latest'
build_scenario: ['with_deps', 'without_deps']
container:
image: ${{ matrix.distro_image }}
options: --privileged --user root # Ensure root privileges for package installation in container
steps:
- name: Install tar if needed
if: contains(matrix.distro_image, 'opensuse')
run: |
zypper --non-interactive --gpg-auto-import-keys refresh
zypper --non-interactive install -y tar gzip
- name: Install bash on Alpine Linux
if: contains(matrix.distro_image, 'alpine')
shell: sh
run: |
echo "Alpine detected. Installing bash..."
apk add --no-cache --quiet bash
- name: Checkout code
uses: actions/checkout@v4
- name: Install OS-level build tools and Optional Native Libraries
shell: bash
env:
DEBIAN_FRONTEND: noninteractive # For non-interactive apt-get
run: |
echo "Installing OS dependencies for ${{ matrix.distro_image }} with scenario: ${{ matrix.build_scenario }}"
# Common build tools. Python headers are expected to come from setup-python's Python distribution.
if command -v apt-get &> /dev/null; then
apt-get update -qq
apt-get install -y -qq --no-install-recommends g++ make python3 python3-dev python3-pip python3-venv libc6-dbg
if [[ "${{ matrix.build_scenario }}" == "with_deps" ]]; then
echo "Installing libdwarf-dev libelf-dev libiberty-dev (Debian-based)"
apt-get install -y -qq --no-install-recommends libdwarf-dev libelf-dev libiberty-dev
fi
elif command -v dnf &> /dev/null; then
dnf install -y -q g++ make python3 python3-devel
if [[ "${{ matrix.build_scenario }}" == "with_deps" ]]; then
echo "Installing elfutils-devel libdwarf-devel binutils-devel (DNF-based)"
dnf install -y -q elfutils-devel libdwarf-devel binutils-devel # binutils-devel for libiberty
fi
elif command -v yum &> /dev/null; then # For older RHEL clones (e.g. CentOS 7) - AlmaLinux 9 uses dnf
yum install -y -q gcc-c++ make python3 python3-devel
if [[ "${{ matrix.build_scenario }}" == "with_deps" ]]; then
echo "Installing elfutils-devel libdwarf-devel binutils-devel (YUM-based)"
yum install -y -q elfutils-devel libdwarf-devel binutils-devel
fi
elif command -v pacman &> /dev/null; then
pacman -Sy --noconfirm --quiet # Sync package databases
pacman -S --noconfirm --quiet --needed base-devel python3 python-pip
if [[ "${{ matrix.build_scenario }}" == "with_deps" ]]; then
echo "Installing elfutils libdwarf binutils (Arch-based)"
pacman -S --noconfirm --quiet --needed elfutils libdwarf binutils # binutils for libiberty
fi
elif command -v zypper &> /dev/null; then
zypper --non-interactive --gpg-auto-import-keys refresh
zypper --non-interactive install -y gcc-c++ make python3 python3-devel python3-pip
if [[ "${{ matrix.build_scenario }}" == "with_deps" ]]; then
echo "Installing libelf-devel libdwarf-devel binutils-devel (SUSE-based)"
zypper --non-interactive install -y libelf-devel libdwarf-devel binutils-devel # binutils-devel for libiberty
fi
elif command -v apk &> /dev/null; then
apk add --no-cache --quiet build-base python3 python3-dev py3-pip linux-headers
if [[ "${{ matrix.build_scenario }}" == "with_deps" ]]; then
echo "Installing elfutils-dev libdwarf-dev binutils-dev (Alpine-based)"
apk add --no-cache --quiet elfutils-dev libdwarf-dev binutils-dev # binutils-dev for libiberty
fi
else
echo "Unsupported distribution for automatic dependency installation: ${{ matrix.distro_image }}"
exit 1
fi
- name: Add Deadsnakes Repository
env:
DEBIAN_FRONTEND: noninteractive # For non-interactive apt-get
shell: bash
if: contains(matrix.distro_image, '20.04')
run: |
apt-get install software-properties-common -y
add-apt-repository -y ppa:deadsnakes/ppa
apt-get update
apt-get install -y python3.10 python3.10-venv python3.10-dev
rm /bin/python3
ln -s /bin/python3.10 /bin/python3 # This breaks everything but we don't care
- name: Create a Virtual Environment
shell: bash
run: |
python3 -m venv venv
- name: Install Python build tools and test dependencies
shell: bash
run: |
source venv/bin/activate
python3 -m pip install --upgrade pip wheel build
python3 -m pip install pytest pwntools requests objgraph
if [[ "${{ matrix.distro_image }}" == "opensuse/tumbleweed:latest" ]]; then
zypper --non-interactive install -y python313-curses
fi
if [[ "${{ matrix.build_scenario }}" == "without_deps" ]]; then
python3 -m pip install cmake nanobind scikit-build-core
fi
- name: Set CMake Args for Build
shell: bash
run: |
if [[ "${{ matrix.build_scenario }}" == "without_deps" ]]; then
echo "Setting CMake args to disable optional libraries"
echo "CMAKE_ARGS=-DUSE_LIBDWARF=OFF -DUSE_LIBELF=OFF" >> $GITHUB_ENV
else
echo "Building with optional libraries enabled (default CMake options)"
# Ensure CMAKE_ARGS is empty or not set if not disabling, to allow CMake defaults
# Or set specific flags if your CMake expects them for "with_deps"
echo "CMAKE_ARGS=" >> $GITHUB_ENV
fi
- name: Install library
shell: bash
run: |
source venv/bin/activate
if [[ "${{ matrix.build_scenario }}" == "without_deps" ]]; then
echo "Building library with CMAKE_ARGS: $CMAKE_ARGS"
python3 -m pip install --no-build-isolation . -v
else
python3 -m pip install . -v
fi
- name: Test with pytest
if: matrix.build_scenario == 'with_deps' && matrix.distro_image != 'alpine:latest' && matrix.distro_image != 'ubuntu:20.04'
shell: bash
run: |
source venv/bin/activate
cd test && python3 -m pytest --ignore=other_tests --ignore scripts/atexit_handler_test.py
Morty Proxy This is a proxified and sanitized view of the page, visit original site.