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

[Lint] Add bat version and lint CI permission #132

Merged
merged 6 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ jobs:
lint-python:
name: Lint Python
runs-on: ubuntu-latest
permissions:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I referenced from Pytorch/TensorRT setting, which is also using third-party actions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only lint-python will need to set permissions because others don't use 3p actions.

actions: write
checks: write
contents: write
deployments: none
id-token: write
issues: none
discussions: none
packages: none
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

none fields can be removed because "If you specify the access for any of these scopes, all of those that are not specified are set to none." https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one of the benefits of leaving it there is that the next person, who needs to change the permission, can see what options he/she has on this (No need to investigate again). Besides, we are not adding more lines on this. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me

pull-requests: write
repository-projects: none
security-events: none
statuses: read
steps:
- uses: actions/checkout@v2
- name: Setup Python
Expand Down
19 changes: 19 additions & 0 deletions tools/format.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
:: SPDX-License-Identifier: Apache-2.0

@echo off
:: This script helps Windows user to format the code
::before submitting the PR

for /f %%i in ('git rev-parse --show-toplevel') do set root_path=%%i
ECHO "Git Root PATH: %root_path%"
CD /D %root_path%

ECHO "\nblack reformatting..."
black . --color
ECHO "\nblack done!"

ECHO "\nisort reformatting..."
isort . --color
ECHO "\nisort done!"

PAUSE
23 changes: 23 additions & 0 deletions tools/style.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
:: SPDX-License-Identifier: Apache-2.0

@echo off
:: This script helps Windows user to check formatting
::before submitting the PR

for /f %%i in ('git rev-parse --show-toplevel') do set root_path=%%i
ECHO "Git Root PATH: %root_path%"
CD /D %root_path%

ECHO "\n::group:: ===> check flake8..."
flake8 onnxscript
ECHO "::endgroup::"

ECHO "\n::group:: ===> check isort..."
isort . --color --diff --check
ECHO "::endgroup::"

ECHO "\n::group:: ===> check black format..."
black . --color --diff --check
ECHO "::endgroup::"

PAUSE
19 changes: 19 additions & 0 deletions tools/style_optional.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
:: SPDX-License-Identifier: Apache-2.0

@echo off
:: This script helps Windows user to check formatting
::before submitting the PR

for /f %%i in ('git rev-parse --show-toplevel') do set root_path=%%i
ECHO "Git Root PATH: %root_path%"
CD /D %root_path%

ECHO "\n::group:: ===> check pylint"
pylint onnxscript
ECHO "::endgroup::"

ECHO "\n::group:: ===> check mypy"
mypy onnxscript --config-file pyproject.toml
ECHO "::endgroup::"

PAUSE