Skip to content

📝 Docs: Replace svg by png logo on README #24

📝 Docs: Replace svg by png logo on README

📝 Docs: Replace svg by png logo on README #24

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: ["main"]
tags:
- '*'
pull_request:
branches: ["main"]
permissions:
contents: read
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
src: src tests
lint:
name: Lint with ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install ruff
run: |
pip install ruff
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
ruff check src
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
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"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .
- name: Run tests
run: python -m pytest -vvv
build_source_dist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build
run: python -m pip install build
- name: Run build
run: python -m build --sdist
- uses: actions/upload-artifact@v4
with:
path: ./dist/*.tar.gz
publish:
name: Publish package
if: startsWith(github.ref, 'refs/tags')
needs:
- format
#- lint todo fix errors
- test
- build_source_dist
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: ./dist
- uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
permissions:
id-token: write