From 6d33516d92bf4b7dd283fc11ba0282c533385a9f Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 21 Sep 2022 08:23:33 -0400 Subject: [PATCH 1/6] CI: Use concurrency groups to reduce CI load --- .github/workflows/contrib.yml | 4 ++++ .github/workflows/package.yml | 4 ++++ .github/workflows/tests.yml | 4 ++++ .github/workflows/tutorials.yml | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/.github/workflows/contrib.yml b/.github/workflows/contrib.yml index 100c332440..d723e6aa48 100644 --- a/.github/workflows/contrib.yml +++ b/.github/workflows/contrib.yml @@ -18,6 +18,10 @@ defaults: run: shell: bash +concurrency: + group: contrib-${{ github.ref }} + cancel-in-progress: true + jobs: stable: # Check each OS, all supported Python, minimum versions and latest releases diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2d4d665448..4a38acdb78 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -16,6 +16,10 @@ defaults: run: shell: bash +concurrency: + group: package-${{ github.ref }} + cancel-in-progress: true + jobs: package: # Build packages and upload diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 65aba65687..e7822e4de3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,10 @@ defaults: run: shell: bash +concurrency: + group: tests-${{ github.ref }} + cancel-in-progress: true + jobs: stable: # Check each OS, all supported Python, minimum versions and latest releases diff --git a/.github/workflows/tutorials.yml b/.github/workflows/tutorials.yml index 0d04e0548f..43dea8540e 100644 --- a/.github/workflows/tutorials.yml +++ b/.github/workflows/tutorials.yml @@ -5,6 +5,10 @@ on: branches: - 'rel/*' +concurrency: + group: tutorials-${{ github.ref }} + cancel-in-progress: true + jobs: tutorial: runs-on: ubuntu-latest From 8d53b509951045128c2d1148fc6289bf33060c07 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 21 Sep 2022 08:54:11 -0400 Subject: [PATCH 2/6] CI: Move package build/test into stables tests --- .github/workflows/package.yml | 68 ----------------------------------- .github/workflows/tests.yml | 63 ++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/package.yml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml deleted file mode 100644 index 4a38acdb78..0000000000 --- a/.github/workflows/package.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Packaging - -on: - push: - branches: - - master - - maint/* - - rel/* - tags: - - '*' - schedule: - # 8am EST / 9am EDT Mondays - - cron: '0 13 * * 1' - -defaults: - run: - shell: bash - -concurrency: - group: package-${{ github.ref }} - cancel-in-progress: true - -jobs: - package: - # Build packages and upload - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: ubuntu-latest - python-version: 3.8 - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Create virtual environment - run: tools/ci/create_venv.sh - - name: Build sdist - run: tools/ci/build_archive.sh - env: - INSTALL_TYPE: sdist - - name: Build wheel - run: tools/ci/build_archive.sh - env: - INSTALL_TYPE: wheel - ### Temporary - - name: Check packages with twine - run: | - pip install twine - twine check dist/* - ### Switch back to this if we figure out who has permissions on test.pypi.org - # - name: Test PyPI upload - # uses: pypa/gh-action-pypi-publish@master - # with: - # user: __token__ - # password: ${{ secrets.TEST_PYPI_API_TOKEN }} - # repository_url: https://test.pypi.org/legacy/ - # skip_existing: true - - name: Upload to PyPI (on tags) - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e7822e4de3..3c0cdd7483 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,54 @@ concurrency: cancel-in-progress: true jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: 3 + - run: pip install --upgrade build twine + - name: Build sdist and wheel + run: python -m build + - run: twine check dist/* + - uses: actions/upload-artifact@v3 + with: + name: dist + path: dist/ + + test-package: + runs-on: ubuntu-latest + needs: [build] + strategy: + matrix: + package: ['wheel', 'sdist'] + steps: + - uses: actions/download-artifact@v3 + with: + name: dist + path: dist/ + - uses: actions/setup-python@v4 + with: + python-version: 3 + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Update pip + run: pip install --upgrade pip + - name: Install wheel + run: pip install dist/nipype-*.whl + if: matrix.package == 'wheel' + - name: Install sdist + run: pip install dist/nipype-*.tar.gz + if: matrix.package == 'sdist' + - run: python -c 'import nipype; print(nipype.__version__)' + - name: Install test extras + run: pip install nipype[tests] + - name: Run tests + run: pytest --doctest-modules -v --pyargs nipype + stable: # Check each OS, all supported Python, minimum versions and latest releases runs-on: ${{ matrix.os }} @@ -94,3 +142,18 @@ jobs: name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }} path: test-results.xml if: ${{ always() && matrix.check == 'test' }} + + publish: + runs-on: ubuntu-latest + environment: "Package deployment" + needs: [stable, test-package] + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v3 + with: + name: dist + path: dist/ + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} From b3de74ff93809b54071ff4d3b4fcae1d8f1cbe6f Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 21 Sep 2022 08:54:25 -0400 Subject: [PATCH 3/6] CI: Minor fixups to stable tests --- .github/workflows/tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3c0cdd7483..d729cb277a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -107,9 +107,6 @@ jobs: steps: - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -124,7 +121,7 @@ jobs: echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV - name: Install Debian dependencies run: tools/ci/install_deb_dependencies.sh - if: ${{ matrix.os == 'ubuntu-18.04' }} + if: ${{ matrix.os == 'ubuntu-latest' }} - name: Install dependencies run: tools/ci/install_dependencies.sh - name: Install Nipype From 684eb01be36f2d68f65cf5e5516b1fe4cb41687a Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 21 Sep 2022 09:24:32 -0400 Subject: [PATCH 4/6] CI: Remove afni and elastix from Debian dependencies --- tools/ci/install_deb_dependencies.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/ci/install_deb_dependencies.sh b/tools/ci/install_deb_dependencies.sh index ff1e67732b..3dcf7ae9e4 100755 --- a/tools/ci/install_deb_dependencies.sh +++ b/tools/ci/install_deb_dependencies.sh @@ -6,8 +6,18 @@ set -eu echo "INSTALL_DEB_DEPENDENCIES = $INSTALL_DEB_DEPENDENCIES" +DEPS=( + fsl + # afni + # elastix + fsl-atlases + xvfb + fusefat + graphviz +) + if $INSTALL_DEB_DEPENDENCIES; then bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh) sudo apt update - sudo apt install -y -qq fsl afni elastix fsl-atlases xvfb fusefat graphviz + sudo apt install -y -qq ${DEPS[@]} fi From 5c08bd48219a723aee495d3494755b45a8959bad Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 21 Sep 2022 09:24:53 -0400 Subject: [PATCH 5/6] MNT: Add sphinx to test requirements --- nipype/info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipype/info.py b/nipype/info.py index eb60e4c22b..8919d129bc 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -157,6 +157,7 @@ def get_nipype_gitversion(): "pytest-cov", "pytest-env", "pytest-timeout", + "sphinx", ] EXTRA_REQUIRES = { From c005bdbd43377edfa6c2633a30eb04897f5756d7 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 21 Sep 2022 09:40:30 -0400 Subject: [PATCH 6/6] MNT: Add pytest-doctestplus to test requires for default whitespace normalization --- nipype/info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipype/info.py b/nipype/info.py index 8919d129bc..72c4590e6c 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -157,6 +157,7 @@ def get_nipype_gitversion(): "pytest-cov", "pytest-env", "pytest-timeout", + "pytest-doctestplus", "sphinx", ]