Add type annotations to all from_et()
and create_*_from_et()
functions
#598
Workflow file for this run
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
# SPDX-License-Identifier: MIT | |
# Copyright (c) 2023 MBition GmbH | |
name: odxtools CI pipeline | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Setup up Linter | |
run: | | |
pip install toml yapf | |
- name: Lint code formatting | |
# make yapf fail if any file needs to be formatted | |
run: | | |
yapf -r --diff examples/ odxtools/ tests/ | |
static-type-checking: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# restrict the matrix to the oldest and the latest Python | |
# version being supported by odxtools | |
python-version: ["3.8", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{matrix.python-version}} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python-version}} | |
cache: "pip" | |
- name: Install odxtools development and testing dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r test-requirements.txt | |
- name: Static type checking with mypy | |
run: | | |
python -m mypy --ignore-missing-imports odxtools examples tests | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
# restrict the matrix to the oldest and the latest Python | |
# version being supported by odxtools | |
python-version: ["3.8", "3.11"] | |
# due to the slow windows runners, we refrain from testing every python | |
# version on windows-latest | |
exclude: | |
- os: windows-latest | |
python-version: "3.8" | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{matrix.python-version}} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python-version}} | |
cache: "pip" | |
# dependency are likely cached on ubuntu-latest | |
- name: Install odxtools development and testing dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r test-requirements.txt | |
- name: Create somersault.pdx | |
run: | | |
python -m examples.mksomersaultpdx examples/somersault.pdx | |
- name: Run unit tests and report line coverage | |
# use `python -m pytest ...` instead of `pytest ...` to avoid setting the | |
# PYTHONPATH environment variable. This works independently of the OS. | |
# For some reason, pytest-cov reports invalid line coverage. As a remedy, | |
# we utilize the `coverage` module instead of `pytest-cov`. Line coverage | |
# shall be only reported for the odxtools package, i.e., the tests package | |
# should be ignored. | |
run: | | |
coverage run --source=odxtools --omit=tests -m pytest | |
coverage report |