Skip to content

[issue-47] Drop element from resource tree #123

[issue-47] Drop element from resource tree

[issue-47] Drop element from resource tree #123

# SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
#
# SPDX-License-Identifier: Apache-2.0
name: Lint and Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
linter:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ "3.8", "3.9", "3.10", "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 }}
- name: cache poetry install
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ matrix.os }}-${{ matrix.python-version }}-1.4.0-0
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v3
with:
path: .venv
key: pydeps-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
# We use a cache for the projects dependencies but want to avoid caching the projects code.
# --no-root installs all dependencies but not the project itself which we do in the next step.
- name: Install package dependencies
run: poetry install --no-interaction --no-root
if: steps.cache--deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
- name: Run isort
run: poetry run isort src/ tests/ --check
- name: Run black
run: poetry run black src/ tests/ --check
- name: Run flake8
run: poetry run flake8 src/ tests/
- name: Run mypy
run: poetry run python -m mypy src/ tests/
test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ "3.8", "3.9", "3.10", "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 }}
- name: cache poetry install
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ matrix.os }}-${{ matrix.python-version }}-1.4.0-0
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v3
with:
path: .venv
key: pydeps-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
# We use a cache for the projects dependencies but want to avoid caching the projects code.
# --no-root installs all dependencies but not the project itself which we do in the next step.
- name: Install package dependencies
run: poetry install --no-interaction --no-root
if: steps.cache--deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
- name: Run tests
run: poetry run pytest