-
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.
Merge pull request #2 from kirillsulim/dev
Add checkstyle and GitHub Actions CI
- Loading branch information
Showing
21 changed files
with
584 additions
and
81 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,40 @@ | ||
name: Release app | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yaml | ||
publish: | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
- name: Build package | ||
run: poetry build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
- name: Tag | ||
run: | | ||
export TAG="$(poetry version -s)" | ||
git tag "${TAG}" | ||
git push origin "${TAG}" | ||
echo "TAG=${TAG}" >> $GITHUB_ENV | ||
- name: Release on github | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.TAG }} |
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 @@ | ||
name: Build and test app | ||
|
||
on: [pull_request, workflow_call] | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ["3.8", "3.9", "3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry | ||
- name: Install oak for self build | ||
run: | | ||
poetry install | ||
- name: Run tests | ||
run: | | ||
poetry run oak tests | ||
- name: Check style | ||
run: | | ||
poetry run oak check_style |
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
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,68 @@ | ||
from oak_build import task, run | ||
|
||
|
||
LINE_LENGTH = 120 | ||
|
||
STYLE_TARGETS = [ | ||
"integration_tests", | ||
"src", | ||
"tests", | ||
"oak_file.py", | ||
] | ||
|
||
FLAKE8_IGNORE = [ | ||
"E203", | ||
"E231", | ||
"W503", | ||
] | ||
|
||
|
||
@task | ||
def unit_tests(): | ||
run("poetry run pytest tests") | ||
|
||
|
||
@task | ||
def integration_tests(): | ||
run("poetry run pytest integration_tests") | ||
|
||
|
||
@task( | ||
depends_on=[ | ||
unit_tests, | ||
integration_tests, | ||
] | ||
) | ||
def tests(): | ||
pass | ||
|
||
|
||
@task | ||
def flake8(): | ||
ignore = ",".join(FLAKE8_IGNORE) | ||
targets = " ".join(STYLE_TARGETS) | ||
run( | ||
f"poetry run flake8 --max-line-length {LINE_LENGTH} --extend-ignore {ignore} --show-source {targets}" | ||
) | ||
|
||
|
||
@task | ||
def black(): | ||
targets = " ".join(STYLE_TARGETS) | ||
run(f"poetry run black --check {targets}") | ||
|
||
|
||
@task | ||
def reformat_with_black(): | ||
targets = " ".join(STYLE_TARGETS) | ||
run(f"poetry run black {targets}") | ||
|
||
|
||
@task( | ||
depends_on=[ | ||
flake8, | ||
black, | ||
] | ||
) | ||
def check_style(): | ||
pass |
Oops, something went wrong.