Skip to content

Test pyterrier with newer Python versions #1028

Test pyterrier with newer Python versions

Test pyterrier with newer Python versions #1028

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
python-version: ['3.7', '3.11']
java: [11, 13]
os: ['ubuntu-latest', 'macOs-latest', 'windows-latest']
architecture: ['x64']
terrier: ['snapshot'] #'5.3', '5.4-SNAPSHOT',
include:
- os: 'self-hosted' # our m1 runner, only one setting
python-version: '3.9'
java: 11
architecture: 'arm'
terrier: 'snapshot'
runs-on: ${{ matrix.os }}
steps:
- name: Setup dependencies for xgBoost on macOs-latest
if: matrix.os == 'macOs-latest'
run: |
brew install libomp
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
if: matrix.os != 'self-hosted'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup java
if: matrix.os != 'self-hosted'
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
architecture: ${{ matrix.architecture }}
distribution: 'zulu'
- name: Install Terrier snapshot
if: matrix.terrier == '5.4-SNAPSHOT'
run: |
git clone https://github.com/terrier-org/terrier-core.git
cd terrier-core
mvn -B -DskipTests install
# follows https://medium.com/ai2-blog/python-caching-in-github-actions-e9452698e98d
- name: Loading Python & dependencies from cache
if: matrix.os != 'self-hosted'
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-test.txt') }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager -r requirements.txt
pip install --upgrade --upgrade-strategy eager -r requirements-test.txt
#install this software
pip install --timeout=120 .
pip install pytest
- name: Lint with flake8
run: |
#pip install flake8
# stop the build if there are Python syntax errors or undefined names
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
#flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Flash unit tests
env:
TERRIER_VERSION: ${{ matrix.terrier }}
run: |
pytest -p no:faulthandler tests/test_flash.py
# Hide underlying Jnius problem by disabling faulthandler: https://github.com/pytest-dev/pytest/issues/7634
- name: All unit tests
env:
TERRIER_VERSION: ${{ matrix.terrier }}
run: |
pytest --durations=20 -p no:faulthandler
- name: Anserini unit tests
env:
TERRIER_VERSION: ${{ matrix.terrier }}
run: |
pip install pyserini==0.9.4
pytest --durations=20 -p no:faulthandler tests/anserini/