-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (69 loc) · 2.78 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
pytest-and-notebooks:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.8"]
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} - ${{ matrix.python-version}} - ${{ matrix.os }} @ ${{ github.ref }}"
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
# Assumes the package have the tests extra
pip install ".[tests]"
# if there is a ./tests/requirements.txt file then install it
if [ -f ./tests/requirements.txt ]; then
pip install -r ./tests/requirements.txt
fi
- name: Run and write pytest
shell: bash
run: |
set -o pipefail
pytest --cov=spacy_wrap --cov-report term-missing | tee pytest-coverage.txt
# - name: Install dependencies for notebooks
# shell: bash
# run: |
# # Assumes the package have the tutorials extra
# pip install ".[tutorials]"
# # if there is a tutorials requirements.txt file then install it
# if [ -f ./tests/requirements.txt ]; then
# pip install -r ./docs/tutorials/requirements.txt
# fi
# - name: Convert and run notebooks
# shell: bash
# run: |
# jupyter nbconvert --to python ./docs/tutorials/*.ipynb
# for f in docs/tutorials/*.py; do python "$f"; done
# if it is run on ubuntu-latest, python 3.9, then create the badge
- name: Pytest coverage comment
# only create the badge once and only if it is not a dependabot or pre-commit-ci
# and only if it is a PR
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9') && (github.actor != 'dependabot[bot]' || github.actor != 'pre-commit-ci[bot]' || github.event_name != 'push') }}
id: coverage-comment
uses: MishaKav/[email protected]
with:
pytest-coverage-path: ./pytest-coverage.txt
- name: Check the output coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' }}
shell: bash
run: |
echo "Coverage Report - ${{ steps.coverage-comment.outputs.coverage }}"
echo "Coverage Color - ${{ steps.coverage-comment.outputs.color }}"