Skip to content

Stable tests

Stable tests #912

Workflow file for this run

name: Stable tests
on:
push:
branches: [ '*' ]
tags: [ '*' ]
pull_request:
branches: [ master, 'maint/*' ]
schedule:
- cron: '0 0 * * *'
defaults:
run:
shell: bash
concurrency:
group: python-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check_if_skip:
runs-on: ubuntu-latest
outputs:
commit_message: ${{ steps.get_commit_message.outputs.commit_message }}
steps:
- name: Get repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Print head git commit message
id: get_commit_message
run: |
if [[ -z "$COMMIT_MSG" ]]; then
COMMIT_MSG=$(git show -s --format=%s)
fi
echo $COMMIT_MSG
echo "::set-output name=commit_message::$COMMIT_MSG"
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
build:
needs: check_if_skip
if: "!contains(needs.check_if_skip.outputs.commit_message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Build smriprep
run: pipx run build
- name: Check distributions
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
test:
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
install: [repo]
include:
- python-version: "3.11"
install: sdist
- python-version: "3.11"
install: wheel
- python-version: "3.11"
install: editable
env:
INSTALL_TYPE: ${{ matrix.install }}
steps:
- uses: actions/checkout@v3
if: matrix.install == 'repo' || matrix.install == 'editable'
- name: Fetch packages
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
if: matrix.install == 'sdist' || matrix.install == 'wheel'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Select archive
run: |
if [ "$INSTALL_TYPE" = "sdist" ]; then
ARCHIVE=$( ls dist/*.tar.gz )
elif [ "$INSTALL_TYPE" = "wheel" ]; then
ARCHIVE=$( ls dist/*.whl )
elif [ "$INSTALL_TYPE" = "repo" ]; then
ARCHIVE="."
elif [ "$INSTALL_TYPE" = "editable" ]; then
ARCHIVE="-e ."
fi
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Install package
run: python -m pip install $ARCHIVE
- name: Install test dependencies
run: python -m pip install "smriprep[tests]"
- name: Run tests
run: pytest -sv --doctest-modules --cov smriprep --pyargs smriprep
- uses: codecov/codecov-action@v3
name: Submit to CodeCov
flake8:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pipx run flake8 smriprep