Skip to content

Commit

Permalink
update CI action to enforce hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
manulera committed Oct 3, 2024
1 parent de1fd17 commit 44c16a7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/pydna_test_and_coverage_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ jobs:
- name: 🔎 poetry run python run_test.py
run: poetry run python run_test.py

# Enforce pre-commit hooks ===========================
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45

- uses: actions/cache@v4
id: cache-precommit
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-precommit-hooks-v2-${{ hashFiles('**/.pre-commit-config.yaml') }}

- name: Installing pre-commit hooks (cached)
if: steps.cache-precommit.outputs.cache-hit != 'true'
run: poetry run pre-commit install --install-hooks

- name: Run style checking via pre-commit
run: poetry run pre-commit run --files ${{ steps.changed-files.outputs.all_changed_files }}
# ======================================================

- name: 🔼 Upload coverage to Codecov
if: (matrix.codecov)
uses: codecov/[email protected]
Expand Down

0 comments on commit 44c16a7

Please sign in to comment.