Stable tests #1620
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Stable tests | |
on: | |
push: | |
branches: [ '*' ] | |
tags: [ '*' ] | |
pull_request: | |
branches: [ master, 'maint/*', 'next' ] | |
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@v4 | |
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) | |
else | |
COMMIT_MSG=$(echo $COMMIT_MSG | head -n 1) | |
fi | |
echo $COMMIT_MSG | |
echo "commit_message=$COMMIT_MSG" >> $GITHUB_OUTPUT | |
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@v4 | |
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@v4 | |
with: | |
name: dist | |
path: dist/ | |
test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
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 }} | |
FSLOUTPUTTYPE: NIFTI_GZ | |
steps: | |
- uses: actions/checkout@v4 | |
if: matrix.install == 'repo' || matrix.install == 'editable' | |
- name: Fetch packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
if: matrix.install == 'sdist' || matrix.install == 'wheel' | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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@v4 | |
name: Submit to CodeCov | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
style: | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx run ruff check smriprep | |
- run: pipx run ruff format --diff smriprep |