Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: pre-commit action
on:
pull_request:
# Run on merge to main because caches are inherited from parent branches
push:
branches:
- main
env:
# This should be the default but we'll be explicit
PRE_COMMIT_HOME: ~/.caches/pre-commit
PYTHON_VERSION: "3.9"
jobs:
the_job:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Bootstrap poetry
shell: bash
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry
- name: Configure poetry
shell: bash
run: |
python -m poetry config virtualenvs.in-project true
- name: Cache Poetry dependencies
uses: actions/cache@v3
id: poetry-cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
shell: bash
if: steps.poetry-cache.outputs.cache-hit != 'true'
run: |
python -m poetry install
- name: Install Pre-Commit
shell: bash
run: |
python -m pip install pre-commit
- name: Cache Pre-Commit Hooks
id: pre-commit-cache
uses: actions/cache@v3
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: hooks-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install Pre-Commit Hooks
shell: bash
if: steps.pre-commit-cache.outputs.cache-hit != 'true'
run: |
pre-commit install-hooks
- name: Run Pre-Commit Hooks
shell: bash
run: |
pre-commit run --all-files
46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: unit test action
on:
pull_request:
# Run on merge to main because caches are inherited from parent branches
push:
branches:
- main
env:
# This should be the default but we'll be explicit
PYTHON_VERSION: "3.9"
jobs:
the_job:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Bootstrap poetry
shell: bash
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry
- name: Configure poetry
shell: bash
run: |
python -m poetry config virtualenvs.in-project true
- name: Cache Poetry dependencies
uses: actions/cache@v3
id: poetry-cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
shell: bash
if: steps.poetry-cache.outputs.cache-hit != 'true'
run: |
python -m poetry install
- name: Run Unit Tests
shell: bash
run: |
poetry run python -m unittest discover --verbose tests
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Custom
.vscode
.idea

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -127,3 +131,6 @@ dmypy.json

# Pyre type checker
.pyre/

.fake
sqlsynthgen/config.ini
55 changes: 55 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/markdownlint/markdownlint
# Note the "v"
rev: v0.11.0
hooks:
- id: markdownlint
args: [--style=mdl_style.rb]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.4
hooks:
- id: shellcheck
- repo: local
hooks:
- id: black
name: Black
entry: poetry run black
language: system
types: ['python']
exclude: (?x)(
star|
tests/examples
)
- id: isort
name: isort
entry: poetry run isort
language: system
types: ['python']
exclude: (?x)(
star|
tests/examples
)
- id: pylint
name: Pylint
entry: poetry run pylint
language: system
types: ['python']
- id: mypy
name: mypy
entry: poetry run mypy --follow-imports=silent
language: system
exclude: (?x)(
star|
tests/examples
)
types: ['python']
Loading