Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

add tutorials testing ci (#2367)

João Gustavo A. Amorimf58d41c9fffb
diff --git a/.github/actions_info.md b/.github/actions_info.md
index 2a5b09971..a696693fc 100644
--- a/.github/actions_info.md
+++ b/.github/actions_info.md
@@ -47,3 +47,22 @@ Has the inputs:
the matrix strategy.
A matrix strategy will be adopted from the list of python and pytorch version.
+
+### Tests tutorials
+This workflow ([.github/workflows/tests_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.10"]'`) a string with
+ format of a json list within strings for each python version desired.
+- `pytorch-version`: (json list of strings, default: `'["2.0.0"]'`) 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.
diff --git a/.github/workflows/pr_test_cpu.yml b/.github/workflows/pr_test_cpu.yml
index 4eb72113f..c5bafa81c 100644
--- a/.github/workflows/pr_test_cpu.yml
+++ b/.github/workflows/pr_test_cpu.yml
@@ -58,6 +58,7 @@ jobs:
matrix:
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
with:
os: ${{ matrix.os }}
@@ -65,6 +66,17 @@ jobs:
pytorch-version: '["nightly"]'
pytorch-dtype: ${{ matrix.pytorch-dtype }}
+ tests-tutorials:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: ['Ubuntu-latest']
+ uses: ./.github/workflows/tests_tutorials.yml
+ with:
+ os: ${{ matrix.os }}
+ python-version: '["3.10"]'
+ pytorch-version: '["2.0.0"]'
+
# tests-cpu-half:
# strategy:
# fail-fast: false # TODO: enable it when CI be stable
diff --git a/.github/workflows/scheduled_test_cpu.yml b/.github/workflows/scheduled_test_cpu.yml
index 5e800a3c6..bef18d2b6 100644
--- a/.github/workflows/scheduled_test_cpu.yml
+++ b/.github/workflows/scheduled_test_cpu.yml
@@ -50,3 +50,14 @@ jobs:
python-version: '["3.10"]'
pytorch-version: '["2.0.0"]'
pytorch-dtype: ${{ matrix.pytorch-dtype }}
+
+ tests-tutorials:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: ['Ubuntu-latest']
+ uses: ./.github/workflows/tests_tutorials.yml
+ with:
+ os: ${{ matrix.os }}
+ python-version: '["3.10"]'
+ pytorch-version: '["2.0.0"]'
diff --git a/.github/workflows/tests_tutorials.yml b/.github/workflows/tests_tutorials.yml
new file mode 100644
index 000000000..c1cf5a290
--- /dev/null
+++ b/.github/workflows/tests_tutorials.yml
@@ -0,0 +1,72 @@
+on:
+ workflow_call:
+ inputs:
+ python-version:
+ required: false
+ type: string
+ default: '["3.10"]'
+ pytorch-version:
+ required: false
+ type: string
+ default: '["2.0.0"]'
+ 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'
+
+ 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