Skip to content

Converted the build-system to poetry>=2.0 #2

Converted the build-system to poetry>=2.0

Converted the build-system to poetry>=2.0 #2

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- release*
schedule:
# Nightly run unit tests to check for implicit dependency issues between pull requests.
- cron: '0 0 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
check_code_formatting:
name: Check code formatting with pre-commit
runs-on: ubuntu-latest
container: python:3.9
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
id: env-cache
with:
path: |
~/.cache/pypoetry/virtualenvs/
~/.local
key: python-3.9-${{ hashFiles('poetry.lock') }}
- name: Setup Environment
uses: ./.github/actions/python-poetry-setup
- name: Run pre-commit checks
run: poetry run pre-commit run --files $(find albumentations -type f)
check_defaults:
name: Check defaults in apply
runs-on: ubuntu-latest
container: python:3.9
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
id: env-cache
with:
path: |
~/.cache/pypoetry/virtualenvs/
~/.local
key: python-3.9-${{ hashFiles('poetry.lock') }}
- name: Setup Environment
uses: ./.github/actions/python-poetry-setup
- name: Check defaults in apply
run: poetry run python -m tools.check_defaults
check_transforms_docs:
name: Check transforms documentation is up to date
runs-on: ubuntu-latest
container: python:3.9
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
id: env-cache
with:
path: |
~/.cache/pypoetry/virtualenvs/
~/.local
key: python-3.9-${{ hashFiles('poetry.lock') }}
- name: Setup Environment
uses: ./.github/actions/python-poetry-setup
- name: Run checks for documentation
run: poetry run python -m tools.make_transforms_docs check README.md
core:
name: Core tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
container: python:${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore Python cache
uses: actions/cache/restore@v4
with:
path: |
~/.cache/pypoetry/virtualenvs/
~/.local
key: python-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
python-${{ matrix.python-version }}-
- name: Setup Environment
uses: ./.github/actions/python-poetry-setup
- name: Replace OpenCV with Headless
run: |
export PIP_LIST="$(poetry run pip list --format=json)"
if (echo "$PIP_LIST" | poetry run ./scripts/pycv2_is_installed.py)
then
echo "OpenCV-Python installed, replacing with equivalent headless version."
VERSION="$(echo "$PIP_LIST" | poetry run ./scripts/pycv2_installed_version.py)"
poetry run pip uninstall -y opencv-python opencv-python-headless
poetry run pip install --no-deps opencv-python-headless=="$VERSION"
else
echo "OpenCV-Python NOT installed, skipping."
fi
- name: Run Unittests (core)
run: poetry run pytest
- name: Save Python cache
uses: actions/cache/save@v4
with:
path: |
~/.cache/pypoetry/virtualenvs/
~/.local
key: python-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Codecov report submission
if: github.event_name != 'schedule'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN || '' }}
fail_ci_if_error: true
files: coverage.xml
flags: unittests
extras:
name: Extras tests (Python ${{ matrix.python-version }}, ${{ matrix.opt-extra }})
needs: core
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
opt-extra: ["torch", "centernet"]
fail-fast: false
container: python:${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore Python cache
uses: actions/cache/restore@v4
with:
path: |
~/.cache/pypoetry/virtualenvs/
~/.local
key: python-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
python-${{ matrix.python-version }}-
- name: Setup Environment
uses: ./.github/actions/python-poetry-setup
- name: Install extras
run: poetry install --extras "${{ matrix.opt-extra }}"
- name: Replace OpenCV with Headless
run: |
export PIP_LIST="$(poetry run pip list --format=json)"
if (echo "$PIP_LIST" | poetry run ./scripts/pycv2_is_installed.py)
then
echo "OpenCV-Python installed, replacing with equivalent headless version."
VERSION="$(echo "$PIP_LIST" | poetry run ./scripts/pycv2_installed_version.py)"
poetry run pip uninstall -y opencv-python opencv-python-headless
poetry run pip install --no-deps opencv-python-headless=="$VERSION"
else
echo "OpenCV-Python NOT installed, skipping."
fi
- name: Run Unittests (extras)
run: poetry run pytest
- name: Codecov report submission
if: github.event_name != 'schedule'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN || '' }}
fail_ci_if_error: true
files: coverage.xml
flags: unittests