Skip to content

FIX: Use average corrected PET for visualization #222

FIX: Use average corrected PET for visualization

FIX: Use average corrected PET for visualization #222

name: Python
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: bash
env:
FORCE_COLOR: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Build & verify package
runs-on: ubuntu-latest
permissions:
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: hynek/build-and-inspect-python-package@v2
id: build-petprep
with:
upload-name-suffix: -main
attest-build-provenance-github: ${{ github.event_name != 'pull_request' }}
- name: Clean up package build
run: rm -r ${{ steps.build-petprep.outputs.dist }}
- uses: hynek/build-and-inspect-python-package@v2
id: build-wrapper
with:
path: wrapper
upload-name-suffix: -wrapper
attest-build-provenance-github: ${{ github.event_name != 'pull_request' }}
- name: Clean up wrapper build
run: rm -r ${{ steps.build-wrapper.outputs.dist }}
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: ['3.10', '3.11', '3.12', '3.13']
dependencies: ['latest', 'pre']
include:
- os: ubuntu-latest
python-version: '3.10'
dependencies: 'min'
env:
DEPENDS: ${{ matrix.dependencies }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/cache@v4
with:
path: ~/.cache/templateflow
key: templateflow-v1
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends graphviz
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install tox
run: |
uv tool install --with=tox-uv --with=tox-gh-actions tox
- name: Show tox config
run: tox c
- name: Run tox
run: tox -v --exit-and-dump-after 1200
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ always() }}
test-packages:
runs-on: ${{ matrix.os }}
needs: [build]
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.12"]
dependencies: ["latest"]
env:
DEPENDS: ${{ matrix.dependencies }}
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
pattern: Packages-*
path: dist
- run: ls -lR
- name: Unpack sdist
run: |
tar --strip-components=1 -xzf dist/*/petprep-*.tar.gz
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Check wrapper version
run: |
echo n | uvx --from=$( ls dist/*/petprep_docker*.whl ) petprep-docker --version
- uses: actions/cache@v4
with:
path: ~/.cache/templateflow
key: templateflow-v1
- name: Install tox
run: |
uv tool install tox --with=tox-uv --with=tox-gh-actions
- name: Show tox config
run: tox c
- name: Run tox
run: tox -v --exit-and-dump-after 1800
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ always() }}
publish:
name: Publish released package to pypi.org
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
environment: PyPI
needs: [test, test-packages]
permissions:
attestations: write
id-token: write
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
pattern: Packages-*
path: dist
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/Packages-main/
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/Packages-wrapper/
checks:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
check: ['style', 'spellcheck']
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
- name: Install tox
run: uv tool install tox --with=tox-uv
- name: Show tox config
run: tox c -e ${{ matrix.check }}
- name: Run check
run: tox -e ${{ matrix.check }}