Tox #51
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: Tox | |
on: | |
push: | |
branches: | |
- main | |
- maint/* | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
- maint/* | |
schedule: | |
- cron: '0 0 * * MON' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9'] | |
shell: ['bash'] | |
include: | |
- os: 'windows-latest' | |
python-version: 3 | |
shell: 'bash' | |
- os: 'macos-latest' | |
python-version: 3 | |
shell: 'bash' | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install Tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Test | |
run: tox | |
env: | |
PLATFORM: ${{ matrix.os }} | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: 'bash' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3 | |
- run: pip install --upgrade build twine | |
- run: python -m build | |
- run: twine check dist/* | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
test-sdist: | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- name: Unpack sdist | |
run: tar xfvz dist/*.tar.gz | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3 | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install Tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Test | |
run: cd nipreps_versions-* && tox | |
env: | |
PLATFORM: ${{ matrix.os }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: [test, test-sdist] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 |