Repository navigation
add tox env for minimal required dependencies #79
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
Changes from all commits
d318d3d
7891f03
13f271c
93e6b13
2265af0
a23ebe7
8999726
0fcb1a0
8a7463b
fabb5af
0759026
e39eb6f
bd36498
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,10 +14,12 @@ on: | |
|
|
||
| env: | ||
| REPORTS_DIR: CI_reports | ||
| PYTHON_VERISON_DEFAULT: "3.10" | ||
| POETRY_VERSION: "1.1.11" | ||
|
|
||
| jobs: | ||
| coding-standards: | ||
| name: Linting & Coding Standards | ||
| name: Linting & CodingStandards | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
|
|
@@ -27,25 +29,35 @@ jobs: | |
| # see https://github.com/actions/setup-python | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: 3.9 | ||
| python-version: ${{ env.PYTHON_VERISON_DEFAULT }} | ||
| architecture: 'x64' | ||
| - name: Install poetry | ||
| # see https://github.com/marketplace/actions/setup-poetry | ||
| uses: Gr1N/setup-poetry@v7 | ||
| with: | ||
| poetry-version: 1.1.8 | ||
| poetry-version: ${{ env.POETRY_VERSION }} | ||
| - uses: actions/cache@v2 | ||
| with: | ||
| path: ~/.cache/pypoetry/virtualenvs | ||
| key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | ||
| key: ${{ runner.os }}-${{ env.PYTHON_VERISON_DEFAULT }}-poetry${{ env.POETRY_VERSION }}-${{ hashFiles('poetry.lock') }} | ||
| - name: Install dependencies | ||
| run: poetry install | ||
| run: poetry install --no-root | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dont need the package itself installed. it is installed in the tox later, if needed |
||
| - name: Run tox | ||
| run: poetry run tox -e flake8 | ||
|
|
||
| static-code-analysis: | ||
| name: Static Coding Analysis | ||
| name: StaticCodingAnalysis (py${{ matrix.python-version}} ${{ matrix.toxenv-factor }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - # test with the locked dependencies | ||
| python-version: '3.10' | ||
| toxenv-factor: 'locked' | ||
| - # test with the lowest dependencies | ||
| python-version: '3.6' | ||
| toxenv-factor: 'lowest' | ||
| steps: | ||
| - name: Checkout | ||
| # see https://github.com/actions/checkout | ||
|
|
@@ -54,37 +66,43 @@ jobs: | |
| # see https://github.com/actions/setup-python | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: 3.9 | ||
| python-version: ${{ matrix.python-version }} | ||
| architecture: 'x64' | ||
| - name: Install poetry | ||
| # see https://github.com/marketplace/actions/setup-poetry | ||
| uses: Gr1N/setup-poetry@v7 | ||
| with: | ||
| poetry-version: 1.1.8 | ||
| poetry-version: ${{ env.POETRY_VERSION }} | ||
| - uses: actions/cache@v2 | ||
| with: | ||
| path: ~/.cache/pypoetry/virtualenvs | ||
| key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | ||
| key: ${{ runner.os }}-${{ matrix.python-version }}-poetry${{ env.POETRY_VERSION }}-${{ hashFiles('poetry.lock') }} | ||
| - name: Install dependencies | ||
| run: poetry install | ||
| run: poetry install --no-root | ||
| - name: Run tox | ||
| run: poetry run tox -e mypy | ||
| run: poetry run tox -e mypy-${{ matrix.toxenv-factor }} | ||
|
|
||
| build-and-test: | ||
| name: Build & Test Python ${{ matrix.python-version }} on ${{ matrix.os }} | ||
| name: Test (${{ matrix.os }} py${{ matrix.python-version }} ${{ matrix.toxenv-factor }}) | ||
| runs-on: ${{ matrix.os }} | ||
| env: | ||
| REPORTS_ARTIFACT: tests-reports | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] | ||
| python-version: | ||
| - "3.10" # highest supported | ||
| - "3.9" | ||
| - "3.8" | ||
| - "3.7" | ||
| - "3.6" # lowest supported | ||
| toxenv-factor: ['locked'] | ||
| include: | ||
| - # test with the lowest dependencies | ||
| os: 'ubuntu-latest' | ||
| python-version: '3.6' | ||
| toxenv: 'lowest' | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Disabled Git auto EOL CRLF transforms | ||
|
|
@@ -108,17 +126,17 @@ jobs: | |
| # see https://github.com/marketplace/actions/setup-poetry | ||
| uses: Gr1N/setup-poetry@v7 | ||
| with: | ||
| poetry-version: 1.1.11 | ||
| poetry-version: ${{ env.POETRY_VERSION }} | ||
| - uses: actions/cache@v2 | ||
| with: | ||
| path: ~/.cache/pypoetry/virtualenvs | ||
| key: ${{ runner.os }}}-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }} | ||
| key: ${{ runner.os }}}-${{ matrix.python-version }}-poetry${{ env.POETRY_VERSION }}-${{ hashFiles('poetry.lock') }} | ||
| - name: Install dependencies | ||
| run: poetry install | ||
| run: poetry install --no-root | ||
| - name: Ensure build successful | ||
| run: poetry build | ||
| - name: Run tox | ||
| run: poetry run tox -e py -s false | ||
| run: poetry run tox -e py-${{ matrix.toxenv-factor }} -s false | ||
| - name: Generate coverage reports | ||
| run: > | ||
| poetry run coverage report && | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,15 +31,14 @@ | |
| import sys | ||
| from pkg_resources import DistInfoDistribution # type: ignore | ||
|
|
||
| if sys.version_info >= (3, 8, 0): | ||
| if sys.version_info >= (3, 8): | ||
| from importlib.metadata import metadata | ||
| import email | ||
| from email.message import Message as _MetadataReturn | ||
| else: | ||
| from importlib_metadata import metadata # type: ignore | ||
| import email | ||
| from importlib_metadata import metadata | ||
| from importlib_metadata._meta import PackageMetadata as _MetadataReturn | ||
|
|
||
| from . import BaseParser | ||
|
|
||
| from ..model.component import Component | ||
|
|
||
|
|
||
|
|
@@ -60,22 +59,19 @@ def __init__(self) -> None: | |
| c = Component(name=i.project_name, version=i.version) | ||
|
|
||
| i_metadata = self._get_metadata_for_package(i.project_name) | ||
| if 'Author' in i_metadata.keys(): | ||
| c.set_author(author=i_metadata.get('Author')) | ||
| if 'Author' in i_metadata: | ||
| c.set_author(author=i_metadata['Author']) | ||
|
|
||
| if 'License' in i_metadata.keys() and i_metadata.get('License') != 'UNKNOWN': | ||
| c.set_license(license_str=i_metadata.get('License')) | ||
| if 'License' in i_metadata and i_metadata['License'] != 'UNKNOWN': | ||
| c.set_license(license_str=i_metadata['License']) | ||
|
|
||
| if 'Classifier' in i_metadata.keys(): | ||
| for classifier in i_metadata.get_all('Classifier'): | ||
| if 'Classifier' in i_metadata: | ||
| for classifier in i_metadata['Classifier']: | ||
| if str(classifier).startswith('License :: OSI Approved :: '): | ||
| c.set_license(license_str=str(classifier).replace('License :: OSI Approved :: ', '').strip()) | ||
|
|
||
| self._components.append(c) | ||
|
|
||
| @staticmethod | ||
| def _get_metadata_for_package(package_name: str) -> email.message.Message: | ||
| if sys.version_info >= (3, 8, 0): | ||
| return metadata(package_name) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was the same for py38 and below. |
||
| else: | ||
| return metadata(package_name) | ||
| def _get_metadata_for_package(package_name: str) -> _MetadataReturn: | ||
| return metadata(package_name) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # exactly pinned dependencies to the lowest version regardless of python_version | ||
| # see pyptoject file for ranges | ||
|
|
||
| packageurl-python == 0.9.4 | ||
| requirements_parser == 0.2.0 | ||
| setuptools == 50.3.2 | ||
| importlib-metadata == 4.8.1 # ; python_version < '3.8' | ||
| toml == 0.10.2 | ||
| typing-extensions == 3.10.0 # ; python_version < '3.8' | ||
| types-setuptools == 57.4.2 | ||
| types-toml == 0.10.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shortened some labels, so they fit on the screen