Skip to content

Add integration tests #101

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 4 commits into from
Dec 15, 2020
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[*.yml,*.yaml]
[*.{yml,yaml}]
indent_style = space
indent_size = 2
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
doctests = True
ignore =
# W503 and W504 are mutually exclusive, so one or the other must be ignored.
# PEP 8 recommends line break before, so we keep W504.
W503
max-complexity = 10
max-line-length = 120
select = E,W,F,C,N
40 changes: 40 additions & 0 deletions .github/workflows/lint-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Lint Python code

on:
push:
paths:
- "**.py"
- ".flake8"
- "pyproject.toml"
- "Taskfile.yml"
pull_request:
paths:
- "**.py"
- ".flake8"
- "pyproject.toml"
- "Taskfile.yml"

jobs:
lint-python:
runs-on: ubuntu-latest

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

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

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

- name: Install Poetry
run: pip install poetry

- name: Lint Python files
run: task python:check
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
- "**/*.go"
- "**/testdata/**"
- "etc/schemas/**/*.json"
- "pyproject.toml"
- "test/**"
- "Taskfile.yml"
pull_request:
paths:
- ".github/workflows/test.yml"
Expand All @@ -19,6 +22,9 @@ on:
- "**/*.go"
- "**/testdata/**"
- "etc/schemas/**/*.json"
- "pyproject.toml"
- "test/**"
- "Taskfile.yml"

jobs:
test-go:
Expand Down Expand Up @@ -57,3 +63,14 @@ jobs:

- name: Run unit tests
run: task go:test-unit

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

- name: Install Poetry
run: pip install poetry

- name: Run integration tests
run: task test-integration
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Build artifacts
arduino-lint
arduino-lint.exe
__pycache__/

# Test artifacts
coverage_unit.txt
Expand Down
26 changes: 26 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tasks:
desc: Run tests
cmds:
- task: go:test-unit
- task: test-integration
- task: schema:compile

go:generate:
Expand All @@ -27,6 +28,12 @@ tasks:
cmds:
- go test -short -run '{{ default ".*" .TEST_REGEX }}' {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default .DEFAULT_PACKAGES .PACKAGES }}

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

schema:compile:
desc: Compile JSON schema
cmds:
Expand All @@ -36,6 +43,7 @@ tasks:
desc: Lint and check formatting of all files
cmds:
- task: go:check
- task: python:check
- task: docs:check
- task: config:check
- task: check-spelling
Expand All @@ -44,6 +52,7 @@ tasks:
desc: Lint all files
cmds:
- task: go:lint
- task: python:lint
- task: docs:lint
- task: config:lint

Expand All @@ -58,6 +67,7 @@ tasks:
desc: Format all files
cmds:
- task: go:format
- task: python:format
- task: docs:format
- task: config:format

Expand Down Expand Up @@ -88,6 +98,22 @@ tasks:
cmds:
- gofmt -l -w {{ default .DEFAULT_PATHS .PATHS }}

python:check:
cmds:
- task: python:lint

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

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

docs:check:
desc: Lint and check formatting of documentation files
cmds:
Expand Down
Loading