Skip to content

Commit a6dfecd

Browse files
committed
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! actions/runner#1182
1 parent cee81c9 commit a6dfecd

File tree

1 file changed

+136
-64
lines changed

1 file changed

+136
-64
lines changed

.github/workflows/python-package.yml

+136-64
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,75 @@
11
---
22
name: Python package - Check, build and test
33

4-
env:
5-
# Enable forward compatibility with newer versions of Python
6-
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
7-
84
"on":
95
push:
106
pull_request:
117
schedule:
128
- cron: '0 6 * * *' # Daily 6AM UTC build
139

10+
env:
11+
# Enable forward compatibility with newer versions of Python
12+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
13+
14+
# Matches default: ./Dockerfile_*
15+
# Dirty hack for the lack of YAML anchors
16+
CORE_DEB: |
17+
ca-certificates
18+
cargo
19+
gcc
20+
git
21+
libclang-dev
22+
libgpgme-dev
23+
libpython3-dev
24+
libssl-dev
25+
libtdb-dev
26+
make
27+
mypy-protobuf
28+
pkg-config
29+
protobuf-compiler
30+
python3-gpg
31+
python3-pip
32+
python3-setuptools
33+
python3-setuptools-rust
34+
python3-wheel
35+
python3-wheel-whl
36+
rustc
37+
swig
38+
# Matches extra packages: ./Dockerfile_*
39+
# Dirty hack for the lack of YAML anchors
40+
EXTRA_DEB: |
41+
apt-file
42+
autoconf
43+
autopkgtest
44+
debootstrap
45+
devscripts
46+
diffoscope
47+
dpkg
48+
dpkg-dev
49+
g++
50+
git-buildpackage
51+
gnome-pkg-tools
52+
gnupg
53+
libapt-pkg-dev
54+
libjs-chart.js
55+
libjs-jquery
56+
libjs-jquery-datatables
57+
libjs-jquery-typeahead
58+
libjs-moment
59+
libjs-sphinxdoc
60+
lintian
61+
mypy-protobuf
62+
openssh-client
63+
perl-doc
64+
pristine-tar
65+
python3
66+
python3-breezy
67+
python3-setuptools-protobuf
68+
quilt
69+
sbuild
70+
ssh
71+
subversion
72+
1473
jobs:
1574
checks:
1675
name: Checks
@@ -63,7 +122,7 @@ jobs:
63122
codespell
64123
65124
build:
66-
name: Ubuntu-latest (Python ${{ matrix.python-version }})
125+
name: Build - Ubuntu LTS (Python ${{ matrix.python-version }})
67126
runs-on: ubuntu-latest
68127
strategy:
69128
matrix:
@@ -97,62 +156,10 @@ jobs:
97156
run: |
98157
set -x
99158
sudo apt-get update --yes
100-
# Matches default: ./Dockerfile_*
101159
sudo apt-get satisfy --yes --no-install-recommends \
102-
ca-certificates
103-
cargo
104-
gcc
105-
git
106-
libclang-dev
107-
libgpgme-dev
108-
libpython3-dev
109-
libssl-dev
110-
libtdb-dev
111-
make
112-
mypy-protobuf
113-
pkg-config
114-
protobuf-compiler
115-
python3-gpg
116-
python3-pip
117-
python3-setuptools
118-
python3-setuptools-rust
119-
python3-wheel
120-
python3-wheel-whl
121-
rustc
122-
swig
123-
# Matches extra packages: ./Dockerfile_*
160+
${CORE_DEB}
124161
sudo apt-get satisfy --yes --no-install-recommends \
125-
apt-file
126-
autoconf
127-
autopkgtest
128-
debootstrap
129-
devscripts
130-
diffoscope
131-
dpkg
132-
dpkg-dev
133-
g++
134-
git-buildpackage
135-
gnome-pkg-tools
136-
gnupg
137-
libapt-pkg-dev
138-
libjs-chart.js
139-
libjs-jquery
140-
libjs-jquery-datatables
141-
libjs-jquery-typeahead
142-
libjs-moment
143-
libjs-sphinxdoc
144-
lintian
145-
mypy-protobuf
146-
openssh-client
147-
perl-doc
148-
pristine-tar
149-
python3
150-
python3-breezy
151-
python3-setuptools-protobuf
152-
quilt
153-
sbuild
154-
ssh
155-
subversion
162+
${EXTRA_DEB}
156163
157164
- name: Install dependencies (rust)
158165
run: |
@@ -179,19 +186,78 @@ jobs:
179186
set -x
180187
make all
181188
189+
build-container:
190+
name: Build & Test - Debian Testing
191+
runs-on: ubuntu-latest
192+
container:
193+
# This is to match: ./Dockerfile_*
194+
# https://hub.docker.com/_/debian
195+
image: docker.io/debian:testing-slim
196+
197+
# There is a lot here that is duplicated (build-container & build)
198+
# Can be made 'better' when GitLab actions support YAML anchors
199+
# https://github.com/actions/runner/issues/1182
200+
# Using system environments as a temp/dirty hack
201+
# Steps to perform in job
202+
steps:
203+
- name: Checkout code
204+
uses: actions/checkout@v4
205+
206+
# Due to PyPi's gpg v1.10.0 needing libgpgme-dev < 1.18.0-3
207+
- name: Install PyPi GPG backward compatibility hacks
208+
run: |
209+
set -x
210+
mkdir -pv "$HOME/.local/bin"
211+
cp -vr ./scripts/* "$HOME/.local/bin/"
212+
echo "$HOME/.local/bin" | tee -a $GITHUB_PATH
213+
214+
- name: Install dependencies (apt)
215+
run: |
216+
set -x
217+
apt-get update --yes
218+
apt-get satisfy --yes --no-install-recommends \
219+
${CORE_DEB}
220+
apt-get satisfy --yes --no-install-recommends \
221+
${EXTRA_DEB}
222+
223+
- name: Install dependencies (rust)
224+
run: |
225+
set -x
226+
git clone https://github.com/jelmer/ognibuild.git /build/ognibuild/
227+
cd /build/ognibuild/
228+
cargo build --verbose
229+
230+
- name: PIP install & setup
231+
run: |
232+
set -x
233+
pip3 install --break-system-packages --upgrade --editable \
234+
.[dev,debian]
235+
python3 setup.py develop
236+
python3 setup.py build_ext -i
237+
238+
- name: Make
239+
run: |
240+
set -x
241+
make
242+
243+
- name: Make all
244+
run: |
245+
set -x
246+
make all
247+
182248
- name: Python static typing checks (mypy)
183249
if: always()
184250
run: |
185251
set -x
186-
sudo apt-get satisfy --yes --no-install-recommends \
252+
apt-get satisfy --yes --no-install-recommends \
187253
python3-breezy.tests
188254
make typing
189255
190256
- name: Test config (janitor.debian.net)
191257
if: always()
192258
run: |
193259
set -x
194-
sudo apt-get satisfy --yes --no-install-recommends \
260+
apt-get satisfy --yes --no-install-recommends \
195261
git
196262
git clone https://salsa.debian.org/janitor-team/janitor.debian.net \
197263
janitor.debian.net
@@ -202,9 +268,15 @@ jobs:
202268
if: always()
203269
run: |
204270
set -x
205-
sudo apt-get satisfy --yes --no-install-recommends \
206-
postgresql
207-
pip3 install --break-system-packages --upgrade \
271+
PSQL_DEB=$( apt-cache search 'postgresql-.*-debversion' \
272+
| awk '{print $1}' \
273+
| tail -n 1 )
274+
apt-get satisfy --yes --no-install-recommends \
275+
dpkg-dev \
276+
postgresql \
277+
${PSQL_DEB} \
278+
libjs-jquery-datatables
279+
pip3 install --break-system-packages --upgrade --editable \
208280
.[test]
209281
if test "$(id -u)" = "0"; then
210282
echo "-- Switching to postgres user"

0 commit comments

Comments
 (0)