Package modernization #1
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: [main]} # pushes to main | |
pull_request: {} # all PRs | |
schedule: [cron: '0 12 * * 3'] # every Wednesday at noon | |
jobs: | |
pytest: | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
python-version: ['3.9', '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_t5 --cov-report json:${{ env.runtag }}.coverage.json tests/ | |
- 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 |