ci: add python versions to matrix #89
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: | |
push: | |
branches: [ master ] | |
tags: [ '*' ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install build setuptools_scm wheel | |
- name: Build | |
run: | | |
python -m build | |
- name: Upload dist | |
if: github.repository == 'westerndigitalcorporation/pyvcd' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pyvcd-dist | |
path: "dist/*" | |
publish: | |
if: github.repository == 'westerndigitalcorporation/pyvcd' | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pyvcd | |
permissions: | |
id-token: write | |
steps: | |
- name: Retrieve package | |
uses: actions/download-artifact@v4 | |
with: | |
name: pyvcd-dist | |
path: "dist" | |
- name: Display dist files | |
run: ls -Rl | |
# - name: Test Publish package | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# repository-url: https://test.pypi.org/legacy/ | |
- name: Publish package | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.7' | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
- '3.13' | |
- 'pypy-3.7' | |
- 'pypy-3.9' | |
- 'pypy-3.10' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install -e . -r requirements.txt | |
- name: Test | |
run: | | |
make test | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install -e . -r requirements.txt | |
- name: Lint | |
run: | | |
make lint | |
coverage: | |
if: github.repository == 'westerndigitalcorporation/pyvcd' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install -e . -r requirements.txt coveralls | |
- name: Coverage | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
make coverage && coveralls |