-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd2413e
commit 35c5389
Showing
5 changed files
with
74 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: AutoFormat | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
autotest: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python version | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install poetry | ||
uses: abatilo/actions-poetry@v2 | ||
|
||
- name: Setup a local virtual environment | ||
run: | | ||
poetry config virtualenvs.create true --local | ||
poetry config virtualenvs.in-project true --local | ||
- uses: actions/cache@v3 | ||
name: Define a cache for the virtual environment based on the dependencies lock file | ||
with: | ||
path: ./.venv | ||
key: venv-${{ hashFiles('poetry.lock') }} | ||
|
||
- name: Install the project dependencies | ||
run: poetry install | ||
|
||
- name: Auto format | ||
run: bash autoformat.sh | ||
|
||
- name: Run flake8 | ||
run: poetry run flake8 . | ||
|
||
- name: Run mypy | ||
run: poetry run mypy . | ||
|
||
- uses: actions-go/push@master | ||
with: | ||
commit-message: 'style: 自动格式化代码' | ||
remote: origin |
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 @@ | ||
autoflake -i --remove-unused-variables --remove-duplicate-keys --remove-all-unused-imports --ignore-init-module-imports --remove-rhs-for-unused-variables **/*.py | ||
poetry run autopep8 -i **/*.py | ||
poetry run autoflake -i --remove-unused-variables --remove-duplicate-keys --remove-all-unused-imports --ignore-init-module-imports --remove-rhs-for-unused-variables **/*.py | ||
poetry run isort . |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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