Skip to content

Add tests and Github Action #18

Add tests and Github Action

Add tests and Github Action #18

Workflow file for this run

name: Test Python package
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
python: [3.8]
java: [13]
os: ['ubuntu-latest'] #
architecture: ['x64']
terrier: ['snapshot'] #'5.3', '5.4-SNAPSHOT',
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
architecture: ${{ matrix.architecture }}
distribution: 'zulu'
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
python-version: ${{ matrix.python }}
conda-channels: anaconda, conda-forge
activate-conda: true
# follows https://medium.com/ai2-blog/python-caching-in-github-actions-e9452698e98d
- name: Loading Python & dependencies from cache
uses: actions/cache@v3
with:
path: /usr/share/miniconda/lib/python3.8/site-packages/
key: /usr/share/miniconda/lib/python3.8/site-packages/-${{ hashFiles('requirements.txt') }}
- name: Loading Torch models from cache
uses: actions/cache@v3
with:
path: /home/runner/.cache/
key: uog44k_only
- name: Install Python dependencies
run: |
conda install pip
conda install mkl_fft -y
conda install -c pytorch faiss-cpu=1.6.3
pip install --upgrade --upgrade-strategy eager git+https://github.com/terrier-org/pyterrier.git#egg=python-terrier
pip install --upgrade --upgrade-strategy eager -r requirements.txt
#install this software
pip install --timeout=120 .
pip install --upgrade --upgrade-strategy eager pytest
conda list
- name: All unit tests
env:
TERRIER_VERSION: ${{ matrix.terrier }}
run: |
pytest -s