From 9c2ed59a4cad6407fa2c84150cd5b673ae7a4d13 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 9 Dec 2020 18:11:21 +0100 Subject: [PATCH 1/6] MAINT: Move packaging tests from TravisCI to GitHub Actions --- .github/workflows/pythonpackage.yml | 98 +++++++++++++++++++++++++++++ .travis.yml | 92 --------------------------- 2 files changed, 98 insertions(+), 92 deletions(-) create mode 100644 .github/workflows/pythonpackage.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 00000000..c5c2ac75 --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,98 @@ +name: Python package + +on: + push: + branches: [ '*' ] + tags: [ '*' ] + pull_request: + branches: [ master, 'maint/*' ] + +jobs: + build: + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + pip: ["pip~=18.1", "pip>=20.3"] + setuptools: ["setuptools==38.4.1", "setuptools"] + + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v2 + with: + ssh-key: "${{ secrets.NIPREPS_DEPLOY }}" + - name: Fetch all tags (for versioneer to work) + if: "!startsWith(github.ref, 'refs/tags/')" + run: | + /usr/bin/git -c protocol.version=2 fetch --tags --prune --unshallow origin + - name: Build in confined, updated environment and interpolate version + run: | + python -m venv /tmp/buildenv + source /tmp/buildenv/bin/activate + python -m pip install -U setuptools pip wheel twine docutils + python setup.py sdist bdist_wheel + python -m twine check dist/dmriprep* + # Interpolate version + if [[ "$GITHUB_REF" == refs/tags/* ]]; then + TAG=${GITHUB_REF##*/} + fi + THISVERSION=$( python get_version.py ) + THISVERSION=${TAG:-$THISVERSION} + echo "Expected VERSION: \"${THISVERSION}\"" + echo "THISVERSION=${THISVERSION}" >> ${GITHUB_ENV} + - name: Install in confined environment [sdist] + run: | + python -m venv /tmp/install_sdist + source /tmp/install_sdist/bin/activate + python -m pip install "${{ matrix.pip }}" "${{ matrix.setuptools }}" + python -m pip install dist/dmriprep*.tar.gz + INSTALLED_VERSION=$(python -c 'import dmriprep; print(dmriprep.__version__, end="")') + echo "VERSION: \"${THISVERSION}\"" + echo "INSTALLED: \"${INSTALLED_VERSION}\"" + test "${INSTALLED_VERSION}" = "${THISVERSION}" + - name: Install in confined environment [wheel] + run: | + python -m venv /tmp/install_wheel + source /tmp/install_wheel/bin/activate + python -m pip install "${{ matrix.pip }}" "${{ matrix.setuptools }}" + python -m pip install dist/dmriprep*.whl + INSTALLED_VERSION=$(python -c 'import dmriprep; print(dmriprep.__version__, end="")') + echo "INSTALLED: \"${INSTALLED_VERSION}\"" + test "${INSTALLED_VERSION}" = "${THISVERSION}" + - name: Install in confined environment [setup.py - install] + run: | + python -m venv /tmp/setup_install + source /tmp/setup_install/bin/activate + python -m pip install "${{ matrix.pip }}" "${{ matrix.setuptools }}" + python -m pip install numpy scipy "Cython >= 0.28.5" # sklearn needs this + python -m pip install scikit-learn # otherwise it attempts to build it + python setup.py install + INSTALLED_VERSION=$(python -c 'import dmriprep; print(dmriprep.__version__, end="")') + echo "INSTALLED: \"${INSTALLED_VERSION}\"" + test "${INSTALLED_VERSION}" = "${THISVERSION}" + - name: Install in confined environment [setup.py - develop] + run: | + python -m venv /tmp/setup_develop + source /tmp/setup_develop/bin/activate + python -m pip install "${{ matrix.pip }}" "${{ matrix.setuptools }}" + python -m pip install numpy scipy "Cython >= 0.28.5" # sklearn needs this + python -m pip install scikit-learn # otherwise it attempts to build it + python setup.py develop + INSTALLED_VERSION=$(python -c 'import dmriprep; print(dmriprep.__version__, end="")') + echo "INSTALLED: \"${INSTALLED_VERSION}\"" + test "${INSTALLED_VERSION}" = "${THISVERSION}" + flake8: + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - run: pip install flake8 + - run: flake8 dmriprep diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 647dc893..00000000 --- a/.travis.yml +++ /dev/null @@ -1,92 +0,0 @@ -# vim ft=yaml -dist: xenial -sudo: true -language: python - -cache: - directories: - - $HOME/.cache/pip - - $HOME/.cache/data - -python: - - 3.6 - - 3.7 - - -env: - global: - - CHECK_TYPE="install" - - INSTALL_TYPE="pip" - - INSTALL_DEPENDS="pip setuptools" - matrix: - - CHECK_TYPE="style" - - CHECK_TYPE="test" - - INSTALL_TYPE="install" - - INSTALL_TYPE="develop" - - INSTALL_TYPE="sdist" - - INSTALL_TYPE="wheel" - - INSTALL_DEPENDS="pip==18.1 setuptools==30.2.1" - - INSTALL_DEPENDS="pip==10.0.1 setuptools==30.4.0" - -matrix: - exclude: - - python: 3.7 - env: CHECK_TYPE="style" - allow_failures: - - python: 3.6 - env: INSTALL_DEPENDS="pip==10.0.1 setuptools==30.4.0" - - python: 3.7 - env: INSTALL_DEPENDS="pip==10.0.1 setuptools==30.4.0" - -before_install: - - python -m pip install --upgrade pip virtualenv - - virtualenv --python=python /tmp/venv - - source /tmp/venv/bin/activate - - python --version - - python -m pip --version - - python -m pip install --upgrade $INSTALL_DEPENDS - - python -m pip --version - - | - if [ "$INSTALL_TYPE" == "pip" ]; then - PACKAGE="." - elif [ "$INSTALL_TYPE" == "sdist" ]; then - python setup.py sdist - PACKAGE="$( ls dist/*.tar.gz )" - elif [ "$INSTALL_TYPE" == "wheel" ]; then - python setup.py bdist_wheel - PACKAGE="$( ls dist/*.whl )" - fi -install: - - | - if [ "$INSTALL_TYPE" == "install" ]; then - python setup.py install - elif [ "$INSTALL_TYPE" == "develop" ]; then - python setup.py develop - else - python -m pip install $PACKAGE - fi - - | - INTENDED_VERSION="$(python -c 'import versioneer; print(versioneer.get_version())')" - pushd /tmp - INSTALLED_VERSION="$(python -c 'import dmriprep; print(dmriprep.__version__)')" - python -c 'import dmriprep; print(dmriprep.__file__)' - echo "Intended: $INTENDED_VERSION" - echo "Installed: $INSTALLED_VERSION" - test "$INTENDED_VERSION" == "$INSTALLED_VERSION" - popd - - if [ "$CHECK_TYPE" = "install" ]; then exit 0; fi - -before_script: - - travis_retry python -m pip install "dmriprep[$CHECK_TYPE]" -script: - - | - if [ "$CHECK_TYPE" == "style" ]; then - flake8 dmriprep - elif [ "$CHECK_TYPE" == "test" ]; then - pytest -n 2 -vv --doctest-modules --cov dmriprep --cov-config .coveragerc --cov-report xml:cov.xml dmriprep - else - false - fi -after_script: - - python -m pip install codecov - - codecov From 574e87cd9c3944b56b0f1fbc119a2cf9c945853b Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 9 Dec 2020 21:17:22 +0100 Subject: [PATCH 2/6] maint: pin smriprep 0.8.0rc0 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 56f2fd20..3d9c19f2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,7 @@ install_requires = pybids >= 0.11.1 pyyaml sdcflows ~= 1.3.3 - smriprep ~= 0.7.0 + smriprep >= 0.8.0rc0 templateflow ~= 0.6 toml setup_requires = From aba2876ab53e0285714970b0fbc9a13391a5440f Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 9 Dec 2020 21:22:34 +0100 Subject: [PATCH 3/6] maint: pin sdcflows 2.0.0rc2 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3d9c19f2..ec778ffd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,7 +29,7 @@ install_requires = numpy pybids >= 0.11.1 pyyaml - sdcflows ~= 1.3.3 + sdcflows >= 2.0.0rc2 smriprep >= 0.8.0rc0 templateflow ~= 0.6 toml From 4396163c58bb7c23b06b36cc4d807e787bea94c3 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 9 Dec 2020 22:54:10 +0100 Subject: [PATCH 4/6] fix: address problems with Python 3.6 --- .github/workflows/pythonpackage.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c5c2ac75..c23fea8b 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -79,7 +79,12 @@ jobs: python -m venv /tmp/setup_develop source /tmp/setup_develop/bin/activate python -m pip install "${{ matrix.pip }}" "${{ matrix.setuptools }}" - python -m pip install numpy scipy "Cython >= 0.28.5" # sklearn needs this + # sklearn needs these dependencies + if [ "${{ matrix.python-version }}" == "3.6" ]; then + python -m pip install "numpy < 1.20" scipy "Cython >= 0.28.5" # numpy 1.20 drops Py3.6 + else + python -m pip install numpy scipy "Cython >= 0.28.5" + fi python -m pip install scikit-learn # otherwise it attempts to build it python setup.py develop INSTALLED_VERSION=$(python -c 'import dmriprep; print(dmriprep.__version__, end="")') From e5bb4611cb232fadad6778519271b61d05e1d5af Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 9 Dec 2020 23:20:38 +0100 Subject: [PATCH 5/6] fix: dismiss python 3.6 tests for now --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index c23fea8b..3ba4685e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.7, 3.8] pip: ["pip~=18.1", "pip>=20.3"] setuptools: ["setuptools==38.4.1", "setuptools"] From 3a0edb360b1e0e9bcf3bb3f69ab19560e83c1ffd Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Wed, 9 Dec 2020 23:31:10 +0100 Subject: [PATCH 6/6] fix: revised version pinning of setuptools --- .circleci/config.yml | 6 +++--- .github/workflows/pythonpackage.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2d546a81..cf83628e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -505,7 +505,7 @@ jobs: python -m venv /tmp/sdist source /tmp/sdist/bin/activate python -m pip install -U pip - python -m pip install "setuptools>=30.3.0" twine + python -m pip install "setuptools>=40.8.0" twine - run: name: Build dMRIPrep command: | @@ -540,7 +540,7 @@ jobs: python -m venv /tmp/wheel source /tmp/wheel/bin/activate python -m pip install -U pip - python -m pip install "setuptools>=30.3.0" twine + python -m pip install "setuptools>=40.8.0" twine THISVERSION=$( python get_version.py ) THISVERSION=${THISVERSION%.dirty*} THISVERSION=${CIRCLE_TAG:-$THISVERSION} @@ -568,7 +568,7 @@ jobs: python -m venv /tmp/sdist source /tmp/sdist/bin/activate python -m pip install -U pip - python -m pip install "setuptools>=30.3.0" twine + python -m pip install "setuptools>=40.8.0" wheel twine - run: name: Build dMRIPrep command: | diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3ba4685e..6420f2ce 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: matrix: python-version: [3.7, 3.8] pip: ["pip~=18.1", "pip>=20.3"] - setuptools: ["setuptools==38.4.1", "setuptools"] + setuptools: ["setuptools==40.8.0", "setuptools"] steps: - name: Set up Python ${{ matrix.python-version }}