forked from YiVal/YiVal
-
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
Showing
14 changed files
with
366 additions
and
44 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,12 @@ | ||
[flake8] | ||
exclude = | ||
venv | ||
.venv | ||
__pycache__ | ||
notebooks | ||
# Recommend matching the black line length (default 88), | ||
# rather than using the flake8 default of 79: | ||
max-line-length = 88 | ||
extend-ignore = | ||
# See https://github.com/PyCQA/pycodestyle/issues/373 | ||
E203, |
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,76 @@ | ||
# An action for setting up poetry install with caching. | ||
# Using a custom action since the default action does not | ||
# take poetry install groups into account. | ||
# Action code from: | ||
# https://github.com/actions/setup-python/issues/505#issuecomment-1273013236 | ||
name: poetry-install-with-caching | ||
description: Poetry install with support for caching of dependency groups. | ||
|
||
inputs: | ||
python-version: | ||
description: Python version, supporting MAJOR.MINOR only | ||
required: true | ||
|
||
poetry-version: | ||
description: Poetry version | ||
required: true | ||
|
||
install-command: | ||
description: Command run for installing dependencies | ||
required: false | ||
default: poetry install | ||
|
||
cache-key: | ||
description: Cache key to use for manual handling of caching | ||
required: true | ||
|
||
working-directory: | ||
description: Directory to run install-command in | ||
required: false | ||
default: "" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/setup-python@v4 | ||
name: Setup python $${ inputs.python-version }} | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- uses: actions/cache@v3 | ||
id: cache-pip | ||
name: Cache Pip ${{ inputs.python-version }} | ||
env: | ||
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "15" | ||
with: | ||
path: | | ||
~/.cache/pip | ||
key: pip-${{ runner.os }}-${{ runner.arch }}-py-${{ inputs.python-version }} | ||
|
||
- run: pipx install poetry==${{ inputs.poetry-version }} --python python${{ inputs.python-version }} | ||
shell: bash | ||
|
||
- name: Check Poetry File | ||
shell: bash | ||
run: | | ||
poetry check | ||
- name: Check lock file | ||
shell: bash | ||
run: | | ||
poetry lock --check | ||
- uses: actions/cache@v3 | ||
id: cache-poetry | ||
env: | ||
SEGMENT_DOWNLOAD_TIMEOUT_MIN: "15" | ||
with: | ||
path: | | ||
~/.cache/pypoetry/virtualenvs | ||
~/.cache/pypoetry/cache | ||
~/.cache/pypoetry/artifacts | ||
key: poetry-${{ runner.os }}-${{ runner.arch }}-py-${{ inputs.python-version }}-poetry-${{ inputs.poetry-version }}-${{ inputs.cache-key }}-${{ hashFiles('poetry.lock') }} | ||
|
||
- run: ${{ inputs.install-command }} | ||
working-directory: ${{ inputs.working-directory }} | ||
shell: bash |
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,36 @@ | ||
name: lint | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
env: | ||
POETRY_VERSION: "1.4.2" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install poetry | ||
run: | | ||
pipx install poetry==$POETRY_VERSION | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: poetry | ||
- name: Install dependencies | ||
run: | | ||
poetry install | ||
- name: Analysing the code with our lint | ||
run: | | ||
make lint |
This file was deleted.
Oops, something went wrong.
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,49 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
POETRY_VERSION: "1.4.2" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
test_type: | ||
- "core" | ||
- "extended" | ||
name: Python ${{ matrix.python-version }} ${{ matrix.test_type }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: "./.github/actions/poetry_setup" | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
poetry-version: "1.4.2" | ||
cache-key: ${{ matrix.test_type }} | ||
install-command: | | ||
if [ "${{ matrix.test_type }}" == "core" ]; then | ||
echo "Running core tests, installing dependencies with poetry..." | ||
poetry install | ||
else | ||
echo "Running extended tests, installing dependencies with poetry..." | ||
poetry install -E extended_testing | ||
fi | ||
- name: Run ${{matrix.test_type}} tests | ||
run: | | ||
if [ "${{ matrix.test_type }}" == "core" ]; then | ||
make test | ||
else | ||
make extended_tests | ||
fi | ||
shell: bash |
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,34 @@ | ||
.PHONY: all format lint test | ||
|
||
all: help | ||
|
||
format: | ||
poetry run black . | ||
poetry run ruff --select I --fix . | ||
|
||
tests: | ||
poetry run pytest . | ||
|
||
PYTHON_FILES=. | ||
lint: PYTHON_FILES=. | ||
lint_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d master | grep -E '\.py$$') | ||
lint lint_diff: | ||
poetry run mypy $(PYTHON_FILES) | ||
poetry run black $(PYTHON_FILES) --check | ||
poetry run ruff . | ||
|
||
help: | ||
@echo '----' | ||
@echo 'coverage - run unit tests and generate coverage report' | ||
@echo 'docs_build - build the documentation' | ||
@echo 'docs_clean - clean the documentation build artifacts' | ||
@echo 'docs_linkcheck - run linkchecker on the documentation' | ||
@echo 'format - run code formatters' | ||
@echo 'lint - run linters' | ||
@echo 'test - run unit tests' | ||
@echo 'tests - run unit tests' | ||
@echo 'test TEST_FILE=<test_file> - run all tests in file' | ||
@echo 'extended_tests - run only extended unit tests' | ||
@echo 'test_watch - run unit tests in watch mode' | ||
@echo 'integration_tests - run integration tests' | ||
@echo 'docker_tests - run unit tests in docker' |
Oops, something went wrong.