-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
5 changed files
with
147 additions
and
0 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,39 @@ | ||
name: QA | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: linting & spelling | ||
runs-on: ubuntu-latest | ||
env: | ||
TERM: xterm-256color | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python '3,11' | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install Dependencies | ||
run: | | ||
make dev-deps | ||
- name: Run Quality Assurance | ||
run: | | ||
make qa | ||
- name: Run Code Checks | ||
run: | | ||
make check | ||
- name: Run Bash Code Checks | ||
run: | | ||
make shellcheck |
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,40 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Python ${{ matrix.python }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python: ['3.9', '3.10', '3.11'] | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install Dependencies | ||
run: | | ||
make dev-deps | ||
- name: Run Tests | ||
run: | | ||
make pytest | ||
- name: Coverage | ||
if: ${{ matrix.python == '3.9' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
python -m pip install coveralls | ||
coveralls --service=github |
Binary file not shown.
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,43 @@ | ||
import glob | ||
import json | ||
|
||
|
||
def validate_alt_mode(data): | ||
name = data["name"] | ||
mode_type = data.get("type", "") | ||
|
||
assert mode_type != "" | ||
assert not mode_type.endswith("?") | ||
|
||
|
||
def validate_pin(data): | ||
alt_modes = data.get("alt_modes", []) | ||
|
||
for alt_mode in alt_modes: | ||
validate_alt_mode(alt_mode) | ||
|
||
|
||
def validate_header(data): | ||
width = data["width"] | ||
height = data["height"] | ||
orientation = data["orientation"] | ||
pins = data["pins"] | ||
|
||
assert width * height == len(pins) | ||
|
||
for pin in pins: | ||
validate_pin(pin) | ||
|
||
|
||
def validate_board_json(file): | ||
data = json.load(open(file, "r")) | ||
|
||
for name, header in data["headers"].items(): | ||
validate_header(header) | ||
|
||
|
||
def test_validate_board_json_files(): | ||
files = glob.glob("boards/*.json") | ||
|
||
for file in files: | ||
validate_board_json(file) |
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,25 @@ | ||
[tox] | ||
envlist = py,qa | ||
skip_missing_interpreters = True | ||
isolated_build = true | ||
minversion = 4.0.0 | ||
|
||
[testenv] | ||
commands = | ||
coverage run -m pytest -v -r wsx | ||
coverage report | ||
deps = | ||
mock | ||
pytest>=3.1 | ||
pytest-cov | ||
build | ||
|
||
[testenv:qa] | ||
commands = | ||
isort --check . | ||
ruff check . | ||
codespell . | ||
deps = | ||
ruff | ||
codespell | ||
isort |