Skip to content

Commit

Permalink
Workflow: Python - Test Debian-testing
Browse files Browse the repository at this point in the history
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!
actions/runner#1182
  • Loading branch information
g0tmi1k committed Feb 17, 2025
1 parent 3d4900f commit a2e1ed6
Showing 1 changed file with 138 additions and 66 deletions.
204 changes: 138 additions & 66 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -63,7 +122,7 @@ jobs:
codespell
build:
name: Ubuntu-latest (Python ${{ matrix.python-version }})
name: Build - Ubuntu LTS (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -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: |
Expand All @@ -179,19 +186,78 @@ jobs:
set -x
make all
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
- name: Python static typing checks (mypy)
if: always()
run: |
set -x
sudo apt-get satisfy --yes --no-install-recommends \
apt-get satisfy --yes --no-install-recommends \
python3-breezy.tests
make typing
- name: Test config (janitor.debian.net)
if: always()
run: |
set -x
sudo apt-get satisfy --yes --no-install-recommends \
apt-get satisfy --yes --no-install-recommends \
git
git clone https://salsa.debian.org/janitor-team/janitor.debian.net \
janitor.debian.net
Expand All @@ -202,12 +268,18 @@ jobs:
if: always()
run: |
set -x
sudo apt-get satisfy --yes --no-install-recommends \
postgresql
pip3 install --break-system-packages --upgrade \
PSQL_DEB=$( apt-cache search 'postgresql-.*-debversion' \
| awk '{print $1}' \
| tail -n 1 )
apt-get satisfy --yes --no-install-recommends \
dpkg-dev \
postgresql \
${PSQL_DEB} \
libjs-jquery-datatables
pip3 install --break-system-packages --upgrade --editable \
.[test]
if [ $(id -u) == 0 ]; then
echo "Switching to postgres user"
if test "$(id -u)" = "0"; then
echo "-- Switching to postgres user"
su postgres;
fi
make test
Expand Down

0 comments on commit a2e1ed6

Please sign in to comment.