Skip to content

Commit

Permalink
Add Github Actions CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Argmaster committed Sep 3, 2023
1 parent b6676ff commit baf65ee
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 4 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build_n_deploy_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Build & Deploy Docs

on:
push:
branches:
- main

workflow_dispatch:

concurrency:
group: ${{ github.action_path }}-${{ github.ref }}-build-n-deploy-docs
cancel-in-progress: false

jobs:
run-build-n-deploy-docs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"

- name: Install Poetry
run: pip install poetry==1.5.1

- name: Install dependencies
run: poetry install --with=docs --no-cache --sync

- name: Run build & deploy documentation
run: poetry run poe run-build-n-deploy-docs
64 changes: 64 additions & 0 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: Code Quality

on:
push:
branches:
- main
- dev
- fix/**
- hotfix/**
- feature/**
- release/**
- dependabot/**

pull_request:
branches:
- main
- dev
- fix/**
- hotfix/**
- feature/**
- release/**
- dependabot/**
types:
- opened
- reopened

schedule:
- cron: 0 12 * * 6

workflow_dispatch:

concurrency:
group: ${{ github.action_path }}-${{ github.ref }}-code-quality
cancel-in-progress: false

jobs:
run-code-quality-checks:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.11"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"

- name: Install Poetry
run: pip install poetry==1.5.1

- name: Install dependencies
run: poetry install --no-cache --sync

- name: Run code quality checks with pre-commit
run: poetry run poe run-code-quality-checks
64 changes: 64 additions & 0 deletions .github/workflows/type_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: Type Checks

on:
push:
branches:
- main
- dev
- fix/**
- hotfix/**
- feature/**
- release/**
- dependabot/**

pull_request:
branches:
- main
- dev
- fix/**
- hotfix/**
- feature/**
- release/**
- dependabot/**
types:
- opened
- reopened

schedule:
- cron: 0 12 * * 6

workflow_dispatch:

concurrency:
group: ${{ github.action_path }}-${{ github.ref }}-type-checks
cancel-in-progress: false

jobs:
run-type-checks:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.11"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"

- name: Install Poetry
run: pip install poetry==1.5.1

- name: Install dependencies
run: poetry install --no-cache --sync

- name: Run type checks with mypy
run: poetry run poe run-type-checks
64 changes: 64 additions & 0 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: Unit Tests

on:
push:
branches:
- main
- dev
- fix/**
- hotfix/**
- feature/**
- release/**
- dependabot/**

pull_request:
branches:
- main
- dev
- fix/**
- hotfix/**
- feature/**
- release/**
- dependabot/**
types:
- opened
- reopened

schedule:
- cron: 0 12 * * 6

workflow_dispatch:

concurrency:
group: ${{ github.action_path }}-${{ github.ref }}-unit-tests
cancel-in-progress: false

jobs:
run-unit-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: "x64"

- name: Install Poetry
run: pip install poetry==1.5.1

- name: Install dependencies
run: poetry install --no-cache --sync

- name: Run unit tests
run: poetry run poe run-unit-tests
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,19 @@ install-hooks = [
]
# -------------
# hook triggers
pre-commit = [
{ cmd = "poetry install --sync --no-ansi" },
run-code-quality-checks = [
{ cmd = "pre-commit run --all-files -v" },
]
# -------------------------------------------------------------------------------------
test = [
run-unit-tests = [
{ cmd = "pytest --log-level=DEBUG -s -n auto --cov=pygerber --cov-report=term-missing:skip-covered" },
]
run-type-checks = [
{ cmd = "mypy src/pygerber test/ scripts/" }
]
run-build-n-deploy-docs = [
{ cmd = "mkdocs gh-deploy" }
]

[tool.isort]
profile = "black"
Expand Down Expand Up @@ -122,7 +127,6 @@ runtime-evaluated-base-classes = [
# https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html #
# ---------------------------------------------------------------------------- #
python_version = "3.8"
packages = "pygerber"
# A regular expression that matches file names, directory names and paths which
# mypy should ignore while recursively discovering files to check. Use forward
#slashes (/) as directory separators on all platforms.
Expand Down
Empty file removed scripts/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions scripts/ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extend = "../pyproject.toml"
ignore = [
"D", # Only limited docstrings are required.
]

0 comments on commit baf65ee

Please sign in to comment.