Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

[CI] split coverage into multiple jobs (#2756)

João Gustavo A. Amorimb3f8c225d770
diff --git a/.github/actions/env/action.yml b/.github/actions/env/action.yml
deleted file mode 100644
index 454c68fa8..000000000
--- a/.github/actions/env/action.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: Environment setup
-
-on:
- workflow_dispatch:
- inputs:
- python-version:
- description: "The python version desired."
- required: true
- default: "3.11"
- type: string
-
- pytorch-version:
- description: "The pytorch version desired."
- required: true
- default: "2.1.2"
- type: string
-
-runs:
- using: "composite"
- steps:
- - name: Setup environment
- uses: actions/setup-python@v4
- with:
- python-version: ${{ inputs.python-version }}
-
- - if: ${{ contains(fromJson('["nightly"]'), inputs.pytorch-version ) }}
- name: Install PyTorch nightly
- shell: bash
- run: pip install numpy --pre torch[dynamo] --force-reinstall --extra-index-url https://download.pytorch.org/whl/nightly/cpu/
-
- - if: ${{ contains(fromJson('["nightly"]'), inputs.pytorch-version ) == false}}
- name: Install pytorch
- shell: bash
- run: pip install torch==${{ inputs.pytorch-version }} --index-url https://download.pytorch.org/whl/cpu
-
- - name: Install Kornia dev
- shell: bash
- run: pip install .[dev,x]
-
- - name: Check dependencies and kornia version
- shell: bash
- run: |
- python -c "import torch;print('Pytorch version: ', torch.__version__)"
- python -c "import kornia;print('Kornia version: ', kornia.__version__)"
diff --git a/.github/actions_info.md b/.github/actions_info.md
deleted file mode 100644
index f663c6d3c..000000000
--- a/.github/actions_info.md
+++ /dev/null
@@ -1,105 +0,0 @@
-# Kornia GHA
-
-## Actions
-
-### Env
-This GHA action ([.github/actions/env/action.yml](actions/env/action.yml)) is
-responsible for the setup of an environment for kornia in development mode on
-CI.
-
-Use the actions:
-- `setup-python@v4`
-
-Has the inputs:
-- `python-version`: (string, default: `'3.11'`) the python version desired.
- - The version should be supported by `setup-python@v4` action.
-- `pytorch-version`: (string, default: `'2.1.2`') the pytorch version desired.
- - This value will be used to install pytorch using conda from pytorch
- channel.
- - If the value passed is `nightly` the nightly version of pytorch with dynamo
- will be installed from pip.
-
-
-## Reusable workflows
-
-### Tests
-This workflow ([.github/workflows/tests.yml](workflows/tests.yml)) will setup
-an environment using the [env](#Env) action, run the tests using pytest and
-uploading the coverage report to codecov.
-
-Use the actions:
-- `actions/checkout`
-- `.github/actions/env`
-
-Has the inputs:
-- `os`: (string, default: `ubuntu-latest`) the OS name same as supported by [gha](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners).
-- `python-version`: (json list of strings, default: `'["3.11"]'`) a string with
- format of a json list within strings for each python version desired.
-- `pytorch-version`: (json list of strings, default: `'["2.1.2"]'`) a string
- with format of a json list within strings for each pytorch version desired.
-- `pytorch-dtype`: (string, default: `float32`) the dtype used to generate
- the tests with pytest.
-- `pytest-extra`: (string, default: ``) extra options passed for the pytest
- e.g: `-k test_smoke` to collect and run just smoke tests.
-- `continue-on-error`: (boolean, default: `false`) to set the
- `continue-on-error` behavior on the test step.
-- `fail-fast`: (boolean, default: `false`) to set the `fail-fast` behavior on
- the matrix strategy.
-- `coverage`: (boolean, default: `false`) to run the tests suite using the
- coverage mode, and report the results and upload it on codecov.
-
-A matrix strategy will be adopted from the list of python and pytorch version.
-
-### Tests tutorials
-This workflow ([.github/workflows/test_tutorials.yml](workflows/tests_tutorials.yml)) will setup
-an environment using the [env](#Env) action, clone the [tutorials repo](https://github.com/kornia/tutorials), and execute the tutorials.
-
-Use the actions:
-- `actions/checkout`
-- `.github/actions/env`
-
-Has the inputs:
-- `os`: (string, default: `ubuntu-latest`) the OS name same as supported by [gha](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners).
-- `python-version`: (json list of strings, default: `'["3.11"]'`) a string with
- format of a json list within strings for each python version desired.
-- `pytorch-version`: (json list of strings, default: `'["2.1.2"]'`) a string
- with format of a json list within strings for each pytorch version desired.
-- `fail-fast`: (boolean, default: `false`) to set the `fail-fast` behavior on
- the matrix strategy.
-
-A matrix strategy will be adopted from the list of python and pytorch version.
-
-### Tests typing
-This workflow ([.github/workflows/test_typing.yml](workflows/test_typing.yml)) will setup
-an environment using the [env](#Env) action, run the typing tests using mypy.
-
-Use the actions:
-- `actions/checkout`
-- `.github/actions/env`
-
-Has the inputs:
-- `os`: (string, default: `ubuntu-latest`) the OS name same as supported by [gha](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners).
-- `python-version`: (json list of strings, default: `'["3.11"]'`) a string with
- format of a json list within strings for each python version desired.
-- `pytorch-version`: (json list of strings, default: `'["2.1.2"]'`) a string
- with format of a json list within strings for each pytorch version desired.
-- `fail-fast`: (boolean, default: `false`) to set the `fail-fast` behavior on
- the matrix strategy.
-
-### Docs
-This workflow ([.github/workflows/docs.yml](workflows/docs.yml)) will setup
-an environment using the [env](#Env) action, run the docstrings tests using pytest,
-install the docs dependencies and build the html docs within sphinxs.
-
-Use the actions:
-- `actions/checkout`
-- `.github/actions/env`
-
-Has the inputs:
-- `os`: (string, default: `ubuntu-latest`) the OS name same as supported by [gha](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners).
-- `python-version`: (json list of strings, default: `'["3.11"]'`) a string with
- format of a json list within strings for each python version desired.
-- `pytorch-version`: (json list of strings, default: `'["2.1.2"]'`) a string
- with format of a json list within strings for each pytorch version desired.
-- `fail-fast`: (boolean, default: `false`) to set the `fail-fast` behavior on
- the matrix strategy.
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
deleted file mode 100644
index c8d2d49a6..000000000
--- a/.github/workflows/docs.yml
+++ /dev/null
@@ -1,66 +0,0 @@
-on:
- workflow_call:
- inputs:
- python-version:
- required: false
- type: string
- default: '["3.11"]'
- pytorch-version:
- required: false
- type: string
- default: '["2.1.2"]'
- os:
- required: false
- type: string
- default: ubuntu-latest
- fail-fast:
- required: false
- type: boolean
- default: false
-
-jobs:
- tests:
- name: docstests & sphinx-build - python-${{ matrix.python-version }}, torch-${{ matrix.pytorch-version }}
- runs-on: ubuntu-latest
- strategy:
- fail-fast: ${{ inputs.fail-fast }}
- matrix:
- python-version: ${{ fromJSON(inputs.python-version) }}
- pytorch-version: ${{ fromJSON(inputs.pytorch-version) }}
- exclude:
- - pytorch-version: '1.9.1'
- python-version: '3.10'
- - pytorch-version: '1.10.2'
- python-version: '3.10'
- - pytorch-version: '1.9.1'
- python-version: '3.11'
- - pytorch-version: '1.10.2'
- python-version: '3.11'
- - pytorch-version: '1.11.0'
- python-version: '3.11'
- - pytorch-version: '1.12.1'
- python-version: '3.11'
- - pytorch-version: '1.13.1'
- python-version: '3.11'
-
- steps:
- - name: Checkout kornia
- uses: actions/checkout@v3
-
- - name: Setting environment on ${{ inputs.os }} with python ${{ matrix.python-version }} and pytorch ${{ matrix.pytorch-version }}
- uses: ./.github/actions/env
- with:
- python-version: ${{ matrix.python-version }}
- pytorch-version: ${{ matrix.pytorch-version }}
-
- - name: Run doctest
- shell: bash -l {0}
- run: make doctest
-
- - name: Install docs deps
- shell: bash -l {0}
- run: pip install -e .[docs]
-
- - name: Build Documentation
- shell: bash -l {0}
- run: make build-docs SPHINXOPTS="-W"
diff --git a/.github/workflows/pr_test_cpu.yml b/.github/workflows/pr_test_cpu.yml
index a7c15c0f3..938390547 100644
--- a/.github/workflows/pr_test_cpu.yml
+++ b/.github/workflows/pr_test_cpu.yml
@@ -14,7 +14,6 @@ concurrency:
jobs:
tests-cpu:
- # This job run just tests not marked as slow, and desselect the dynamo tests
strategy:
fail-fast: true
matrix:
@@ -26,35 +25,27 @@ jobs:
- os: 'MacOS-latest'
pytorch-dtype: 'float64'
- uses: ./.github/workflows/tests.yml
+ uses: kornia/workflows/.github/workflows/[email protected]
with:
os: ${{ matrix.os }}
python-version: '["3.8", "3.11"]'
pytorch-version: '["1.9.1", "2.1.2"]'
pytorch-dtype: ${{ matrix.pytorch-dtype }}
+ coverage:
+ uses: kornia/workflows/.github/workflows/[email protected]
- tests-coverage:
- # This job run all test suite
- uses: ./.github/workflows/tests.yml
- with:
- python-version: '["3.11"]'
- pytorch-version: '["2.1.2"]'
- pytorch-dtype: 'float32,float64'
- coverage: true
- pytest-extra: '--runslow'
-
- test-typing:
- uses: ./.github/workflows/test_typing.yml
+ typing:
+ uses: kornia/workflows/.github/workflows/[email protected]
- test-tutorials:
- uses: ./.github/workflows/test_tutorials.yml
+ tutorials:
+ uses: kornia/workflows/.github/workflows/[email protected]
docs:
- uses: ./.github/workflows/docs.yml
+ uses: kornia/workflows/.github/workflows/[email protected]
collector:
- needs: [tests-cpu, test-tutorials, test-typing, tests-coverage, docs]
+ needs: [coverage, tests-cpu, tutorials, typing, docs]
if: always()
runs-on: ubuntu-latest
steps:
@@ -72,7 +63,7 @@ jobs:
os: ['Ubuntu-latest', 'Windows-latest'] #, 'MacOS-latest'] add it when https://github.com/pytorch/pytorch/pull/89262 be merged
pytorch-dtype: ['float32', 'float64']
- uses: ./.github/workflows/tests.yml
+ uses: kornia/workflows/.github/workflows/[email protected]
with:
os: ${{ matrix.os }}
pytorch-version: '["nightly"]'
diff --git a/.github/workflows/scheduled_test_cpu.yml b/.github/workflows/scheduled_test_cpu.yml
index ecb53943d..33554d39b 100644
--- a/.github/workflows/scheduled_test_cpu.yml
+++ b/.github/workflows/scheduled_test_cpu.yml
@@ -18,7 +18,7 @@ jobs:
# os: ['Ubuntu-latest', 'Windows-latest', 'MacOS-latest']
pytorch-dtype: ['float32', 'float64']
- uses: ./.github/workflows/tests.yml
+ uses: kornia/workflows/.github/workflows/[email protected]
with:
os: 'Ubuntu-latest'
python-version: '["3.8", "3.9", "3.10", "3.11"]'
@@ -34,7 +34,7 @@ jobs:
matrix:
pytorch-dtype: ['float32', 'float64']
- uses: ./.github/workflows/tests.yml
+ uses: kornia/workflows/.github/workflows/[email protected]
with:
os: 'Windows-latest'
python-version: '["3.11"]'
@@ -47,26 +47,19 @@ jobs:
matrix:
pytorch-dtype: ['float32', 'float64']
- uses: ./.github/workflows/tests.yml
+ uses: kornia/workflows/.github/workflows/[email protected]
with:
os: 'MacOS-latest'
pytorch-dtype: ${{ matrix.pytorch-dtype }}
- test-tutorials:
- uses: ./.github/workflows/test_tutorials.yml
+ coverage:
+ uses: kornia/workflows/.github/workflows/[email protected]
- test-typing:
- uses: ./.github/workflows/test_typing.yml
+ typing:
+ uses: kornia/workflows/.github/workflows/[email protected]
- docs:
- uses: ./.github/workflows/docs.yml
+ tutorials:
+ uses: kornia/workflows/.github/workflows/[email protected]
- tests-coverage:
- uses: ./.github/workflows/tests.yml
- with:
- python-version: '["3.11"]'
- pytorch-version: '["2.1.2"]'
- pytorch-dtype: 'float32,float64'
- coverage: true
- continue-on-error: true
- pytest-extra: '--runslow'
+ docs:
+ uses: kornia/workflows/.github/workflows/[email protected]
diff --git a/.github/workflows/scheduled_test_cpu_half.yml b/.github/workflows/scheduled_test_cpu_half.yml
deleted file mode 100644
index 00c5c6824..000000000
--- a/.github/workflows/scheduled_test_cpu_half.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: Tests on CPU (float16)
-
-on:
- push:
- branches: [test-me-*]
-# schedule:
-# - cron: "0 4 * * *"
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-jobs:
- tests-cpu:
- strategy:
- fail-fast: false
- matrix:
- os: ['Ubuntu-latest'] #, 'Windows-latest', 'MacOS-latest']
-
- uses: ./.github/workflows/tests.yml
- with:
- os: ${{ matrix.os }}
- python-version: '["3.8", , "3.11"]' # "3.9"
- pytorch-version: '["2.1.2"]' # '["1.9.1", "1.10.2", "1.11.0", "1.12.1", "1.13.1"]'
- pytorch-dtype: 'float16'
diff --git a/.github/workflows/scheduled_test_nightly.yml b/.github/workflows/scheduled_test_nightly.yml
deleted file mode 100644
index adb3c7e5d..000000000
--- a/.github/workflows/scheduled_test_nightly.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: Tests on CPU (nightly)
-
-on:
- push:
- branches: [test-me-*]
- schedule:
- - cron: "0 4 * * *"
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-jobs:
- tests-cpu:
- strategy:
- fail-fast: false
- matrix:
- os: ['Ubuntu-latest'] #, 'Windows-latest', 'MacOS-latest']
- pytorch-dtype: ['float32', 'float64']
-
- uses: ./.github/workflows/tests.yml
- with:
- os: ${{ matrix.os }}
- python-version: '["3.11"]' # "3.8", "3.9",
- pytorch-version: '["nightly"]'
- pytorch-dtype: ${{ matrix.pytorch-dtype }}
diff --git a/.github/workflows/test_tutorials.yml b/.github/workflows/test_tutorials.yml
deleted file mode 100644
index d3157cc97..000000000
--- a/.github/workflows/test_tutorials.yml
+++ /dev/null
@@ -1,82 +0,0 @@
-on:
- workflow_call:
- inputs:
- python-version:
- required: false
- type: string
- default: '["3.11"]'
- pytorch-version:
- required: false
- type: string
- default: '["2.1.2"]'
- os:
- required: false
- type: string
- default: ubuntu-latest
- fail-fast:
- required: false
- type: boolean
- default: false
-
-jobs:
- tests-tutorials:
- name: python-${{ matrix.python-version }}, torch-${{ matrix.pytorch-version }}
- runs-on: ${{ inputs.os }}
- strategy:
- fail-fast: ${{ inputs.fail-fast }}
- matrix:
- python-version: ${{ fromJSON(inputs.python-version) }}
- pytorch-version: ${{ fromJSON(inputs.pytorch-version) }}
- exclude:
- - pytorch-version: '1.9.1'
- python-version: '3.10'
- - pytorch-version: '1.10.2'
- python-version: '3.10'
- - pytorch-version: '1.9.1'
- python-version: '3.11'
- - pytorch-version: '1.10.2'
- python-version: '3.11'
- - pytorch-version: '1.11.0'
- python-version: '3.11'
- - pytorch-version: '1.12.1'
- python-version: '3.11'
- - pytorch-version: '1.13.1'
- python-version: '3.11'
-
- steps:
- - name: Checkout kornia
- uses: actions/checkout@v3
-
- - name: Setting environment on ${{ inputs.os }} with python ${{ matrix.python-version }} and pytorch ${{ matrix.pytorch-version }}
- uses: ./.github/actions/env
- with:
- python-version: ${{ matrix.python-version }}
- pytorch-version: ${{ matrix.pytorch-version }}
-
- - name: Checkout tutorials
- uses: actions/checkout@v3
- with:
- repository: 'kornia/tutorials'
- path: 'tutorials-repo/'
-
- - name: Install dependencies
- working-directory: ./tutorials-repo/
- shell: bash -l {0}
- run: |
- conda install torchvision -c pytorch
- make setup
-
- - name: Check deps
- working-directory: ./tutorials-repo/
- shell: bash -l {0}
- run: make check-deps
-
- - name: Generate tutorials
- working-directory: ./tutorials-repo/
- shell: bash -l {0}
- run: make generate
-
- - name: Run tutorials
- working-directory: ./tutorials-repo/
- shell: bash -l {0}
- run: make execute
diff --git a/.github/workflows/test_typing.yml b/.github/workflows/test_typing.yml
deleted file mode 100644
index 877b2d225..000000000
--- a/.github/workflows/test_typing.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-on:
- workflow_call:
- inputs:
- python-version:
- required: false
- type: string
- default: '["3.11"]'
- pytorch-version:
- required: false
- type: string
- default: '["2.1.2"]'
- os:
- required: false
- type: string
- default: ubuntu-latest
- fail-fast:
- required: false
- type: boolean
- default: false
-
-jobs:
- tests-typing:
- name: python-${{ matrix.python-version }}, torch-${{ matrix.pytorch-version }}
- runs-on: ${{ inputs.os }}
- strategy:
- fail-fast: ${{ inputs.fail-fast }}
- matrix:
- python-version: ${{ fromJSON(inputs.python-version) }}
- pytorch-version: ${{ fromJSON(inputs.pytorch-version) }}
- exclude:
- - pytorch-version: '1.9.1'
- python-version: '3.10'
- - pytorch-version: '1.10.2'
- python-version: '3.10'
- - pytorch-version: '1.9.1'
- python-version: '3.11'
- - pytorch-version: '1.10.2'
- python-version: '3.11'
- - pytorch-version: '1.11.0'
- python-version: '3.11'
- - pytorch-version: '1.12.1'
- python-version: '3.11'
- - pytorch-version: '1.13.1'
- python-version: '3.11'
-
- steps:
- - name: Checkout kornia
- uses: actions/checkout@v3
-
- - name: Setting environment on ${{ inputs.os }} with python ${{ matrix.python-version }} and pytorch ${{ matrix.pytorch-version }}
- uses: ./.github/actions/env
- with:
- python-version: ${{ matrix.python-version }}
- pytorch-version: ${{ matrix.pytorch-version }}
-
- - name: Run typing tests
- shell: bash -l {0}
- run: mypy --cobertura-xml-report ./
-
- # - if: always()
- # name: Upload typing coverage
- # uses: codecov/codecov-action@v3
- # with:
- # file: cobertura.xml
- # token: ${{ secrets.CODECOV_TOKEN }} # to not depend on build via GH API
- # flags: typing,${{ inputs.os }}_py-${{ matrix.python-version }}_pt-${{ matrix.pytorch-version }}_${{ inputs.pytorch-dtype }}
- # name: cpu-coverage-types
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
deleted file mode 100644
index f0013f28b..000000000
--- a/.github/workflows/tests.yml
+++ /dev/null
@@ -1,100 +0,0 @@
-on:
- workflow_call:
- inputs:
- python-version:
- required: false
- type: string
- default: '["3.11"]'
- pytorch-version:
- required: false
- type: string
- default: '["2.1.2"]'
- os:
- required: false
- type: string
- default: ubuntu-latest
- pytorch-dtype:
- required: false
- type: string
- default: 'float32'
- pytest-extra:
- required: false
- type: string
- default: '--timeout=5 -k "not test_dynamo"'
- continue-on-error:
- required: false
- type: boolean
- default: false
- fail-fast:
- required: false
- type: boolean
- default: false
- coverage:
- required: false
- type: boolean
- default: false
-
-jobs:
- tests:
- name: python-${{ matrix.python-version }}, torch-${{ matrix.pytorch-version }}
- runs-on: ${{ inputs.os }}
- strategy:
- fail-fast: ${{ inputs.fail-fast }}
- matrix:
- python-version: ${{ fromJSON(inputs.python-version) }}
- pytorch-version: ${{ fromJSON(inputs.pytorch-version) }}
- exclude:
- - pytorch-version: '1.9.1'
- python-version: '3.10'
- - pytorch-version: '1.10.2'
- python-version: '3.10'
- - pytorch-version: '1.9.1'
- python-version: '3.11'
- - pytorch-version: '1.10.2'
- python-version: '3.11'
- - pytorch-version: '1.11.0'
- python-version: '3.11'
- - pytorch-version: '1.12.1'
- python-version: '3.11'
- - pytorch-version: '1.13.1'
- python-version: '3.11'
-
- steps:
- - name: Checkout kornia
- uses: actions/checkout@v3
-
- - name: Setting environment on ${{ inputs.os }} with python ${{ matrix.python-version }} and pytorch ${{ matrix.pytorch-version }}
- uses: ./.github/actions/env
- with:
- python-version: ${{ matrix.python-version }}
- pytorch-version: ${{ matrix.pytorch-version }}
-
- - if: ${{ inputs.coverage == false}}
- name: Run CPU tests ${{ inputs.pytorch-dtype }}
- continue-on-error: ${{ inputs.continue-on-error }}
- shell: bash -l {0}
- run: pytest -v --device cpu --dtype ${{ inputs.pytorch-dtype }} ${{ inputs.pytest-extra }} ./tests/
-
- - if: ${{ inputs.coverage }}
- name: Run CPU tests coverage ${{ inputs.pytorch-dtype }}
- continue-on-error: ${{ inputs.continue-on-error }}
- shell: bash -l {0}
- run: |
- coverage erase
- coverage run -m pytest -v --device cpu --dtype ${{ inputs.pytorch-dtype }} ${{ inputs.pytest-extra }} ./tests/
-
- - if: ${{ inputs.coverage }}
- name: Coverage report
- shell: bash -l {0}
- run: |
- coverage xml -o coverage.xml # Generate the xml for the codecov
- coverage report # Print the report
-
- - if: ${{ inputs.coverage }}
- name: Upload coverage
- uses: codecov/codecov-action@v3
- with:
- file: coverage.xml
- token: ${{ secrets.CODECOV_TOKEN }} # to not depend on build via GH API
- flags: cpu,${{ inputs.os }}_py-${{ matrix.python-version }}_pt-${{ matrix.pytorch-version }}_${{ inputs.pytorch-dtype }}
- name: cpu-coverage