Skip to content

Commit 4c5378b

Browse files
committed
test: get xapian working under github actions and python 3.13
issue2551338 xapian doesn't build in CI for 3.13 python Truncated workflow just for testing various xapian versions. [skip travis]
1 parent 70e5f21 commit 4c5378b

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

.github/workflows/build-xapian.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
2+
name: build-xapian
3+
4+
on:
5+
push:
6+
# skip if github.ref is 'refs/heads/maint-1.6'
7+
# aka github.ref_name of 'maint-1.6'
8+
# see https://github.com/orgs/community/discussions/26253
9+
# for mechanism to control matrix based on branch
10+
branches: [ "*", '!maint-1.6' ]
11+
workflow_dispatch:
12+
inputs:
13+
debug_enabled:
14+
type: boolean
15+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
16+
required: false
17+
default: false
18+
# GITHUB_TOKEN only has read repo context.
19+
permissions:
20+
contents: read
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
test:
28+
name: build xapian
29+
runs-on: ubuntu-22.04
30+
31+
env:
32+
# get colorized pytest output even without a controlling tty
33+
PYTEST_ADDOPTS: "--color=yes"
34+
# OS: ${{ matrix.os }}
35+
PYTHON_VERSION: ${{ matrix.python-version }}
36+
37+
steps:
38+
# Setup version of Python to use
39+
- name: Set Up Python 3.13
40+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
41+
with:
42+
python-version: 3.13
43+
allow-prereleases: true
44+
cache: 'pip'
45+
46+
- name: Install build tools - setuptools
47+
run: pip install setuptools
48+
49+
# Display the Python version being used
50+
- name: Display Python and key module versions
51+
run: |
52+
python -c "import sys; print('python version: ', sys.version)"
53+
python -c "import sqlite3; print('sqlite version: ', sqlite3.sqlite_version)"
54+
python -c "import setuptools; print('setuptools version: ', setuptools.__version__);"
55+
56+
- name: Update pip
57+
run: python -m pip install --upgrade pip
58+
59+
# https://github.com/mxschmitt/action-tmate
60+
# allow remote ssh into the CI container. I need this to debug
61+
# some xfail cases
62+
- name: Setup tmate session
63+
uses: mxschmitt/action-tmate@v3
64+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
65+
timeout-minutes: 10
66+
with:
67+
limit-access-to-actor: true
68+
69+
- name: Install xapian
70+
run: |
71+
set -xv
72+
sudo apt-get install libxapian-dev
73+
# Sphinx required to build the xapian python bindings. Use 1.8.5 on
74+
# older python and newest on newer.
75+
if [[ $PYTHON_VERSION == '3.'* ]] ; then pip install sphinx; fi
76+
XAPIAN_VER="1.4.24"; echo $XAPIAN_VER;
77+
cd /tmp
78+
curl -s -O https://oligarchy.co.uk/xapian/$XAPIAN_VER/xapian-bindings-$XAPIAN_VER.tar.xz
79+
tar -Jxvf xapian-bindings-$XAPIAN_VER.tar.xz
80+
cd xapian-bindings-$XAPIAN_VER/
81+
# edit the configure script.
82+
# distutils.sysconfig.get_config_vars('SO') doesn't work for
83+
# 3.11 or newer.
84+
# Change distutils.sysconfig... to just sysconfig and SO
85+
# to EXT_SUFFIX to get valid value.
86+
if [[ $PYTHON_VERSION == "X."* ]]; then
87+
cp configure configure.FCS;
88+
sed -i \
89+
-e '/PYTHON3_SO=/s/distutils\.//g' \
90+
-e '/PYTHON3_SO=/s/"SO"/"EXT_SUFFIX"/g' \
91+
-e '/PYTHON3_CACHE_TAG=/s/imp;print(imp.get_tag())/sys;print(sys.implementation.cache_tag)/' \
92+
-e '/PYTHON3_CACHE_OPT1_EXT=/s/imp\.get_tag()/sys.implementation.cache_tag/g' \
93+
-e '/PYTHON3_CACHE_OPT1_EXT=/s/imp\b/importlib/g' \
94+
configure;
95+
diff -u configure.FCS configure || true;
96+
fi
97+
./configure --prefix=$VIRTUAL_ENV --with-python3 --disable-documentation
98+
make && sudo make install
99+
python -c 'import xapian'

0 commit comments

Comments
 (0)