Skip to content

Add integration tests #28

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

Merged
merged 1 commit into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ indent_style = tab
indent_size = unset
indent_style = space

[*.py]
indent_size = 4
indent_style = space

[*.{yaml,yml}]
indent_size = 2
indent_style = space
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See: https://flake8.pycqa.org/en/latest/user/configuration.html

[flake8]
doctests = True
# W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
ignore = W503
max-complexity = 10
max-line-length = 120
select = E,W,F,C,N
76 changes: 76 additions & 0 deletions .github/workflows/check-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Check Python

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-python.yml"
- "**/.flake8"
- "**/poetry.lock"
- "**/pyproject.toml"
- "**/setup.cfg"
- "**/tox.ini"
- "**.py"
pull_request:
paths:
- ".github/workflows/check-python.yml"
- "**/.flake8"
- "**/poetry.lock"
- "**/pyproject.toml"
- "**/setup.cfg"
- "**/tox.ini"
- "**.py"
workflow_dispatch:
repository_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Install Poetry
run: pip install poetry

- name: Install Taskfile
uses: arduino/actions/setup-taskfile@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Run flake8
run: task python:lint

formatting:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Install Poetry
run: pip install poetry

- name: Install Taskfile
uses: arduino/actions/setup-taskfile@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Format Python code
run: task python:format

- name: Check formatting
run: git diff --color --exit-code
2 changes: 1 addition & 1 deletion .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.9"

- name: Install Poetry
run: pip install poetry
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test Integration

# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/test-go.yml"
- "Taskfile.yml"
- "**.go"
- "go.mod"
- "go.sum"
- "poetry.lock"
- "pyproject.toml"
- "test/**"
pull_request:
paths:
- ".github/workflows/test-go.yml"
- "Taskfile.yml"
- "**.go"
- "go.mod"
- "go.sum"
- "poetry.lock"
- "pyproject.toml"
- "test/**"
workflow_dispatch:
repository_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.14"

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Install Poetry
run: pip install poetry

- name: Install Taskfile
uses: arduino/actions/setup-taskfile@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Run integration tests
run: task go:test-integration
22 changes: 22 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ tasks:
- task: go:vet
- task: go:lint
- task: go:test
- task: go:test-integration
- task: python:lint
- task: general:check-spelling

format:
desc: Format all files
deps:
- task: go:format
- task: python:format
- task: general:format

go:build:
Expand All @@ -32,6 +35,13 @@ tasks:
cmds:
- go test -v -short -run '{{default ".*" .GO_TEST_REGEX}}' {{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} -coverprofile=coverage_unit.txt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}

go:test-integration:
desc: Run integration tests
cmds:
- task: go:build
- poetry install --no-root
- poetry run pytest test

go:vet:
desc: Check for errors in Go code
cmds:
Expand All @@ -52,6 +62,18 @@ tasks:
cmds:
- go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}

python:lint:
desc: Lint Python code
cmds:
- poetry install --no-root
- poetry run flake8 --show-source

python:format:
desc: Automatically formats Python files
cmds:
- poetry install --no-root
- poetry run black .

general:format:
desc: Format all supported files with Prettier
cmds:
Expand Down
Loading