Skip to content

Commit 467c457

Browse files
authored
Merge pull request #28 from per1234/integration-tests
Add integration tests
2 parents d1ed898 + 73ec67e commit 467c457

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1084
-6
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ indent_style = tab
1515
indent_size = unset
1616
indent_style = space
1717

18+
[*.py]
19+
indent_size = 4
20+
indent_style = space
21+
1822
[*.{yaml,yml}]
1923
indent_size = 2
2024
indent_style = space

.flake8

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See: https://flake8.pycqa.org/en/latest/user/configuration.html
2+
3+
[flake8]
4+
doctests = True
5+
# W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
6+
ignore = W503
7+
max-complexity = 10
8+
max-line-length = 120
9+
select = E,W,F,C,N

.github/workflows/check-python.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Check Python
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/check-python.yml"
8+
- "**/.flake8"
9+
- "**/poetry.lock"
10+
- "**/pyproject.toml"
11+
- "**/setup.cfg"
12+
- "**/tox.ini"
13+
- "**.py"
14+
pull_request:
15+
paths:
16+
- ".github/workflows/check-python.yml"
17+
- "**/.flake8"
18+
- "**/poetry.lock"
19+
- "**/pyproject.toml"
20+
- "**/setup.cfg"
21+
- "**/tox.ini"
22+
- "**.py"
23+
workflow_dispatch:
24+
repository_dispatch:
25+
26+
jobs:
27+
lint:
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v2
33+
34+
- name: Install Python
35+
uses: actions/setup-python@v2
36+
with:
37+
python-version: "3.9"
38+
39+
- name: Install Poetry
40+
run: pip install poetry
41+
42+
- name: Install Taskfile
43+
uses: arduino/actions/setup-taskfile@master
44+
with:
45+
repo-token: ${{ secrets.GITHUB_TOKEN }}
46+
version: 3.x
47+
48+
- name: Run flake8
49+
run: task python:lint
50+
51+
formatting:
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v2
57+
58+
- name: Install Python
59+
uses: actions/setup-python@v2
60+
with:
61+
python-version: "3.9"
62+
63+
- name: Install Poetry
64+
run: pip install poetry
65+
66+
- name: Install Taskfile
67+
uses: arduino/actions/setup-taskfile@master
68+
with:
69+
repo-token: ${{ secrets.GITHUB_TOKEN }}
70+
version: 3.x
71+
72+
- name: Format Python code
73+
run: task python:format
74+
75+
- name: Check formatting
76+
run: git diff --color --exit-code

.github/workflows/spell-check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Python
2222
uses: actions/setup-python@v2
2323
with:
24-
python-version: "3.8"
24+
python-version: "3.9"
2525

2626
- name: Install Poetry
2727
run: pip install poetry
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Test Integration
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/test-go.yml"
8+
- "Taskfile.yml"
9+
- "**.go"
10+
- "go.mod"
11+
- "go.sum"
12+
- "poetry.lock"
13+
- "pyproject.toml"
14+
- "test/**"
15+
pull_request:
16+
paths:
17+
- ".github/workflows/test-go.yml"
18+
- "Taskfile.yml"
19+
- "**.go"
20+
- "go.mod"
21+
- "go.sum"
22+
- "poetry.lock"
23+
- "pyproject.toml"
24+
- "test/**"
25+
workflow_dispatch:
26+
repository_dispatch:
27+
28+
jobs:
29+
test:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v2
35+
36+
- name: Install Go
37+
uses: actions/setup-go@v2
38+
with:
39+
go-version: "1.14"
40+
41+
- name: Install Python
42+
uses: actions/setup-python@v2
43+
with:
44+
python-version: "3.9"
45+
46+
- name: Install Poetry
47+
run: pip install poetry
48+
49+
- name: Install Taskfile
50+
uses: arduino/actions/setup-taskfile@master
51+
with:
52+
repo-token: ${{ secrets.GITHUB_TOKEN }}
53+
version: 3.x
54+
55+
- name: Run integration tests
56+
run: task go:test-integration

Taskfile.yml

+22
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ tasks:
1414
- task: go:vet
1515
- task: go:lint
1616
- task: go:test
17+
- task: go:test-integration
18+
- task: python:lint
1719
- task: general:check-spelling
1820

1921
format:
2022
desc: Format all files
2123
deps:
2224
- task: go:format
25+
- task: python:format
2326
- task: general:format
2427

2528
go:build:
@@ -32,6 +35,13 @@ tasks:
3235
cmds:
3336
- 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}}
3437

38+
go:test-integration:
39+
desc: Run integration tests
40+
cmds:
41+
- task: go:build
42+
- poetry install --no-root
43+
- poetry run pytest test
44+
3545
go:vet:
3646
desc: Check for errors in Go code
3747
cmds:
@@ -52,6 +62,18 @@ tasks:
5262
cmds:
5363
- go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
5464

65+
python:lint:
66+
desc: Lint Python code
67+
cmds:
68+
- poetry install --no-root
69+
- poetry run flake8 --show-source
70+
71+
python:format:
72+
desc: Automatically formats Python files
73+
cmds:
74+
- poetry install --no-root
75+
- poetry run black .
76+
5577
general:format:
5678
desc: Format all supported files with Prettier
5779
cmds:

0 commit comments

Comments
 (0)