Skip to content

CI: Set up build-test-deploy workflow on GHA #3513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 0 additions & 64 deletions .github/workflows/package.yml

This file was deleted.

72 changes: 68 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,59 @@ defaults:
run:
shell: bash

concurrency:
group: tests-${{ github.ref }}
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 }}
Expand Down Expand Up @@ -55,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:
Expand All @@ -72,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
Expand All @@ -90,3 +139,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 }}
4 changes: 4 additions & 0 deletions .github/workflows/tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- 'rel/*'

concurrency:
group: tutorials-${{ github.ref }}
cancel-in-progress: true

jobs:
tutorial:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions nipype/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def get_nipype_gitversion():
"pytest-cov",
"pytest-env",
"pytest-timeout",
"pytest-doctestplus",
"sphinx",
]

EXTRA_REQUIRES = {
Expand Down
12 changes: 11 additions & 1 deletion tools/ci/install_deb_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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