[MAINT] drop python 3.8 and support 3.13 (#179) #399
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
--- | |
on: | |
push: | |
branches: | |
- main | |
- maint/* | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
- maint/* | |
paths: ['giga_connectome/*', 'pyproject.toml', 'requirements.txt', 'Dockerfile'] | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
check_skip_flags: | |
name: Check skip flags | |
runs-on: ubuntu-latest | |
outputs: | |
head-commit-message: ${{ steps.get_head_commit_message.outputs.headCommitMsg }} | |
steps: | |
- name: Get repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Print head git commit message | |
id: get_head_commit_message | |
run: echo "headCommitMsg=$(git show -s --format=%s)" >> $GITHUB_OUTPUT | |
download-test-data: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
- name: install tox | |
run: pip install tox | |
- uses: actions/cache@v4 | |
id: cache | |
env: | |
cache-name: ds000017 | |
with: | |
path: /home/runner/work/giga_connectome/giga_connectome/giga_connectome/data/test_data | |
key: ${{ env.cache-name }} | |
- if: ${{ steps.cache.outputs.cache-hit != 'true' }} | |
name: Download fmriprep derivative of ds000017 | |
id: download | |
run: tox -e test_data | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3 | |
- run: pip install --upgrade build twine | |
- name: Build sdist and wheel | |
run: python -m build | |
- run: twine check dist/* | |
- name: Upload sdist and wheel artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Build git archive | |
run: mkdir archive && git archive -v -o archive/archive.tgz HEAD | |
- name: Upload git archive artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: archive | |
path: archive/ | |
test-package: | |
runs-on: ubuntu-latest | |
needs: [build] | |
strategy: | |
matrix: | |
package: [wheel, sdist, archive] | |
steps: | |
- name: Download sdist and wheel artifacts | |
if: matrix.package != 'archive' | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Download git archive artifact | |
if: matrix.package == 'archive' | |
uses: actions/download-artifact@v4 | |
with: | |
name: archive | |
path: archive/ | |
- uses: actions/setup-python@v5 | |
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 | |
if: matrix.package == 'wheel' | |
run: pip install dist/*.whl | |
- name: Install sdist | |
if: matrix.package == 'sdist' | |
run: pip install dist/*.tar.gz | |
- name: Install archive | |
if: matrix.package == 'archive' | |
run: pip install archive/archive.tgz | |
test-coverage: | |
runs-on: ubuntu-latest | |
needs: [build, download-test-data, check_skip_flags] | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Restore cached data ds000017 | |
id: cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: /home/runner/work/giga_connectome/giga_connectome/giga_connectome/data/test_data | |
key: ds000017 | |
- name: Install build dependencies | |
run: python -m pip install --upgrade pip | |
- name: Install task package | |
run: pip install -e .[test] | |
- name: Test with pytest - ignore smoke test. | |
if: ${{ !contains(needs.check_skip_flags.outputs.head-commit-message, 'full_test') }} | |
run: | | |
pytest -m "not smoke" --cov=giga_connectome --cov-report=xml --pyargs giga_connectome | |
- name: Full test - run all the test to generate accurate coverage report. | |
if: ${{ contains(needs.check_skip_flags.outputs.head-commit-message, 'full_test') }} || ${{ github.event.pull_request.merged }} | |
run: pytest --cov=giga_connectome --cov-report=xml --pyargs giga_connectome | |
- uses: codecov/codecov-action@v4 | |
if: ${{ always() }} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |