diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index f039cb8..9b4d8da 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -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 @@ -23,7 +27,6 @@ jobs: pre-release: # Check pre-releases of dependencies on stable Python runs-on: ${{ matrix.os }} - continue-on-error: true strategy: matrix: os: ['ubuntu-latest'] @@ -31,6 +34,8 @@ jobs: install: ['pip'] check: ['tests'] pip-flags: ['PRE_PIP_FLAGS'] + fail-fast: false + env: INSTALL_TYPE: ${{ matrix.install }} CHECK_TYPE: ${{ matrix.check }} @@ -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() }} diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index a9d5664..34a2aa6 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -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() }} diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..bb892f3 --- /dev/null +++ b/tox.ini @@ -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/*