Skip to content

Commit

Permalink
CI/CD stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofix committed Dec 22, 2024
1 parent 5041701 commit 9f53a57
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 3 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/new_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: New Release

on:
release:
types: [published]

permissions:
contents: write

jobs:
crosscheck:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install the project
run: uv sync --all-extras --dev

- name: Tests
run: pytest -sv

docs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
poetry-version: ["1.8.3"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: crosscheck
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set Up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Setup Latest Poetry
run: pipx install --suffix @main 'poetry @ git+https://github.com/python-poetry/poetry'
- name: Install django-payments-chile
run: poetry@main install --all-extras --all-groups
- name: Deploy Docs
run: poetry@main run mkdocs gh-deploy --force

pypi-publish:
name: Build and Upload
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
poetry-version: ["1.8.3"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: crosscheck
environment:
name: pypi
url: https://pypi.org/p/khipu-tools
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Set Up Poetry
uses: abatilo/actions-poetry@v3
- name: Setup Latest Poetry
run: pipx install --suffix @main 'poetry @ git+https://github.com/python-poetry/poetry'
- name: Install khipu-tools
run: poetry@main install --all-extras --all-groups
- name: Build khipu-tools
run: poetry@main build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
54 changes: 54 additions & 0 deletions .github/workflows/tests_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Tests & Coverage

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
name: build (Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix:
python-version: ["3.9", "3.10", "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 }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ matrix.python-version }}-v1-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions .[dev]
- name: Tests
run: pytest -sv

- name: Coverage report (xml)
run: coverage xml
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: "coverage.xml"
language: "python"
34 changes: 31 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
[project]
name = "khipu-tools"
version = "2024.12.1"
version = "2024.12.4"
description = "Set de herramientas para operar con la APIv3 de Khipu"
readme = "README.md"
requires-python = ">=3.9"
license = { text = "MIT" }
authors = [{ name = "Mario Hernandez", email = "[email protected]" }]
classifiers = [
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down Expand Up @@ -42,4 +41,33 @@ dev = [
"black>=24.10.0",
"mkdocs-material>=9.5.49",
"mkdocstrings[python]>=0.27.0",
"pytest>=8.3.4",
"coverage>=7.6.9",
"pytest>=8.3.4",
"pytest-cov>=6.0.0",
]


[tool.black]
line-length = 119
target-version = ["py39"]

[tool.isort]
profile = "black"
line_length = 119
multi_line_output = 5
py_version = 39


[tool.coverage.report]
exclude_lines = ["if TYPE_CHECKING:", "# noqa", "# nosec"]

[tool.pytest.ini_options]
addopts = [
"--cov=khipu_tools",
"--cov-report=term-missing:skip-covered",
"--no-cov-on-fail",
"--color=yes",
]
testpaths = "tests"
pythonpath = "."
5 changes: 5 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from khipu_tools._version import VERSION


def test_version():
assert VERSION == "2024.12.4"

0 comments on commit 9f53a57

Please sign in to comment.