-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (87 loc) · 2.42 KB
/
ci.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Continuous integration
name: CI
on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- "sleap_nn/**"
- "tests/**"
- ".github/workflows/ci.yml"
- "environment_cpu.yml"
- "environment_mac.yml"
- "pyproject.toml"
defaults:
# This is needed for running steps within conda environments.
run:
shell: bash -l {0}
jobs:
# Lint with black, docstring check with pydocstyle, static type checking with mypy
lint:
# This job runs:
#
# 1. Linting with black
#
# 2. Docstring style checking with pydocstyle
# Note: This uses Google-style docstring convention
# Ref: https://google.github.io/styleguide/pyguide.html
name: Lint
runs-on: "ubuntu-latest"
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install --editable .[dev]
- name: Run Black
run: |
black --check sleap_nn tests
- name: Run ruff
run: |
ruff check sleap_nn/
# Tests with pytest
tests:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-14"]
python: [3.9]
include:
# Default values
- env_file: environment_cpu.yml
# Mac specific values
- os: macos-14
env_file: environment_mac.yml
name: Tests (${{ matrix.os }}, Python ${{ matrix.python }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
conda-solver: "libmamba"
environment-file: ${{ matrix.env_file }}
activate-environment: sleap-nn
python-version: ${{ matrix.python }}
- name: Print environment info
shell: bash -l {0}
run: |
which python
conda info
conda list
pip freeze
- name: Test with pytest (with coverage)
shell: bash -l {0}
run: |
pytest --cov=sleap_nn --cov-report=xml --durations=-1 tests/
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}