Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] add pre-commit workflows #44

Merged
merged 6 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
interval: monthly
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 15 additions & 0 deletions .github/workflows/run_precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
48 changes: 48 additions & 0 deletions .github/workflows/update_precommit_hooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Update precommit hooks


on:

# Uses the cron schedule for github actions
#
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
#
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
schedule:
- cron: 0 0 * * 1 # every monday
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
update_precommit_hooks:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install pre-commit
run: pip install pre-commit
- name: Update pre-commit hooks
run: pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: pre-commit hooks auto-update
base: main
token: ${{ secrets.GITHUB_TOKEN }}
delete-branch: true
title: '[BOT] update pre-commit hooks'
body: update pre-commit hooks
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ manual: ## create pdf of the doc
.PHONY: lint coverage

lint: ## lint and checks matlab code
mh_style --fix && mh_metric --ci && mh_lint
pip install pre-commit
pre-commit install
pre-commit run -a
Remi-Gau marked this conversation as resolved.
Show resolved Hide resolved

coverage: run_tests.m ## runs tests and display coverage
$(MATLAB) $(MATLAB_ARG) -r "run_tests; exit()"
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# linting
miss_hit
pre-commit

# doc
Expand Down
Loading