Skip to content

Commit

Permalink
update CI action to enforce hooks (#277)
Browse files Browse the repository at this point in the history
* update CI action to enforce hooks

* update action
  • Loading branch information
manulera committed Oct 8, 2024
1 parent 31b3322 commit 09199a9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 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,28 @@ jobs:
- name: 🔎 poetry run python run_test.py
run: poetry run python run_test.py

# Enforce pre-commit hooks ===========================
- name: Get changed files
if: (matrix.codecov)
id: changed-files
uses: tj-actions/changed-files@v45

- uses: actions/cache@v4
if: (matrix.codecov)
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: (matrix.codecov) && (steps.cache-precommit.outputs.cache-hit != 'true')
run: poetry run pre-commit install --install-hooks

- name: Run style checking via pre-commit
if: (matrix.codecov)
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 09199a9

Please sign in to comment.