-
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.
- Loading branch information
0 parents
commit 51d1bdb
Showing
25 changed files
with
3,195 additions
and
0 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,31 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = tab | ||
indent_size = 2 | ||
|
||
[*.toml] | ||
indent_size = 4 | ||
indent_style = space | ||
|
||
# YAML doesn't support hard tabs | ||
# Templates that will be weird with hard tabs in the website editor | ||
[*.{yml,yaml,md}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# Force python as python demands | ||
[*.{py,ipynb}] | ||
indent_size = 4 | ||
indent_style = space | ||
|
||
# Ignore lockfiles | ||
[*.lock] | ||
indent_size = unset | ||
indent_style = unset | ||
insert_final_newline = unset | ||
trim_trailing_whitespace = unset |
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,90 @@ | ||
--- | ||
# Labels names are important as they are used by Release Drafter to decide | ||
# regarding where to record them in changelog or if to skip them. | ||
# | ||
# The repository labels will be automatically configured using this file and | ||
# the GitHub Action https://github.com/marketplace/actions/github-labeler. | ||
## more info https://github.com/crazy-max/ghaction-github-labeler | ||
|
||
# ------------------------- Conventional Commit types ------------------------ # | ||
# From https://github.com/commitizen/conventional-commit-types/blob/master/index.json | ||
|
||
- name: feature | ||
description: A new enhancement or feature | ||
color: 0A8844 | ||
from_name: "enhancement" | ||
|
||
- name: fix | ||
description: A bug fix | ||
color: d23832 | ||
from_name: "bug" | ||
|
||
- name: documentation | ||
description: Documentation changes only | ||
color: 8AD9F5 | ||
|
||
- name: style | ||
description: Changes that do not affect meaning of code (formatting, etc.) | ||
color: F9CD8E | ||
|
||
- name: refactor | ||
description: Code change that neither fixes a bug nor adds a feature | ||
color: FBCA0C | ||
from_name: refactoring | ||
|
||
- name: performance | ||
description: Code change that improves performance | ||
color: F2A33C | ||
|
||
- name: test | ||
description: Adding missing tests or correcting existing tests | ||
color: 34FFB3 | ||
|
||
- name: build | ||
description: Changes that affect the build system or external dependencies | ||
color: 8F4FBB | ||
|
||
- name: continuous integration | ||
description: Changes to CI configuration and scripts | ||
color: FCBFE3 | ||
|
||
- name: chore | ||
description: Other changes that don't modify src or test files | ||
color: d3d3d3 | ||
|
||
- name: revert | ||
description: Revert a previous commit | ||
color: 1e1e1e | ||
|
||
- name: backwards incompatible | ||
description: incompatible changes to how the application works | ||
color: AB2232 | ||
|
||
- name: question | ||
description: Further information is requested | ||
color: EE328E | ||
|
||
# ------------------------------- Dependencies ------------------------------- # | ||
- name: dependencies | ||
description: Pull requests that update dependencies | ||
color: 0366d6 | ||
|
||
# ------------------------------ Utility labels ------------------------------ # | ||
- name: automerge | ||
color: "ffffff" | ||
description: "Automerge this PR" | ||
|
||
- name: "stale" | ||
color: "ffffff" | ||
description: "" | ||
# - name: duplicate | ||
# description: This issue or pull request already exists | ||
# color: ffffff | ||
|
||
# - name: invalid | ||
# description: This doesn't seem right | ||
# color: ffffff | ||
|
||
# - name: wontfix | ||
# description: This will not be worked on | ||
# color: ffffff |
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,165 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
pull_request: | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
branches: | ||
- main | ||
push: | ||
branches: [main] | ||
|
||
env: | ||
PYTHON_VERSION: 3.9 | ||
|
||
jobs: | ||
changes: | ||
name: Check for Python file changes | ||
runs-on: ubuntu-latest | ||
if: ${{ !github.event.pull_request.draft }} | ||
outputs: | ||
python: ${{steps.filter.outputs.python}} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
python: | ||
- '**/*.py' | ||
- 'pyproject.toml' | ||
- 'pdm.lock' | ||
- '.github/workflows/continuous_integration.yml' | ||
mypy: | ||
name: Typecheck with mypy | ||
needs: [changes] | ||
if: ${{needs.changes.outputs.python == 'true' && !github.event.pull_request.draft }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup reviewdog | ||
uses: reviewdog/action-setup@v1 | ||
|
||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Setup PDM | ||
uses: pdm-project/setup-pdm@v3 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
pdm install | ||
- name: Run mypy with reviewdog | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_EVENT_NAME: ${{ github.event_name }} | ||
run: | | ||
exit_val="0" | ||
[[ $GITHUB_EVENT_NAME == "pull_request" ]] && reporter="github-pr-review" || reporter="github-check" | ||
pdm run mypy \ | ||
--show-column-numbers \ | ||
--show-absolute-path \ | ||
--no-error-summary . 2>&1 | reviewdog \ | ||
-efm="%f:%l:%c: %t%*[^:]: %m" \ | ||
-name="mypy" \ | ||
-filter-mode=nofilter \ | ||
-fail-on-error \ | ||
-reporter="${reporter}" || exit_val="$?" | ||
if [[ "${exit_val}" -ne '0' ]]; then | ||
exit 1 | ||
fi | ||
flake8: | ||
name: Lint with flake8 | ||
needs: [changes] | ||
if: ${{needs.changes.outputs.python == 'true' && !github.event.pull_request.draft }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup reviewdog | ||
uses: reviewdog/action-setup@v1 | ||
|
||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Setup PDM | ||
uses: pdm-project/setup-pdm@v3 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
pdm install | ||
- name: Run flake8 | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_EVENT_NAME: ${{ github.event_name }} | ||
run: | | ||
exit_val="0" | ||
[[ $GITHUB_EVENT_NAME == "pull_request" ]] && reporter="github-pr-review" || reporter="github-check" | ||
pdm run flake8 \ | ||
--format=default . 2>&1 | reviewdog \ | ||
-f=pep8 \ | ||
-name="flake8" \ | ||
-fail-on-error \ | ||
-filter-mode=file \ | ||
-reporter="${reporter}" || exit_val="$?" | ||
if [[ "${exit_val}" -ne '0' ]]; then | ||
exit 1 | ||
fi | ||
precommit: | ||
name: Lint with pre-commit | ||
runs-on: ubuntu-latest | ||
if: ${{ !github.event.pull_request.draft }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup reviewdog | ||
uses: reviewdog/action-setup@v1 | ||
|
||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Setup PDM | ||
uses: pdm-project/setup-pdm@v3 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: true | ||
|
||
- name: Install pre-commit | ||
run: | | ||
pip install pre-commit | ||
- name: Run pre-commit hook | ||
id: run-pre-commit-hooks | ||
run: | | ||
git add .pre-commit-config.yaml | ||
pre-commit run --color=always --all-files | ||
- name: Annotate any changes using reviewdog | ||
if: ${{ failure() }} | ||
id: reviewdog-suggester | ||
uses: reviewdog/action-suggester@v1 | ||
with: | ||
tool_name: pre-commit |
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,42 @@ | ||
name: "Lint PR" | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Validate PR title | ||
uses: amannn/action-semantic-pull-request@v5 | ||
id: lint_pr_title | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# When the previous steps fails, the workflow would stop. By adding this | ||
# condition you can continue the execution with the populated error message. | ||
- name: Create error message if validation fails | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
if: always() && (steps.lint_pr_title.outputs.error_message != null) | ||
with: | ||
header: pr-title-lint-error | ||
message: | | ||
Hey there and thank you for opening this pull request! 👋🏼 | ||
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. | ||
Details: | ||
``` | ||
${{ steps.lint_pr_title.outputs.error_message }} | ||
``` | ||
- name: Delete previous comment when issue is resolved | ||
if: ${{ steps.lint_pr_title.outputs.error_message == null }} | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
header: pr-title-lint-error | ||
delete: true |
Oops, something went wrong.