forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup pre-commit setup (streamlit#9856)
## Describe your changes This PR applies a couple of improvements & cleanups related to pre-commit: - Remove pre commit install from shared `make_init` action. - Move enforcement of pre-commit rules from `js-tests` to dedicated workflow (takes < 1 min) -> missing license headers in python files will not cause the js-tests workflow to fail anymore. - Use make commands in js-tests workflow - Remove eslint, typecheck-app, typecheck-lib from pre-commit since these checks are not actually run as part of the normal pre-commit. - Update versions in pre-commit config. - Add some additional pre-commit checks: check-json, check-yaml, check-toml, check-added-large-files. - Fix some json / yml issues. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
- Loading branch information
1 parent
048aaa5
commit a5e3afb
Showing
10 changed files
with
81 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Enforce Pre-Commit Hooks | ||
|
||
on: | ||
push: | ||
branches: | ||
- "develop" | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
# Allows workflow to be called from other workflows | ||
workflow_call: | ||
inputs: | ||
ref: | ||
required: true | ||
type: string | ||
|
||
# Avoid duplicate workflows on same branch | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-enforce-pre-commit | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
enforce-pre-commit: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
steps: | ||
- name: Checkout Streamlit code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
persist-credentials: false | ||
submodules: "recursive" | ||
fetch-depth: 2 | ||
- name: Set Python version vars | ||
uses: ./.github/actions/build_info | ||
- name: Set up Python ${{ env.PYTHON_MAX_VERSION }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "${{ env.PYTHON_MAX_VERSION }}" | ||
- name: Restore pre-commit cache | ||
id: cache-pre-commit | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: v1-pre-commit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }} | ||
- name: Install pre-commit | ||
run: | | ||
pip install pre-commit | ||
pre-commit install-hooks | ||
shell: bash | ||
- name: Install prettier | ||
run: cd frontend && yarn install | ||
- name: Run pre-commit hooks | ||
run: PRE_COMMIT_NO_CONCURRENCY=true pre-commit run --show-diff-on-failure --color=always --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
vendor | ||
lib/src/proto.d.ts | ||
lib/src/proto.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"paths": { "@streamlit/lib/src/*": ["src/*"] } | ||
}, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters