From 86295dd0da2677d3073194ec4e6475b06c7bc187 Mon Sep 17 00:00:00 2001 From: Zaran Lalvani Date: Mon, 7 Oct 2024 01:07:44 -0400 Subject: [PATCH] build: github actions (#66) --- .github/workflows/pyright.yml | 34 ++++++++++++++++++++++++++++++++++ .github/workflows/ruff.yml | 12 ++++++++++++ .pre-commit-config.yaml | 5 +++++ 3 files changed, 51 insertions(+) create mode 100644 .github/workflows/pyright.yml create mode 100644 .github/workflows/ruff.yml diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml new file mode 100644 index 0000000..71bbfaf --- /dev/null +++ b/.github/workflows/pyright.yml @@ -0,0 +1,34 @@ +name: Build +on: + pull_request: + types: [opened, edited, reopened, synchronize] + branches: + - main +jobs: + pyright: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up python + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + virtualenvs-path: .venv + installer-parallel: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction + - name: Run Pyright + run: poetry run pyright diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..2bfe181 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,12 @@ +name: Lint +on: + pull_request: + types: [opened, edited, reopened, synchronize] + branches: + - main +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80bd96b..f609aa5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,9 @@ repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.6.9