Skip to content

Commit

Permalink
✨ test all current Python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
enryH committed Nov 28, 2024
1 parent a6711b9 commit b14c30d
Showing 1 changed file with 40 additions and 41 deletions.
81 changes: 40 additions & 41 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ name: Python application
on:
push:
pull_request:
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '0 2 * * 3'
- cron: "0 2 * * 3"

permissions:
contents: read


jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
- uses: psf/black@stable
lint:
name: Lint with ruff
runs-on: ubuntu-latest
Expand All @@ -30,9 +29,9 @@ jobs:
with:
python-version: "3.11"
- name: Install ruff
run: |
run: |
pip install ruff
- name: Lint with ruff
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
ruff check .
Expand All @@ -41,43 +40,43 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
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 }}
cache: 'pip' # caching pip dependencies
cache-dependency-path: '**/pyproject.toml'
cache: "pip" # caching pip dependencies
cache-dependency-path: "**/pyproject.toml"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .
- name: Run tests
run: python -m pytest tests

build_source_dist:
name: Build source distribution
if: startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install build
run: python -m pip install build
- name: Install build
run: python -m pip install build

- name: Run build
run: python -m build --sdist
- name: Run build
run: python -m build --sdist

- uses: actions/upload-artifact@v4
with:
path: ./dist/*.tar.gz
- uses: actions/upload-artifact@v4
with:
path: ./dist/*.tar.gz
# Needed in case of building packages with external binaries (e.g. Cython, RUst-extensions, etc.)
# build_wheels:
# name: Build wheels on ${{ matrix.os }}
Expand Down Expand Up @@ -105,23 +104,23 @@ jobs:
# path: ./wheels/*.whl

publish:
name: Publish package
if: startsWith(github.ref, 'refs/tags')
needs:
- format
- lint
- test
- build_source_dist
# - build_wheels
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: ./dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
name: Publish package
if: startsWith(github.ref, 'refs/tags')
needs:
- format
- lint
- test
- build_source_dist
# - build_wheels
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: ./dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit b14c30d

Please sign in to comment.