Skip to content

Commit

Permalink
chore: set up Github linting and type checking hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
eloy-encord committed Feb 15, 2024
1 parent ec17711 commit d6574f0
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/actions/setup-poetry-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Setup test environment"
description: "Sets up Python, Poetry and dependencies"

inputs:
python:
description: "Python version to use"
default: "3.11"
required: false
poetry:
description: "Poetry version to use"
default: 1.7.1
required: false

runs:
using: "composite"

steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}

- uses: snok/install-poetry@v1
with:
version: ${{ inputs.poetry }}
virtualenvs-create: true
virtualenvs-in-project: 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') }}

- if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry lock --no-update
poetry install --no-interaction
shell: bash
23 changes: 23 additions & 0 deletions .github/workflows/pr-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: PR Report

on:
pull_request:
branches:
- main
workflow_dispatch:

env:
PYTHON_VERSION: 3.11

jobs:
pre-commit:
name: Linting and type checking
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup poetry environment
uses: ./.github/actions/setup-poetry-environment
- name: Run linting, type checking and testing
uses: pre-commit/[email protected]
with:
extra_args: "--all-files --hook-stage=push"

0 comments on commit d6574f0

Please sign in to comment.