From 144fe3b26a8355dc06c1fa9198ce5831a3c22369 Mon Sep 17 00:00:00 2001 From: abel Date: Tue, 19 Sep 2023 10:46:38 -0300 Subject: [PATCH] (feat) Added GitHub workflow to run pre-commit checks for pushes to master and dev --- .github/workflows/pre-commit.yml | 35 ++++++++++++++++++++++++++++++++ poetry.toml | 3 +++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 poetry.toml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..c7cf58d8 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,35 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [master, dev] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install Python + uses: actions/setup-python@v3 + - name: Install poetry + run: python -m pip install poetry + + - name: Configure poetry + run: python -m poetry config virtualenvs.in-project true + + - name: Cache the virtualenv + id: cache-venv + uses: actions/cache@v3 + with: + path: ./.venv + key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + if: steps.cache-venv.outputs.cache-hit != 'true' + run: python -m poetry install + + - name: Run pre-commit + run: pre-commit run --show-diff-on-failure --color=always --all-files + shell: bash diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 00000000..53b35d37 --- /dev/null +++ b/poetry.toml @@ -0,0 +1,3 @@ +[virtualenvs] +create = true +in-project = true