Vector PRF #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: {branches: [master]} # pushes to master | |
pull_request: {} # all PRs | |
schedule: [cron: '0 12 * * 3'] # every Wednesday at noon | |
jobs: | |
pytest: | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
python-version: ['3.8', '3.12'] | |
runs-on: ${{ matrix.os }} | |
env: | |
runtag: ${{ matrix.os }}-${{ matrix.python-version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.runtag }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }} | |
- name: Loading Torch models from cache | |
uses: actions/cache@v3 | |
with: | |
path: /home/runner/.cache/ | |
key: model-cache | |
- name: Install Dependencies | |
run: | | |
pip install --upgrade -r requirements.txt -r requirements-dev.txt | |
pip install -e . | |
- name: Unit Test | |
run: | | |
pytest --durations=20 -p no:faulthandler --json-report --json-report-file ${{ env.runtag }}.results.json --cov pyterrier_dr --cov-report json:${{ env.runtag }}.coverage.json tests/ | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.runtag }}.*.json | |
overwrite: true | |
- name: Report Test Results | |
if: always() | |
run: | | |
printf "**Test Results**\n\n" >> $GITHUB_STEP_SUMMARY | |
jq '.summary' ${{ env.runtag }}.results.json >> $GITHUB_STEP_SUMMARY | |
printf "\n\n**Test Coverage**\n\n" >> $GITHUB_STEP_SUMMARY | |
jq '.files | to_entries[] | " - `" + .key + "`: **" + .value.summary.percent_covered_display + "%**"' -r ${{ env.runtag }}.coverage.json >> $GITHUB_STEP_SUMMARY |