Merge pull request #48 from secondlife/signal/scm-wo-semver #163
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: CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
tags: [v*.*.*] | |
jobs: | |
build: | |
name: Test & Build | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.11"] | |
include: | |
- os: ubuntu-latest | |
python-version: "3.7" | |
- os: ubuntu-latest | |
python-version: "3.8" | |
- os: ubuntu-latest | |
python-version: "3.9" | |
- os: ubuntu-latest | |
python-version: "3.10" | |
env: | |
OS: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch all history for setuptools_scm to be able to read tags | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install python dependencies | |
run: pip install .[dev,build] | |
- name: Run tests | |
shell: bash | |
run: | | |
# Set up git user for git command to work with tests | |
git config --global user.name "tests" | |
git config --global user.email "[email protected]" | |
pytest -v --cov=autobuild --cov-report=xml tests/ | |
- name: Build python package | |
run: python -m build | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
env_vars: OS | |
- uses: actions/upload-artifact@v4 | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
with: | |
name: dist | |
path: dist | |
publish: | |
name: Publish to PyPI | |
needs: build | |
runs-on: [ubuntu-latest] | |
permissions: | |
id-token: write | |
if: github.event_name != 'pull_request' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Test Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: startsWith(github.event.ref, 'refs/tags/v') |