-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add Python CI #2
Open
JaeAeich
wants to merge
13
commits into
main
Choose a base branch
from
python
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9fee731
feat: python ci
JaeAeich c20ade4
fix variables
JaeAeich 41da7d0
add test ci
JaeAeich 3c7bd44
vul
JaeAeich 7d699d8
docs check so that each pr has uptodate docs
JaeAeich f38e181
format
JaeAeich b2b2861
remove spell checker
JaeAeich 9b45748
feat: add commenting functionality
JaeAeich ff60c28
format
JaeAeich 1c51094
extend poetry action to accept list of deps
JaeAeich 3acfc37
extend comments
JaeAeich fa86ba3
fix comment and yamllimt
JaeAeich 0bb6ff2
add closing yaml tags
JaeAeich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,15 @@ | ||
--- | ||
extends: default | ||
|
||
rules: | ||
# Rule to enforce the use of double quotes | ||
quoted-strings: | ||
quote-type: double | ||
required: false | ||
# Additional rules can be configured as needed | ||
line-length: | ||
max: 120 | ||
indentation: | ||
spaces: 2 | ||
document-start: disable | ||
... |
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,89 @@ | ||
--- | ||
name: Format Code | ||
description: Checks and ensures the code is formatted according to the defined | ||
style guidelines. | ||
|
||
inputs: | ||
os: | ||
description: The operating system to use | ||
default: ubuntu-latest | ||
required: false | ||
python_version: | ||
description: Python version to use | ||
default: "3.12" | ||
required: false | ||
poetry_install_options: | ||
description: Options for installing dependencies via poetry | ||
required: false | ||
default: "--only=code_quality --no-root" | ||
poetry_export_options: | ||
description: Options for exporting dependencies to check for hash | ||
changes for cache invalidation | ||
required: false | ||
default: "--only=code_quality" | ||
uniqueg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
uses: elixir-cloud-aai/actions/python/setup/poetry@main | ||
id: setup | ||
continue-on-error: true | ||
with: | ||
os: ${{ inputs.os }} | ||
python_version: ${{ inputs.python_version }} | ||
poetry_install_options: ${{ inputs.poetry_install_options }} | ||
poetry_export_options: ${{ inputs.poetry_export_options }} | ||
|
||
- name: Comment on PR | ||
if: steps.setup.outcome == 'failure' | ||
uses: elixir-cloud-aai/actions/github/comment@main | ||
with: | ||
ci_name: format | ||
step_name: setup | ||
commit_id: ${{ github.sha }} | ||
issue-number: ${{ github.event.number }} | ||
username: ${{ github.actor}} | ||
message: | | ||
Check your `pyproject.toml` and the dependency groups in them, | ||
especially the `code_quality` group. | ||
|
||
<details> | ||
<summary>Env used for CI</summary> | ||
OS: ${{ inputs.os }} | ||
Python Version: ${{ inputs.python_version }} | ||
Poetry Install Options: ${{ inputs.poetry_install_options }} | ||
Poetry Export Options: ${{ inputs.poetry_export_options }} | ||
</details> | ||
|
||
- name: Check code style | ||
id: format | ||
continue-on-error: true | ||
shell: bash | ||
run: poetry run ruff format --check | ||
|
||
- name: Comment on PR | ||
if: steps.format.outcome == 'failure' | ||
uses: elixir-cloud-aai/actions/github/comment@main | ||
with: | ||
ci_name: format | ||
step_name: format | ||
commit_id: ${{ github.sha }} | ||
issue-number: ${{ github.event.number }} | ||
username: ${{ github.actor}} | ||
message: | | ||
With the environment set up and dependencies installed, | ||
run `poetry run ruff format` to check and fix some code style issues. | ||
|
||
<details> | ||
<summary>Use Makefile command</summary> | ||
Default makefile from cookiecutter template has a command | ||
`make fl` to run the check. | ||
|
||
Run make in the root directory of the project, to see all the | ||
available commands. | ||
</details> | ||
... |
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,86 @@ | ||
--- | ||
name: Lint Code | ||
description: Lints the code to ensure code quality and adherence to standards. | ||
|
||
inputs: | ||
os: | ||
description: The operating system to use | ||
default: ubuntu-latest | ||
required: false | ||
python_version: | ||
description: Python version to use | ||
default: "3.12" | ||
required: false | ||
poetry_install_options: | ||
description: Options for installing dependencies via poetry | ||
required: false | ||
default: "--only=code_quality --no-root" | ||
poetry_export_options: | ||
description: Options for exporting dependencies to check for hash | ||
changes for cache invalidation | ||
required: false | ||
default: "--only=code_quality" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
uses: elixir-cloud-aai/actions/python/setup/poetry@main | ||
continue-on-error: true | ||
with: | ||
os: ${{ inputs.os }} | ||
python_version: ${{ inputs.python_version }} | ||
poetry_install_options: ${{ inputs.poetry_install_options }} | ||
poetry_export_options: ${{ inputs.poetry_export_options }} | ||
|
||
- name: Comment on PR | ||
if: steps.setup.outcome == 'failure' | ||
uses: elixir-cloud-aai/actions/github/comment@main | ||
with: | ||
ci_name: lint | ||
step_name: setup | ||
commit_id: ${{ github.sha }} | ||
issue-number: ${{ github.event.number }} | ||
username: ${{ github.actor}} | ||
message: | | ||
Check your `pyproject.toml` and the dependency groups in them. | ||
|
||
<details> | ||
<summary>Env used for CI</summary> | ||
OS: ${{ inputs.os }} | ||
Python Version: ${{ inputs.python_version }} | ||
Poetry Install Options: ${{ inputs.poetry_install_options }} | ||
Poetry Export Options: ${{ inputs.poetry_export_options }} | ||
</details> | ||
|
||
- name: Check code quality | ||
shell: bash | ||
id: lint | ||
run: poetry run ruff check . | ||
|
||
- name: Comment on PR | ||
if: steps.lint.outcome == 'failure' | ||
uses: elixir-cloud-aai/actions/github/comment@main | ||
with: | ||
ci_name: format | ||
step_name: format | ||
commit_id: ${{ github.sha }} | ||
issue-number: ${{ github.event.number }} | ||
username: ${{ github.actor}} | ||
message: | | ||
With the environment set up and dependencies installed, | ||
run `poetry run ruff check --fix` to check and fix some lint | ||
issues. | ||
|
||
<details> | ||
<summary>Use Makefile command</summary> | ||
Default makefile from cookiecutter template has a command | ||
`make fl` to run the check. | ||
|
||
Run make in the root directory of the project, to see all the | ||
available commands. | ||
</details> | ||
... |
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,115 @@ | ||
--- | ||
name: Type Check | ||
description: Runs a type check on the codebase to ensure type safety and | ||
correctness. | ||
|
||
inputs: | ||
os: | ||
description: The operating system to use | ||
required: false | ||
default: "ubuntu-latest" | ||
python_version: | ||
description: Python version to use | ||
default: "3.12" | ||
required: false | ||
poetry_install_options: | ||
description: Options for installing dependencies via poetry | ||
required: false | ||
default: "--with=code_quality --with=types --no-root" | ||
poetry_export_options: | ||
description: Options for exporting dependencies to check for hash | ||
changes for cache invalidation | ||
required: false | ||
default: "--with=code_quality --with=types" | ||
file_path: | ||
description: The path to the file or directory to type check | ||
required: false | ||
default: "." | ||
|
||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up environment | ||
uses: elixir-cloud-aai/actions/python/setup/poetry@main | ||
id: setup | ||
continue-on-error: true | ||
with: | ||
os: ${{ inputs.os }} | ||
python_version: ${{ inputs.python_version }} | ||
poetry_install_options: ${{ inputs.poetry_install_options }} | ||
poetry_export_options: ${{ inputs.poetry_export_options }} | ||
|
||
- name: Comment on PR | ||
if: steps.setup.outcome == 'failure' | ||
uses: elixir-cloud-aai/actions/github/comment@main | ||
with: | ||
ci_name: type-check | ||
step_name: setup | ||
commit_id: ${{ github.sha }} | ||
issue-number: ${{ github.event.number }} | ||
username: ${{ github.actor}} | ||
message: | | ||
Check your `pyproject.toml` and the dependency groups in them, | ||
especially `code_quality` and `types` group. | ||
|
||
<details> | ||
<summary>Env used for CI</summary> | ||
OS: ${{ inputs.os }} | ||
Python Version: ${{ inputs.python_version }} | ||
Poetry Install Options: ${{ inputs.poetry_install_options }} | ||
Poetry Export Options: ${{ inputs.poetry_export_options }} | ||
</details> | ||
|
||
- name: Check types | ||
id: type-check | ||
continue-on-error: true | ||
shell: bash | ||
run: poetry run mypy ${{ inputs.file_path }} | ||
|
||
- name: Comment on PR | ||
if: steps.type-check.outcome == 'failure' | ||
uses: elixir-cloud-aai/actions/github/comment@main | ||
with: | ||
ci_name: type-check | ||
step_name: type-check | ||
commit_id: ${{ github.sha }} | ||
issue-number: ${{ github.event.number }} | ||
username: ${{ github.actor}} | ||
message: | | ||
With the environment set up and dependencies installed, | ||
run `run mypy ${{ inputs.file_path }}` to see mypy errors. | ||
|
||
<details> | ||
<summary>Missing stubs or types</summary> | ||
If you see errors related to missing stubs or types, | ||
try running `poetry add types-<package> --group=types` or | ||
`poetry add <package>-stub --group=types` to add type stubs. | ||
|
||
If that fails, either the package does not have types/stubs | ||
or they have different name. | ||
|
||
In that case you can seach for them and add them to types group. | ||
</details> | ||
|
||
<details> | ||
<summary>Ignore error</summary> | ||
Add the module name in pyproject.toml under [tools.mypy.overrides] | ||
section inside modules list. | ||
|
||
```toml | ||
[[tool.mypy.overrides]] | ||
ignore_missing_imports = true | ||
module = [ | ||
"connexion.*", | ||
] | ||
``` | ||
|
||
Try to as granular as possible to avoid ignoring all errors. If | ||
you are using `x.y.z` import, add `x.y.z.*` to the list instead | ||
of `x.*`. | ||
</details> | ||
... |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: remove before merge and add this as another PR.