Skip to content

Commit

Permalink
add CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
pkucmus committed Mar 28, 2024
1 parent 622822d commit a830792
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Code Quality

on: [push]

jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
env:
COVERAGE: 90
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml

- name: Install Poetry
uses: snok/[email protected]
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-1.7.1-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install library
run: poetry install --no-interaction

# - name: Check coverage
# run: poetry run pytest --cov=smyth --cov-fail-under=${{ env.COVERAGE }} src

- name: mypy
run: poetry run mypy src
Ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- name: Ruff Check
uses: jpetrucciani/ruff-check@main
with:
path: "."
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: release

on:
release:
types:
- published

env:
STABLE_PYTHON_VERSION: '3.12'
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version-file: pyproject.toml

- name: Install Poetry
uses: snok/[email protected]
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true

- name: Build package
run: poetry build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@ description = ""
authors = ["Mirumee <[email protected]>"]
readme = "README.md"
packages = [{include = "smyth", from = "src"}]
license = "MIT"
license = "BSD-3-Clause"
repository = "https://github.com/mirumee/smyth"
classifiers = [
"Programming Language :: Python",
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development",
]

[tool.poetry.dependencies]
python = "^3.12"
Expand Down

0 comments on commit a830792

Please sign in to comment.