Skip to content

Commit

Permalink
Try using tox
Browse files Browse the repository at this point in the history
Won't work yet.
  • Loading branch information
tsalo committed May 7, 2024
1 parent 15a5578 commit cc294d4
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 31 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ defaults:
run:
shell: bash

# Force tox and pytest to use color
env:
FORCE_COLOR: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -23,14 +27,15 @@ jobs:
pre-release:
# Check pre-releases of dependencies on stable Python
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
os: ['ubuntu-latest']
python-version: ['3.10', '3.11', '3.12']
install: ['pip']
check: ['tests']
pip-flags: ['PRE_PIP_FLAGS']
fail-fast: false

env:
INSTALL_TYPE: ${{ matrix.install }}
CHECK_TYPE: ${{ matrix.check }}
Expand All @@ -42,28 +47,23 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
- name: Install dependencies
run: .maint/ci/install_dependencies.sh
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Create virtual environment
run: .maint/ci/create_venv.sh
- name: Build archive
- name: Install tox
run: |
source .maint/ci/build_archive.sh
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Install fMRIPost-AROMA
run: .maint/ci/install.sh
- name: Install extras
run: .maint/ci/install_extras.sh
- name: Run tests
run: .maint/ci/check.sh
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Show tox config
run: tox c
- name: Run tox
run: tox -v --exit-and-dump-after 1200
- uses: codecov/codecov-action@v4
if: ${{ always() }}
with:
file: coverage.xml
files: cov.xml
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ always() }}
25 changes: 10 additions & 15 deletions .github/workflows/stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,23 @@ jobs:
with:
submodules: recursive
fetch-depth: 0
- name: Install dependencies
run: .maint/ci/install_dependencies.sh
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Create virtual environment
run: .maint/ci/create_venv.sh
- name: Build archive
- name: Install tox
run: |
source .maint/ci/build_archive.sh
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Install fMRIPost-AROMA
run: .maint/ci/install.sh
- name: Install extras
run: .maint/ci/install_extras.sh
- name: Run tests
run: .maint/ci/check.sh
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Show tox config
run: tox c
- name: Run tox
run: tox -v --exit-and-dump-after 1200
- uses: codecov/codecov-action@v4
if: ${{ always() }}
with:
file: coverage.xml
files: cov.xml
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ always() }}
83 changes: 83 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[tox]
requires =
tox>=4
envlist =
py3{8,9,10,11,12}-{full,pre}
py38-min
skip_missing_interpreters = true

# Configuration that allows us to split tests across GitHub runners effectively
[gh-actions]
python =
3.10: py310
3.11: py311
3.12: py312

[gh-actions:env]
DEPENDS =
min: min
full: full
pre: pre

[testenv]
description = Pytest with coverage
labels = test
pip_pre =
pre: true
pass_env =
# getpass.getuser() sources for Windows:
LOGNAME
USER
LNAME
USERNAME
# Pass user color preferences through
PY_COLORS
FORCE_COLOR
NO_COLOR
CLICOLOR
CLICOLOR_FORCE
extras = test
commands =
pytest --doctest-modules -v \
--cov bids --cov-report xml:cov.xml --cov-report term \
bids {posargs:-n auto}

[testenv:docs]
description = Build documentation site
labels = docs
allowlist_externals = make
extras = doc
commands =
make -C doc html

[testenv:spellcheck]
description = Check spelling
labels = check
deps =
codespell[toml]
skip_install = true
commands =
codespell . {posargs}

[testenv:build{,-strict}]
labels =
check
pre-release
deps =
build
twine
skip_install = true
set_env =
build-strict: PYTHONWARNINGS=error
commands =
python -m build
python -m twine check dist/*

[testenv:publish]
depends = build
labels = release
deps =
twine
skip_install = true
commands =
python -m twine upload dist/*

0 comments on commit cc294d4

Please sign in to comment.