From 5ed4a55f9cf831d5cb02da02b420417e3f97f2dd Mon Sep 17 00:00:00 2001 From: g0t mi1k Date: Fri, 7 Feb 2025 11:08:04 +0000 Subject: [PATCH] Workflow: Python - Test Debian-testing This is to match whats in ./Dockerfiles_* There is a lot of duplicate lines/code ("Don't repeat yourself" DRY). This is because that GitHub actions doesn't support YAML Anchors. When they do, re-work this section! https://github.com/actions/runner/issues/1182 --- .github/workflows/python-package.yml | 182 ++++++++++++++++++--------- 1 file changed, 124 insertions(+), 58 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 81e0c541..86b4ded7 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,16 +1,75 @@ --- name: Python package - Check, build and test -env: - # Enable forward compatibility with newer versions of Python - PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1" - "on": push: pull_request: schedule: - cron: '0 6 * * *' # Daily 6AM UTC build +env: + # Enable forward compatibility with newer versions of Python + PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1" + + # Matches default: ./Dockerfile_* + # Dirty hack for the lack of YAML anchors + CORE_DEB: | + ca-certificates + cargo + gcc + git + libclang-dev + libgpgme-dev + libpython3-dev + libssl-dev + libtdb-dev + make + mypy-protobuf + pkg-config + protobuf-compiler + python3-gpg + python3-pip + python3-setuptools + python3-setuptools-rust + python3-wheel + python3-wheel-whl + rustc + swig + # Matches extra packages: ./Dockerfile_* + # Dirty hack for the lack of YAML anchors + EXTRA_DEB: | + apt-file + autoconf + autopkgtest + debootstrap + devscripts + diffoscope + dpkg + dpkg-dev + g++ + git-buildpackage + gnome-pkg-tools + gnupg + libapt-pkg-dev + libjs-chart.js + libjs-jquery + libjs-jquery-datatables + libjs-jquery-typeahead + libjs-moment + libjs-sphinxdoc + lintian + mypy-protobuf + openssh-client + perl-doc + pristine-tar + python3 + python3-breezy + python3-setuptools-protobuf + quilt + sbuild + ssh + subversion + jobs: checks: name: Checks @@ -97,62 +156,10 @@ jobs: run: | set -x sudo apt-get update --yes - # Matches default: ./Dockerfile_* sudo apt-get satisfy --yes --no-install-recommends \ - ca-certificates - cargo - gcc - git - libclang-dev - libgpgme-dev - libpython3-dev - libssl-dev - libtdb-dev - make - mypy-protobuf - pkg-config - protobuf-compiler - python3-gpg - python3-pip - python3-setuptools - python3-setuptools-rust - python3-wheel - python3-wheel-whl - rustc - swig - # Matches extra packages: ./Dockerfile_* + ${CORE_DEB} sudo apt-get satisfy --yes --no-install-recommends \ - apt-file - autoconf - autopkgtest - debootstrap - devscripts - diffoscope - dpkg - dpkg-dev - g++ - git-buildpackage - gnome-pkg-tools - gnupg - libapt-pkg-dev - libjs-chart.js - libjs-jquery - libjs-jquery-datatables - libjs-jquery-typeahead - libjs-moment - libjs-sphinxdoc - lintian - mypy-protobuf - openssh-client - perl-doc - pristine-tar - python3 - python3-breezy - python3-setuptools-protobuf - quilt - sbuild - ssh - subversion + ${EXTRA_DEB} - name: Install dependencies (rust) run: | @@ -214,3 +221,62 @@ jobs: make test env: PYTHONHASHSEED: random + + build-container: + name: Build & Test - Debian Testing + runs-on: ubuntu-latest + container: + # This is to match: ./Dockerfile_* + # https://hub.docker.com/_/debian + image: docker.io/debian:testing-slim + + # There is a lot here that is duplicated (build-container & build) + # Can be made 'better' when GitLab actions support YAML anchors + # https://github.com/actions/runner/issues/1182 + # Using system environments as a temp/dirty hack + # Steps to perform in job + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # Due to PyPi's gpg v1.10.0 needing libgpgme-dev < 1.18.0-3 + - name: Install PyPi GPG backward compatibility hacks + run: | + set -x + mkdir -pv "$HOME/.local/bin" + cp -vr ./scripts/* "$HOME/.local/bin/" + echo "$HOME/.local/bin" | tee -a $GITHUB_PATH + + - name: Install dependencies (apt) + run: | + set -x + apt-get update --yes + apt-get satisfy --yes --no-install-recommends \ + ${CORE_DEB} + apt-get satisfy --yes --no-install-recommends \ + ${EXTRA_DEB} + + - name: Install dependencies (rust) + run: | + set -x + git clone https://github.com/jelmer/ognibuild.git /build/ognibuild/ + cd /build/ognibuild/ + cargo build --verbose + + - name: PIP install & setup + run: | + set -x + pip3 install --break-system-packages --upgrade --editable \ + .[dev,debian] + python3 setup.py develop + python3 setup.py build_ext -i + + - name: Make + run: | + set -x + make + + - name: Make all + run: | + set -x + make all