-
Notifications
You must be signed in to change notification settings - Fork 20
57 lines (51 loc) · 1.54 KB
/
python-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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
cache: 'pip' # caching pip dependencies
- name: Cache models
uses: actions/cache@v3
with:
key: ${{ runner.os }}-build-models-cache
path: |
~/.cache/huggingface
~/.cache/zshot
~/.pytest_cache
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/devel.txt
- name: Lint with flake8
run: |
flake8 --ignore E501,W503 zshot/
- name: Install Spacy pipeline and download models
run: |
python -m spacy download en_core_web_sm
python -m zshot.utils.download_models
- name: Test with pytest
run: |
python -m pytest --cov -v --cov-report xml:/home/runner/coverage.xml
timeout-minutes: 30
- name: Remove cache
run: |
rm -rf ~/.cache/huggingface
rm -rf ~/.cache/zshot
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
files: /home/runner/coverage.xml