Skip to content

Add integration tests #36

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 2 commits into from
May 25, 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
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See: https://github.com/codespell-project/codespell#using-a-config-file
[codespell]
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
ignore-words-list = pullrequest
ignore-words-list = easly,pullrequest
builtin = clear,informal,en-GB_to_en-US
check-filenames =
check-hidden =
Expand Down
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
78 changes: 78 additions & 0 deletions .github/workflows/check-python-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Check Python

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-python-task.ya?ml"
- "**/.flake8"
- "**/poetry.lock"
- "**/pyproject.toml"
- "**/setup.cfg"
- "Taskfile.ya?ml"
- "**/tox.ini"
- "**.py"
pull_request:
paths:
- ".github/workflows/check-python-task.ya?ml"
- "**/.flake8"
- "**/poetry.lock"
- "**/pyproject.toml"
- "**/setup.cfg"
- "Taskfile.ya?ml"
- "**/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 Task
uses: arduino/setup-task@v1
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 Task
uses: arduino/setup-task@v1
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
70 changes: 70 additions & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
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-integration.yml"
- "Taskfile.yml"
- "**.go"
- "go.mod"
- "go.sum"
- "poetry.lock"
- "pyproject.toml"
- "test/**"
pull_request:
paths:
- ".github/workflows/test-integration.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 Arduino Lint
run: |
ARDUINO_LINT_INSTALLATION_PATH="${{ runner.temp }}/arduino-lint"
mkdir --parents "$ARDUINO_LINT_INSTALLATION_PATH"
curl \
-fsSL \
https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/install.sh \
| \
BINDIR="$ARDUINO_LINT_INSTALLATION_PATH" \
sh

# Add installation folder to path to path
echo "$ARDUINO_LINT_INSTALLATION_PATH" >> "$GITHUB_PATH"

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

- name: Run integration tests
run: task go:test-integration
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ libraries-repository-engine.exe
repository
repository.exe
test/arduino/cc/repository/libraries/testdata/test_db.json
config.json
repos.txt
/config.json
/repos.txt
__pycache__/

# Created by .gitignore support plugin (hsz.mobi)
### Go template
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See: https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore

/test/testdata/golden/logs/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# libraries-repository-engine

[![Test Go status](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-go.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-go.yml)
[![Integration Test status](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-integration.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-integration.yml)
[![Check Go status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go.yml)
[![Check Prettier Formatting status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml)
[![Check Taskfiles status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-taskfiles.yml)
Expand Down
22 changes: 22 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ tasks:
- task: general:check-spelling
- task: go:lint
- task: go:test
- task: go:test-integration
- task: go:vet
- task: python:lint

format:
desc: Correct the formatting of the project's files
deps:
- task: general:format-prettier
- task: go:format
- task: python:format

go:build:
desc: Build the project
Expand All @@ -35,6 +38,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:check:
desc: Check for problems with Go code
deps:
Expand Down Expand Up @@ -71,6 +81,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-prettier:
desc: Format all supported files with Prettier
cmds:
Expand Down
Loading