Tox #512
This file contains hidden or 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: | |
- master | |
- maint/* | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
- maint/* | |
schedule: | |
- cron: '0 0 * * MON' | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest'] | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.9', 'pypy3.10'] | |
shell: ['bash'] | |
include: | |
- os: 'windows-latest' | |
python-version: '3.10' | |
shell: 'bash' | |
- os: 'windows-latest' | |
python-version: '3.10' | |
shell: 'pwsh' | |
- os: 'windows-latest' | |
python-version: '3.10' | |
shell: 'cmd' | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
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: 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 }} | |
bootstrap: | |
# Couldn't figure out how to do this in tox | |
# Need to make sure that versioneer can build itself from source without fetching | |
# old versioneer wheels from PyPI | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: 'bash' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3 | |
- run: "pip install --no-binary :all: ." | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: 'bash' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3 | |
- run: pip install --upgrade build twine | |
- run: python -m build | |
- run: twine check dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
test-sdist: | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Unpack sdist | |
run: tar xfvz dist/versioneer-*.tar.gz | |
- uses: actions/setup-python@v5 | |
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 versioneer-* && tox | |
env: | |
PLATFORM: ${{ matrix.os }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: [bootstrap, test, test-sdist] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |