Skip to content

Commit

Permalink
Merge pull request #4 from baluyotraf/feature/ci
Browse files Browse the repository at this point in the history
Setup github actions
  • Loading branch information
baluyotraf authored Mar 21, 2024
2 parents bff36fa + 57719d1 commit 06b89fa
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 24 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: qa

on:
push:
branches:
- main
pull_request:

jobs:
lint-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key:
pre-commit-3|${{ env.pythonLocation }}|${{
hashFiles('.pre-commit-config.yaml') }}
- uses: abatilo/actions-poetry@v2
- run: python -m pip install pre-commit
- run: poetry install
- run:
poetry run pre-commit run --show-diff-on-failure --color=always --all
test:
needs: lint-format
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python_version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- uses: abatilo/actions-poetry@v2
- run: python -m pip install tox-gh>=1.2
- run: poetry install --no-root && poetry run tox
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: qa

on:
push:
tags:
- v*

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- uses: abatilo/actions-poetry@v2
- run: git fetch origin gh-pages --depth=1
- run: poetry install --with docs
- run: poetry run mike deploy ${{ github.ref_name }} stable

publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- uses: abatilo/actions-poetry@v2
- run: poetry build
- run: poetry publish --dry-run
- run: poetry publish
45 changes: 23 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
- id: prettier
args: [--prose-wrap, always]
types_or: [ markdown ]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
- id: prettier
args: [--prose-wrap, always]
types_or: [markdown, yaml]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.354
hooks:
- id: pyright
language: system
types: [python]
- repo: local
hooks:
- id: pyright
name: pyright
entry: pyright
language: system
types: [python]
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ plugins:
- search
- social


markdown_extensions:
- pymdownx.superfences
- pymdownx.highlight:
Expand Down
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,19 @@ legacy_tox_ini = """
min_version = 4.0
env_list = py{39,310,311,312}
[gh]
python =
3.12 = py312
3.11 = py311
3.10 = py310
3.9 = py39
[testenv]
description = run the tests with pytest
allowlist_externals =
poetry
commands_pre =
poetry install
poetry install --no-root
commands =
pytest tests
"""
Expand Down

0 comments on commit 06b89fa

Please sign in to comment.