-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test and CI modernization #370
Changes from 66 commits
b707f24
2f2e656
4d8518a
c431397
79cac51
72fec4f
4eb0e93
4b24acc
2db23e1
c919f3b
567a322
62377e5
7ea56fe
7caf3f3
a22fd5e
83daf50
9ac4c1f
06551cb
7aa37ef
b4e77ac
9e79105
1ca9fe5
0aff744
530d147
56097b6
de74514
e40ce42
c6a607e
ec934ea
6b71073
a255e54
6123d16
0ba98cb
2821bbd
9677077
9351cfe
c2a9f59
b630f20
b94d24e
d8e1097
6a54024
b400143
ecfb62e
28b77c4
301e24b
72f2d60
d33a946
5afae79
d69527c
588ee9a
3033bbd
97fd74a
0128800
8580166
9133cd8
c44d711
f95c7a8
fc156e8
b273a1f
c5b2d74
9e3b9eb
3c9e007
969d2fe
d12b583
4878992
6589a98
037d890
74b19e8
0ac93b3
9927de9
ddfb4d3
8dd2ce6
69653f1
c962ddc
d427482
ecf4dcc
2a8d9fb
0e95576
1baa497
89adb77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
nce | ||
fpr | ||
shepard | ||
dum | ||
theis |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: lint | ||
channels: | ||
- conda-forge | ||
- defaults | ||
dependencies: | ||
# required | ||
- pip | ||
- bandit | ||
- codespell | ||
- flake8 | ||
- pytest | ||
- pydocstyle | ||
|
||
# Dependencies for velin | ||
- numpydoc>=1.1.0 | ||
- sphinx>=5.1.0 | ||
- pygments | ||
- black | ||
|
||
- pip: | ||
- velin |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: test | ||
channels: | ||
- conda-forge | ||
- defaults | ||
dependencies: | ||
- pip | ||
- numpy ==1.7.0 | ||
- scipy ==1.0.0 | ||
- matplotlib==2.1.0 | ||
- pytest | ||
- pytest-cov | ||
- pytest-mpl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: lint_python | ||
on: [pull_request, push] | ||
jobs: | ||
lint_python: | ||
name: "Lint and code analysis" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
python-version: "3.11" | ||
channel-priority: "flexible" | ||
envfile: ".github/environment-lint.yml" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Cache conda | ||
uses: actions/cache@v4 | ||
env: | ||
CACHE_NUMBER: 0 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles( matrix.envfile ) }} | ||
- name: Install conda environmnent | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
auto-update-conda: false | ||
python-version: ${{ matrix.python-version }} | ||
add-pip-as-python-dependency: true | ||
auto-activate-base: false | ||
activate-environment: lint | ||
# mamba-version: "*" | ||
channel-priority: ${{ matrix.channel-priority }} | ||
environment-file: ${{ matrix.envfile }} | ||
use-only-tar-bz2: false | ||
|
||
- name: Conda info | ||
shell: bash -l {0} | ||
run: | | ||
conda info -a | ||
conda list | ||
|
||
- name: Spell check package | ||
shell: bash -l {0} | ||
run: codespell --ignore-words .codespell_ignore_list mir_eval | ||
|
||
- name: Security check | ||
shell: bash -l {0} | ||
run: bandit --recursive --skip B101,B110 . | ||
|
||
- name: Style check package | ||
shell: bash -l {0} | ||
run: python -m flake8 mir_eval | ||
|
||
- name: Format check package | ||
shell: bash -l {0} | ||
run: python -m black --check mir_eval | ||
|
||
- name: Format check tests | ||
shell: bash -l {0} | ||
run: python -m black --check tests | ||
|
||
- name: Docstring check | ||
shell: bash -l {0} | ||
run: python -m velin --check mir_eval | ||
|
||
- name: Docstring style check | ||
shell: bash -l {0} | ||
run: python -m pydocstyle mir_eval |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,30 +3,38 @@ name: Test Python code | |
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: True | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: True | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.8", "3.9", "3.10"] | ||
python-version: ["3.8", "3.10", "3.11"] | ||
channel-priority: [strict] | ||
envfile: [".github/environment.yml"] | ||
include: | ||
- python-version: "3.10" | ||
- python-version: "3.12" | ||
os: macos-latest | ||
- python-version: "3.10" | ||
- python-version: "3.12" | ||
os: windows-latest | ||
- python-version: "3.10" | ||
- python-version: "3.12" | ||
os: ubuntu-latest | ||
channel-priority: flexible | ||
- os: ubuntu-latest | ||
python-version: "3.7" | ||
envfile: ".github/environment-minimal.yml" | ||
channel-priority: "flexible" | ||
name: "Minimal dependencies" | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -35,16 +43,18 @@ jobs: | |
uses: actions/cache@v3 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('.github/environment.yml') }} | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles( matrix.envfile ) }} | ||
|
||
- name: Create conda environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
auto-activate-base: false | ||
channel-priority: ${{ matrix.channel-priority }} | ||
environment-file: .github/environment.yml | ||
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! | ||
environment-file: ${{ matrix.envfile }} | ||
# Disabling bz2 to get more recent dependencies. | ||
# NOTE: this breaks cache support, so CI will be slower. | ||
use-only-tar-bz2: False # IMPORTANT: This needs to be set for caching to work properly! | ||
|
||
- name: Install package in development mode | ||
shell: bash -l {0} | ||
|
@@ -60,7 +70,22 @@ jobs: | |
shell: bash -l {0} | ||
run: python -c "import numpy; numpy.show_config()" | ||
|
||
- name: Show libraries in the system on which SciPy was built | ||
shell: bash -l {0} | ||
run: python -c "import scipy; scipy.show_config()" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this something you were using for debugging, or do we want it always? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's good to include. Scipy configs can change out from under us as dependencies update, and these things have historically caused us trouble (eg transcription velocity recently, bsseval a few years back). |
||
|
||
- name: Run unit tests | ||
shell: bash -l {0} | ||
run: pytest --cov=mir_eval | ||
run: pytest | ||
working-directory: tests | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.xml | ||
flags: unittests | ||
env_vars: OS,PYTHON | ||
name: codecov-umbrella | ||
fail_ci_if_error: true | ||
verbose: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ | |
from . import transcription_velocity | ||
from . import key | ||
|
||
__version__ = '0.7' | ||
__version__ = "0.7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important for this to be set, but it's not set... I think we can remove this comment given your above comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment comes from the starter code for the action. I think it's serving a useful purpose here to indicate that caching does not currently work, and it cannot until the setup-miniconda action gets fixed upstream. I'd prefer to leave it in as a provenance trail for why the flag is set the way it is.