From 58ddf3dbaf9b4fe6808a5aba01de2ce733efcc50 Mon Sep 17 00:00:00 2001 From: Julieanna Bacon Date: Wed, 14 Feb 2024 20:07:17 -0500 Subject: [PATCH] CI: Adding CI check for linted files. If a PR is open with code that is not compliant with the linters, it will fail this status check. Please see comments in workflow or docs/setup.md for how to ensure your linters are installed and running on commit (#4) bugfix: Known issue in pre-commit with not found python interpreter, changing language version in precommit config file to reflect python version used for CI CI check: This commit should fail the CI linter check as it's not ruff-compliant CI: Undoing the demonstration for the CI linter check --- .github/workflows/linter_check.yaml | 33 +++++++++++++++++++++++++++++ .pre-commit-config.yaml | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/linter_check.yaml diff --git a/.github/workflows/linter_check.yaml b/.github/workflows/linter_check.yaml new file mode 100644 index 0000000..661de59 --- /dev/null +++ b/.github/workflows/linter_check.yaml @@ -0,0 +1,33 @@ +name: Code Style Check +# If your code has failed this workflow, you need to install the pre-commit hooks and run `pixi run pre-commit run --all-files`, adding and committing those changes. +# Please see docs/setup.md for more information on installing and what the committing process looks like. + +on: + push: + branches: + - main + pull_request: + types: + - opened + - synchronize + +env: + PYTHON_VERSION: "3.10" + +jobs: + Check-linter-status: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit hooks + run: pre-commit run --all-files --show-diff-on-failure diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 891d4c4..746c84e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: # supported by your project here, or alternatively use # pre-commit's default_language_version, see # https://pre-commit.com/#top_level-default_language_version - language_version: python3.11 + language_version: python3.10 - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: