-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from orsinium-labs/ci
CI (Github Actions)
- Loading branch information
Showing
9 changed files
with
173 additions
and
48 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,56 @@ | ||
name: main | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- uses: arduino/setup-task@v1 | ||
with: | ||
repo-token: ${{ github.token }} | ||
- run: task lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
# - "3.12.0-rc.3" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: arduino/setup-task@v1 | ||
with: | ||
repo-token: ${{ github.token }} | ||
- run: task test | ||
|
||
markdownlint-cli: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: nosborn/github-action-markdown-cli@v3.2.0 | ||
with: | ||
files: . | ||
config_file: .markdownlint.yaml | ||
dot: true |
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,8 @@ | ||
# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml | ||
default: true # enable all by default | ||
MD007: # unordered list indentation | ||
indent: 2 | ||
MD013: false # do not validate line length | ||
MD014: false # allow $ before command output | ||
MD029: # ordered list prefix | ||
style: "one" |
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,73 +1,133 @@ | ||
# https://taskfile.dev | ||
|
||
# https://taskfile.dev/ | ||
version: "3" | ||
|
||
vars: | ||
PYTHON: python3 | ||
VENVS: .venvs | ||
TEST_ENV: .venvs/test | ||
LINT_ENV: .venvs/lint | ||
TEST_PYTHON: "{{.TEST_ENV}}/bin/python3" | ||
LINT_PYTHON: "{{.LINT_ENV}}/bin/python3" | ||
|
||
env: | ||
FLIT_ROOT_INSTALL: "1" | ||
|
||
tasks: | ||
install:base: | ||
install:flit: | ||
status: | ||
- test -f .venvs/base/bin/flitenv | ||
- which flit | ||
cmds: | ||
- "{{.PYTHON}} -m venv .venvs/base" | ||
- .venvs/base/bin/python3 -m pip install -U flitenv pip-tools | ||
- python3 -m pip install flit | ||
venv:test: | ||
status: | ||
- test -d {{.TEST_ENV}} | ||
cmds: | ||
- "{{.PYTHON}} -m venv {{.TEST_ENV}}" | ||
venv:lint: | ||
status: | ||
- test -d {{.LINT_ENV}} | ||
cmds: | ||
- "{{.PYTHON}} -m venv {{.LINT_ENV}}" | ||
install:test: | ||
sources: | ||
- pyproject.toml | ||
deps: | ||
- install:base | ||
- install:flit | ||
- venv:test | ||
cmds: | ||
- .venvs/base/bin/flitenv test install | ||
- > | ||
flit install | ||
--python {{.TEST_PYTHON}} | ||
--extras=test,integrations | ||
--deps=production | ||
--symlink | ||
install:lint: | ||
sources: | ||
- pyproject.toml | ||
deps: | ||
- install:base | ||
- install:flit | ||
- venv:lint | ||
cmds: | ||
- > | ||
flit install | ||
--python {{.LINT_PYTHON}} | ||
--extras=lint,integrations | ||
--deps=production | ||
--symlink | ||
release: | ||
desc: generate and upload a new release | ||
deps: | ||
- install:flit | ||
cmds: | ||
- .venvs/base/bin/flitenv lint install | ||
- which gh | ||
- test {{.CLI_ARGS}} | ||
- cat flake8_warnings/__init__.py | grep {{.CLI_ARGS}} | ||
- rm -rf dist/ | ||
- flit build | ||
- flit publish | ||
- git tag {{.CLI_ARGS}} | ||
- git push | ||
- git push --tags | ||
- gh release create --generate-notes {{.CLI_ARGS}} | ||
- gh release upload {{.CLI_ARGS}} ./dist/* | ||
|
||
pytest:run: | ||
pytest: | ||
desc: "run Python tests" | ||
deps: | ||
- install:test | ||
cmds: | ||
- .venvs/base/bin/flitenv test run pytest {{.CLI_ARGS}} | ||
flake8_warnings:run: | ||
desc: "run flake8_warnings" | ||
- "{{.TEST_PYTHON}} -m pytest {{.CLI_ARGS}}" | ||
flake8: | ||
desc: "lint Python code" | ||
deps: | ||
- install:lint | ||
cmds: | ||
- .venvs/base/bin/flitenv lint run python3 -m flake8_warnings {{.CLI_ARGS}} | ||
flake8:run: | ||
desc: "lint Python code" | ||
- "{{.LINT_PYTHON}} -m flake8 {{.CLI_ARGS}} ." | ||
mypy: | ||
desc: "check type annotations" | ||
deps: | ||
- install:lint | ||
cmds: | ||
- .venvs/base/bin/flitenv lint run flake8 {{.CLI_ARGS}} | ||
mypy:run: | ||
desc: "check type annotations" | ||
- "{{.LINT_PYTHON}} -m mypy {{.CLI_ARGS}}" | ||
unify: | ||
desc: "convert double quotes to single ones" | ||
deps: | ||
- install:lint | ||
cmds: | ||
- .venvs/base/bin/flitenv lint run mypy {{.CLI_ARGS}} | ||
isort:run: | ||
- "{{.LINT_PYTHON}} -m unify -r -i --quote=\\' {{.CLI_ARGS}} flake8_warnings tests" | ||
isort: | ||
desc: "sort imports" | ||
deps: | ||
- install:lint | ||
cmds: | ||
- .venvs/base/bin/flitenv lint run isort {{.CLI_ARGS}} . | ||
- "{{.LINT_PYTHON}} -m isort {{.CLI_ARGS}} ." | ||
isort:check: | ||
desc: "check if all imports are sorted" | ||
desc: "sort imports" | ||
deps: | ||
- install:lint | ||
cmds: | ||
- .venvs/base/bin/flitenv lint run isort {{.CLI_ARGS}} --check . | ||
linters:run: | ||
- "{{.LINT_PYTHON}} -m isort --check {{.CLI_ARGS}} ." | ||
|
||
# groups | ||
format: | ||
desc: "run all code formatters" | ||
cmds: | ||
- task: isort | ||
- task: unify | ||
lint: | ||
desc: "run all linters" | ||
cmds: | ||
- task: flake8:run | ||
- task: mypy:run | ||
- task: flake8 | ||
- task: mypy | ||
- task: isort:check | ||
test: | ||
desc: "run all tests" | ||
cmds: | ||
- task: pytest | ||
all: | ||
desc: "run all code formatters, linters, and tests" | ||
cmds: | ||
- task: format | ||
- task: lint | ||
- task: test |
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,12 +1,12 @@ | ||
import warnings | ||
|
||
|
||
warnings.warn("mod warn", DeprecationWarning) | ||
warnings.warn('mod warn', DeprecationWarning) | ||
|
||
|
||
def func(): | ||
pass | ||
|
||
|
||
def not_imported_func(): | ||
warnings.warn("this one is ignored") | ||
warnings.warn('this one is ignored') |
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