Skip to content

Commit

Permalink
splits tox.ini, updates ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
billbrod committed Oct 14, 2024
1 parent ca25470 commit 1738408
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
- main

jobs:
tox:
tests:
if: ${{ !github.event.pull_request.draft }}
strategy:
matrix:
Expand All @@ -38,7 +38,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
pip install tox
- name: Run tox
Expand All @@ -49,6 +48,27 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

check:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4 # Use v4 for compatibility with pyproject.toml
with:
python-version: 3.12
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tox
run: tox -e check

prevent_docs_absolute_links:
runs-on: ubuntu-latest
steps:
Expand All @@ -63,7 +83,10 @@ jobs:

check:
if: ${{ !github.event.pull_request.draft }}
needs: tox
needs:
- tests
- prevent_docs_absolute_links
- check
runs-on: ubuntu-latest
steps:
- name: Decide whether all tests and notebooks succeeded
Expand Down
19 changes: 14 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,26 @@ extras = dev
package_cache = .tox/cache

# Run both pytest and coverage since pytest was initialized with the --cov option in the pyproject.toml
# while black, isort and flake8 are also i
commands =
black --check src
pytest --doctest-modules src/nemos/
pytest --cov=nemos --cov-config=pyproject.toml --cov-report=xml

[testenv:fix]
commands=
black src
isort src --profile=black
isort docs/how_to_guide --profile=black
isort docs/background --profile=black
isort docs/tutorials --profile=black
flake8 --config={toxinidir}/tox.ini src
pytest --doctest-modules src/nemos/
pytest --cov=nemos --cov-config=pyproject.toml --cov-report=xml

[testenv:check]
commands=
black --check src
isort --check src --profile=black
isort --check docs/how_to_guide --profile=black
isort --check docs/background --profile=black
isort --check docs/tutorials --profile=black
flake8 --config={toxinidir}/tox.ini src

[gh-actions]
python =
Expand Down

0 comments on commit 1738408

Please sign in to comment.