Skip to content

GHA: Test with Xapian 2.0.0 #109

GHA: Test with Xapian 2.0.0

GHA: Test with Xapian 2.0.0 #109

Workflow file for this run

name: Test
on: [push, pull_request]
env:
FORCE_COLOR: 1
jobs:
prebuild_xapian_wheel:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
xapian-version: ['1.4.20', '2.0.0']
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Checkout xapian-haystack
uses: actions/checkout@v6
- name: Check for cached xapian wheel
# https://github.com/actions/cache#cache-limits
# says this cached wheel will be evicted after a week unused.
id: xapian-cache
uses: actions/cache@v4
with:
path: xapian*.whl
key: xapian-${{ matrix.xapian-version }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('xapian_wheel_builder.sh') }}
- name: Build xapian wheel
if: steps.xapian-cache.outputs.cache-hit != 'true'
run: |
./xapian_wheel_builder.sh ${{ matrix.xapian-version }}
test:
needs: prebuild_xapian_wheel
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
django-version: ['4.2', '5.2', '6.0']
xapian-version: ['1.4.20', '2.0.0']
filelock-version: ['3.4.2']
exclude:
# Django added python 3.13 support in 5.1
- python-version: '3.13'
django-version: '4.2'
# Django idropped python 3.10/3.11 support in 6.0
- python-version: '3.10'
django-version: '6.0'
- python-version: '3.11'
django-version: '6.0'
continue-on-error: true
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Checkout xapian-haystack
uses: actions/checkout@v6
- name: Check for cached xapian wheel
# This will always succeed since the previous job just ran.
id: xapian-cache
uses: actions/cache@v4
with:
path: xapian*.whl
key: xapian-${{ matrix.xapian-version }}-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('xapian_wheel_builder.sh') }}
- name: Install Django and other Python dependencies
run: |
python -m pip install --upgrade pip
pip install django~=${{ matrix.django-version }} filelock~=${{ matrix.filelock-version }} coveralls packaging xapian*.whl
- name: Checkout django-haystack
uses: actions/checkout@v6
with:
repository: 'django-haystack/django-haystack'
path: django-haystack
- name: Copy some test files to django-haystack
run: |
cp xapian_backend.py django-haystack/haystack/backends/
cp -r tests/* django-haystack/test_haystack/
cp tests/xapian_tests/__init__.py django-haystack/test_haystack/
cp .coveragerc django-haystack/
- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=." >> $GITHUB_ENV
- name: Ensure all apps have migrations
run: |
cd django-haystack
django-admin makemigrations --settings=test_haystack.xapian_settings
- name: Running tests
run: |
cd django-haystack
coverage run $(command -v django-admin) test test_haystack.xapian_tests --settings=test_haystack.xapian_settings
env:
PYTHONPATH: "."
- name: Coveralls
run: |
coverage combine django-haystack/.coverage
coverage report
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}-django-${{ matrix.django-version }}-xapian-${{ matrix.xapian-version }}
COVERALLS_PARALLEL: true
coveralls:
needs: test
runs-on: ubuntu-latest
steps:
- name: Inform Coveralls of Completion
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}