-
Notifications
You must be signed in to change notification settings - Fork 18
76 lines (63 loc) · 1.73 KB
/
backend-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
# Workflow for running backend tests for PRs and main branch
name: Backend Tests
on:
push:
branches:
- main
paths:
- 'backend/**'
- 'napari-hub-commons/**'
- '.github/workflows/backend-tests.yml'
pull_request:
branches:
- '**'
paths:
- 'backend/**'
- 'napari-hub-commons/**'
- '.github/workflows/backend-tests.yml'
defaults:
run:
working-directory: backend/
jobs:
# Runs pytest for backend code
tests:
name: Unit test with pytest
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Cache Python environment
uses: actions/cache@v3
id: pip-cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }}
- name: Install dependencies
# need npe2 here to test preview page
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: Run unit tests
working-directory: backend
run : |
python -m pytest utils api
lints:
name: Linting with Black
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
- uses: psf/black@stable
with:
options: "--check --diff --color --verbose --extend-exclude '.*/tests/.*'"
version: "~= 23.1.0"
src: "./backend"