Skip to content

Python package

Python package #382

Workflow file for this run

name: Python package
on:
push:
pull_request:
schedule:
- cron: '0 */12 * * *'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- name: Download xapian sources
run: |
sudo mkdir -p -m 777 /usr/local/src/xapian
sudo mkdir -p -m 777 /usr/local/src/xapian-bindings
VERSION=1.4.26
wget https://oligarchy.co.uk/xapian/$VERSION/xapian-core-$VERSION.tar.xz
wget https://oligarchy.co.uk/xapian/$VERSION/xapian-bindings-$VERSION.tar.xz
tar -C /usr/local/src/xapian --strip-components=1 -xvaf xapian-core*.tar.xz
tar -C /usr/local/src/xapian-bindings --strip-components=1 -xvaf xapian-bindings*.tar.xz
- name: Cache xapian
id: cache-xapian
uses: actions/cache@v4
with:
path: /usr/local/src/xapian/build
key: ${{ runner.os }}-xapian-${{ hashFiles('**/xapian*.tar.xz') }}
- name: Cache xapian-bindings
id: cache-xapian-bindings
uses: actions/cache@v4
with:
path: /usr/local/src/xapian-bindings/build
key: ${{ runner.os }}-${{ matrix.python-version }}-xapian-${{ hashFiles('**/xapian*.tar.xz') }}
- name: Set up build system
run: |
# Ubuntu<24
test -e /etc/apt/sources.list && \
sudo sed -i '/^deb/P;s/^deb/deb-src/' /etc/apt/sources.list
# Ubuntu>=24
sudo sed -i 's/^Types: deb/Types: deb deb-src/' /etc/apt/sources.list.d/*
sudo apt-get update
sudo apt-get install build-essential
# Xapian deps
sudo apt-get install zlib1g-dev uuid-dev
sudo apt-get build-dep libxapian-dev
# Pygraphviz
sudo apt-get install graphviz-dev
# For generating compile_commands.json file for tests
sudo apt-get install bear
# Tests require dwarfdump
sudo apt-get install dwarfdump
# Install prerequisites for xapian-bindings.
# https://github.com/sphinx-doc/sphinx/issues/6524
pip install Sphinx
- name: Build xapian
if: steps.cache-xapian.outputs.cache-hit != 'true'
run: |
cd /usr/local/src/xapian
mkdir build
cd build
../configure --prefix=/usr
make -j 12
- name: Install xapian
run: |
cd /usr/local/src/xapian/build/
sudo make install
- name: Build xapian bindings
if: steps.cache-xapian-bindings.outputs.cache-hit != 'true'
run: |
cd /usr/local/src/xapian-bindings
mkdir build
cd build
../configure --with-python3 --prefix=/usr
make -j 12
- name: Install xapian bindings
run: |
cd /usr/local/src/xapian-bindings/build/
sudo make install
- name: Install the project
run: |
pip install -e .[dev,graphs]
make -C tests/fixture compile_commands.json
git restore tests/fixture # Restore the committed .o files
- name: Lint
run: make lint
- name: Check formatting
run: make checkformat
- name: Tests
run: make check PYTEST_ARGS='-v'