Skip to content

Commit

Permalink
chore(dev): Move to tox to simplify test/CI setup (#3326)
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies authored Jul 17, 2024
1 parent 70209ee commit b5a3674
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 270 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/pre-release.yml

This file was deleted.

46 changes: 26 additions & 20 deletions .github/workflows/stable.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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 @@ -24,47 +28,49 @@ permissions:
contents: read

jobs:
stable:
test:
# Check each OS, all supported Python, minimum versions and latest releases
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest']
python-version: ['3.10', '3.11', '3.12']
install: ['pip']
check: ['tests']
pip-flags: ['']
dependencies: ['latest', 'pre']
include:
- os: ubuntu-latest
python-version: '3.10'
dependencies: 'min'

env:
INSTALL_TYPE: ${{ matrix.install }}
CHECK_TYPE: ${{ matrix.check }}
EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }}
OS_TYPE: ${{ matrix.os }}
DEPENDS: ${{ matrix.dependencies }}

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/cache@v4
with:
path: ~/.cache/templateflow
key: templateflow-v1
- name: Install dependencies
run: .maint/ci/install_dependencies.sh
run: |
sudo apt update
sudo apt install -y --no-install-recommends graphviz
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- 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 fMRIPrep
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
with:
file: coverage.xml
Expand Down
9 changes: 0 additions & 9 deletions .maint/ci/activate.sh

This file was deleted.

34 changes: 0 additions & 34 deletions .maint/ci/build_archive.sh

This file was deleted.

26 changes: 0 additions & 26 deletions .maint/ci/check.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .maint/ci/create_venv.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .maint/ci/env.sh

This file was deleted.

34 changes: 0 additions & 34 deletions .maint/ci/install.sh

This file was deleted.

21 changes: 0 additions & 21 deletions .maint/ci/install_dependencies.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .maint/ci/install_extras.sh

This file was deleted.

29 changes: 26 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ telemetry = [
"sentry-sdk >= 1.3",
]
test = [
"coverage",
"coverage[toml]",
"pytest",
"pytest-cov",
"pytest-env",
"pytest-xdist",
]
maint = [
"fuzzywuzzy",
Expand Down Expand Up @@ -127,11 +128,21 @@ exclude = ".*"

[tool.pytest.ini_options]
minversion = "6"
testpaths = ["fmriprep/tests"]
testpaths = ["fmriprep"]
log_cli_level = "INFO"
xfail_strict = true
norecursedirs = [".git"]
addopts = ["-svx", "-ra", "--strict-config", "--strict-markers", "--doctest-modules"]
addopts = [
"-svx",
"-ra",
"--strict-config",
"--strict-markers",
"--doctest-modules",
# Config pytest-cov
"--cov=fmriprep",
"--cov-report=xml",
"--cov-config=pyproject.toml",
]
doctest_optionflags = "ALLOW_UNICODE NORMALIZE_WHITESPACE ELLIPSIS"
env = "PYTHONHASHSEED=0"
filterwarnings = ["ignore::DeprecationWarning"]
Expand Down Expand Up @@ -181,3 +192,15 @@ inline-quotes = "single"

[tool.ruff.format]
quote-style = "single"

[tool.coverage.run]
branch = true
omit = [
"*/_version.py"
]

[tool.coverage.paths]
source = [
"fmriprep",
"**/site-packages/fmriprep"
]
Loading

0 comments on commit b5a3674

Please sign in to comment.