Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull in some GitHub Actions.
Browse files Browse the repository at this point in the history
tdilauro committed Mar 6, 2024
1 parent d1030df commit 692848d
Showing 4 changed files with 97 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/actions/poetry/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Poetry'
description: 'Install python poetry'

inputs:
version:
description: "Version of poetry to install"
required: false
default: "1.6.1"

outputs:
version:
description: "Installed version"
value: ${{ steps.poetry-version.outputs.version }}

runs:
using: "composite"
steps:
- run: |
curl -sSL https://install.python-poetry.org | python - --yes --version ${{ inputs.version }}
echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- id: poetry-version
run: echo "version=$(poetry --version)" >> $GITHUB_OUTPUT
shell: bash
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Lint
on: [push, pull_request]
env:
PYTHON_VERSION: "3.10"

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
uses: ./.github/actions/poetry

- name: Install Pre-commit
run: |
poetry install --only ci
env:
POETRY_VIRTUALENVS_CREATE: false

- name: Restore pre-commit cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: pre-commit-${{ runner.os }}-py${{ env.PYTHON_VERSION }}

- name: Lint
run: pre-commit run --all-files --show-diff-on-failure
31 changes: 31 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Mypy (Type check)
on: [push, pull_request]
env:
PYTHON_VERSION: "3.10"

jobs:
mypy:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Python 🐍
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry 🎸
uses: ./.github/actions/poetry

- name: Install OS Packages 🧰
run: |
sudo apt-get update
- name: Install Python Packages 📦
run: poetry install --without ci

- name: Run MyPy 🪄
run: poetry run mypy
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -33,9 +33,11 @@ rich = "^13.7.1"
typer = "^0.9.0"
typing_extensions = {version = "^4.9.0", python = "<3.11"}

[tool.poetry.group.ci.dependencies]
pre-commit = "^3.6.1"

[tool.poetry.group.dev.dependencies]
mypy = "^1.8.0"
pre-commit = "^3.6.1"
types-pytz = "^2024.1.0.20240203"

[tool.poetry.scripts]

0 comments on commit 692848d

Please sign in to comment.