Skip to content

Neat 347 extend depth transformer with typing #2464

Neat 347 extend depth transformer with typing

Neat 347 extend depth transformer with typing #2464

Workflow file for this run

name: Check Quality and Test
on:
pull_request:
env:
# Used for linting, docker images, and docs.
MAIN_PYTHON_VERSION: 3.11
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
# The installation is required as mypy must be run in the local system environment, not in the pre-commit environment.
- name: Install required dependencies
run: |
python3 -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install -E all
- name: Linting and static code checks
continue-on-error: true
id: pre-commit-first-run
run: |
pre-commit run --all-files
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action
with:
create_branch: false
commit_message: Linting and static code checks
# If the first run failed, run the checks again to ensure that the changes are correct.
- name: Linting and static code checks try 2
if: steps.pre-commit-first-run.outcome != 'success'
run: |
pre-commit run --all-files
checks:
runs-on: ubuntu-latest
environment: dev
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
# Python 3.11 is assumed to be covered by testing 3.10 and 3.12
- "3.12"
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up cache
uses: actions/cache@v3.3.1
with:
path: .venv
key: venv-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
- run: poetry install -E all
- name: Run unit tests
run: export PYTHONPATH=$PYTHONPATH:$(pwd); poetry run pytest tests/tests_unit
# - name: Run integration tests
# env:
# CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
# CDF_PROJECT: ${{ vars.CDF_PROJECT }}
# IDP_CLIENT_ID: ${{ vars.IDP_CLIENT_ID }}
# IDP_CLIENT_SECRET: ${{ secrets.IDP_CLIENT_SECRET }}
# IDP_TENANT_ID: ${{ secrets.IDP_TENANT_ID }}
# run: export PYTHONPATH=$PYTHONPATH:$(pwd); poetry run pytest tests/tests_integration
# needs update of some dep due to new version of ipynb test
# - name: Run notebook tests
# run: export PYTHONPATH=$PYTHONPATH:$(pwd); poetry run pytest ./docs/tutorial/notebooks/*.ipynb --nb-test-files
- name: Run security checks
run: poetry check
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Poetry is required to export requirements.txt
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.1
- name: Build Image
run: make build-docker
- name: Run and Verify
run: |
make compose-up-d
# Give the application time to startup
sleep 10s
curl --fail http://localhost:8000/static/index.html
- name: Shutdown containers
if: always()
working-directory: ./docker
run: docker compose down
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install Dependencies
run: |
python -m pip install --upgrade --upgrade-strategy eager --no-cache-dir .[docs]
- name: Build documentation
run: |
mkdocs build
coverage:
runs-on: ubuntu-latest
environment: dev
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Set up cache
uses: actions/cache@v3.3.1
with:
path: .venv
key: venv-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
- run: poetry install -E all
- name: Create test coverage report
env:
CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
CDF_PROJECT: ${{ vars.CDF_PROJECT }}
IDP_CLIENT_ID: ${{ vars.IDP_CLIENT_ID }}
IDP_CLIENT_SECRET: ${{ secrets.IDP_CLIENT_SECRET }}
IDP_TENANT_ID: ${{ secrets.IDP_TENANT_ID }}
run: export PYTHONPATH=$PYTHONPATH:$(pwd); poetry run pytest --cov=cognite/ --cov-config=pyproject.toml --cov-report=xml:coverage.xml tests/
- name: Push coverage report to PR
uses: orgoro/coverage@v3.1
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 0.6