mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 07:04:32 +02:00
github: verify pre-commit checks for PRs in Github Actions
This commit is contained in:
33
.github/workflows/pre_commit_check.yml
vendored
Normal file
33
.github/workflows/pre_commit_check.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Check pre-commit rules
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre_commit_check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Fetch head and base refs
|
||||||
|
# This is necessary for pre-commit to check the changes in the PR branch
|
||||||
|
run: |
|
||||||
|
git fetch origin ${GITHUB_BASE_REF}
|
||||||
|
git fetch origin ${GITHUB_HEAD_REF}
|
||||||
|
- name: Set up Python environment
|
||||||
|
uses: actions/setup-python@master
|
||||||
|
with:
|
||||||
|
python-version: v3.7
|
||||||
|
- name: Install python packages
|
||||||
|
run: |
|
||||||
|
pip install pre-commit
|
||||||
|
pre-commit install-hooks
|
||||||
|
- name: Run pre-commit and check for any changes
|
||||||
|
run: |
|
||||||
|
if ! pre-commit run --from-ref "origin/${GITHUB_BASE_REF}" --to-ref "origin/${GITHUB_HEAD_REF}" --show-diff-on-failure ; then
|
||||||
|
echo ""
|
||||||
|
echo "::notice::It looks like the commits in this PR have been made without having pre-commit hooks installed."
|
||||||
|
echo "::notice::Please see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/contribute/install-pre-commit-hook.html for instructions."
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
27
.github/workflows/python_lint.yml
vendored
27
.github/workflows/python_lint.yml
vendored
@@ -1,27 +0,0 @@
|
|||||||
name: Python CI
|
|
||||||
|
|
||||||
# This workflow will be triggered when a PR modifies some python relevant files
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- "**.py"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
python_lint:
|
|
||||||
name: python lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
- name: Set up Python environment
|
|
||||||
uses: actions/setup-python@master
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
- name: Lint with flake8
|
|
||||||
run: |
|
|
||||||
pip install flake8
|
|
||||||
flake8 . --config=.flake8 --benchmark
|
|
Reference in New Issue
Block a user