|
| 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-24.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: 3.13 |
| 36 | + |
| 37 | + steps: |
| 38 | + # Checkout the latest code from the repo |
| 39 | + - name: Checkout source |
| 40 | + # example directives: |
| 41 | + # disable step |
| 42 | + # if: {{ false }} |
| 43 | + # continue running if step fails |
| 44 | + # continue-on-error: true |
| 45 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 46 | + |
| 47 | + # Setup version of Python to use |
| 48 | + - name: Set Up Python 3.13 |
| 49 | + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 |
| 50 | + with: |
| 51 | + python-version: 3.13 |
| 52 | + allow-prereleases: true |
| 53 | + cache: 'pip' |
| 54 | + |
| 55 | + - name: Install build tools - setuptools |
| 56 | + run: pip install setuptools |
| 57 | + |
| 58 | + # Display the Python version being used |
| 59 | + - name: Display Python and key module versions |
| 60 | + run: | |
| 61 | + python -c "import sys; print('python version: ', sys.version)" |
| 62 | + python -c "import sqlite3; print('sqlite version: ', sqlite3.sqlite_version)" |
| 63 | + python -c "import setuptools; print('setuptools version: ', setuptools.__version__);" |
| 64 | +
|
| 65 | + - name: Update pip |
| 66 | + run: python -m pip install --upgrade pip |
| 67 | + |
| 68 | + # https://github.com/mxschmitt/action-tmate |
| 69 | + # allow remote ssh into the CI container. I need this to debug |
| 70 | + # some xfail cases |
| 71 | + - name: Setup tmate session |
| 72 | + uses: mxschmitt/action-tmate@v3 |
| 73 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} |
| 74 | + timeout-minutes: 60 |
| 75 | + with: |
| 76 | + limit-access-to-actor: true |
| 77 | + |
| 78 | + - name: Install xapian |
| 79 | + run: | |
| 80 | + set -xv |
| 81 | + sudo apt-get install libxapian-dev |
| 82 | + # Sphinx required to build the xapian python bindings. Use 1.8.5 on |
| 83 | + # older python and newest on newer. |
| 84 | + pip install sphinx |
| 85 | + XAPIAN_VER="1.4.22"; echo $XAPIAN_VER; |
| 86 | + cd /tmp |
| 87 | + curl -s -O https://oligarchy.co.uk/xapian/$XAPIAN_VER/xapian-bindings-$XAPIAN_VER.tar.xz |
| 88 | + tar -Jxvf xapian-bindings-$XAPIAN_VER.tar.xz |
| 89 | + cd xapian-bindings-$XAPIAN_VER/ |
| 90 | + # edit the configure script. |
| 91 | + # distutils.sysconfig.get_config_vars('SO') doesn't work for |
| 92 | + # 3.11 or newer. |
| 93 | + # Change distutils.sysconfig... to just sysconfig and SO |
| 94 | + # to EXT_SUFFIX to get valid value. |
| 95 | + # DISABLED use their script |
| 96 | + if [[ $PYTHON_VERSION == "X."* ]]; then |
| 97 | + cp configure configure.FCS; |
| 98 | + sed -i \ |
| 99 | + -e '/PYTHON3_SO=/s/distutils\.//g' \ |
| 100 | + -e '/PYTHON3_SO=/s/"SO"/"EXT_SUFFIX"/g' \ |
| 101 | + -e '/PYTHON3_CACHE_TAG=/s/imp;print(imp.get_tag())/sys;print(sys.implementation.cache_tag)/' \ |
| 102 | + -e '/PYTHON3_CACHE_OPT1_EXT=/s/imp\.get_tag()/sys.implementation.cache_tag/g' \ |
| 103 | + -e '/PYTHON3_CACHE_OPT1_EXT=/s/imp\b/importlib/g' \ |
| 104 | + configure; |
| 105 | + diff -u configure.FCS configure || true; |
| 106 | + fi |
| 107 | + ./configure --prefix=$VIRTUAL_ENV --with-python3 --disable-documentation |
| 108 | + make && sudo make install |
| 109 | + python -c 'import xapian' |
0 commit comments