Skip to content

Commit

Permalink
Merge pull request #81 from kornia/ci
Browse files Browse the repository at this point in the history
CI: Use `kornia/workflows`
  • Loading branch information
johnnv1 authored Jan 30, 2024
2 parents 6b52173 + 9b2ae82 commit 6cf3b79
Show file tree
Hide file tree
Showing 44 changed files with 246 additions and 133 deletions.
68 changes: 17 additions & 51 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,82 +14,48 @@ concurrency:

jobs:
test:
name: Run tutorials - ${{ matrix.os }}, ${{ matrix.python-version }}, ${{ matrix.pytorch-version }}
runs-on: ${{ matrix.os }}-latest

strategy:
fail-fast: false
matrix:
os: ['Ubuntu']
python-version: ['3.8', '3.10']
pytorch-version: ['2.0.1']

steps:
- uses: actions/checkout@v3

- name: Setup environment
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install pytorch
shell: bash
run: pip install torch==${{ matrix.pytorch-version }} torchvision --index-url https://download.pytorch.org/whl/cpu

kornia-ref: ['main'] # TODO: coverage check through multiple versions: , 'v0.7.1', 'v0.7.0']

- name: Install dependencies
shell: bash -l {0}
run: |
pip install -r requirements.txt --upgrade
pip install -r requirements-dev.txt --upgrade
- name: Check deps
shell: bash -l {0}
run: make check-deps

- name: Generate tutorials
shell: bash -l {0}
run: make generate

- name: Run tutorials
shell: bash -l {0}
run: make execute
uses: kornia/workflows/.github/workflows/[email protected]
with:
ref: ${{ matrix.kornia-ref }}

build:
needs: test
name: Build tutorials - ${{ matrix.os }}, ${{ matrix.python-version }}, ${{ matrix.pytorch-version }}
name: Build tutorials
runs-on: ${{ matrix.os }}-latest

strategy:
matrix:
os: ['Ubuntu']
python-version: ['3.10']
pytorch-version: ['2.0.1']
os: ['ubuntu']
kornia-ref: ['main']

steps:
- uses: actions/checkout@v3
- uses: kornia/workflows/.github/actions/[email protected]
with:
ref: ${{ matrix.kornia-ref }}

- name: Setup conda dependencies
uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
repository: 'kornia/tutorials'
path: 'tutorials-repo/'

- name: Install dependencies
working-directory: ./tutorials-repo/
shell: bash -l {0}
run: |
conda install pytorch=${{ matrix.pytorch-version }} torchvision cpuonly -c pytorch
pip install -r requirements.txt --upgrade
pip install -r requirements-dev.txt --upgrade
run: make setup

- uses: quarto-dev/quarto-actions/setup@v2

- name: Check deps
working-directory: ./tutorials-repo/
shell: bash -l {0}
run: make check-deps

- name: Render Quarto Project
uses: quarto-dev/quarto-actions/render@v2
with:
to: html
path: .
path: ./tutorials-repo/
66 changes: 32 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,38 @@ jobs:
runs-on: ${{ matrix.os }}-latest

strategy:
fail-fast: true
matrix:
os: ['Ubuntu']
python-version: ['3.10']
pytorch-version: ['2.0.1']
os: ['ubuntu']
kornia-ref: ['main']

steps:
- uses: actions/checkout@v3
- name: Setup conda dependencies
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}

- name: Install dependencies
shell: bash -l {0}
run: |
conda install pytorch=${{ matrix.pytorch-version }} torchvision cpuonly -c pytorch
pip install -r requirements.txt
pip install -r requirements-dev.txt;
- uses: quarto-dev/quarto-actions/setup@v2

- name: Render Quarto Project
uses: quarto-dev/quarto-actions/render@v2
with:
to: html
path: .

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
publish_dir: ./_site
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
- uses: kornia/workflows/.github/actions/[email protected]
with:
ref: ${{ matrix.kornia-ref }}

- uses: actions/checkout@v4
with:
repository: 'kornia/tutorials'
path: 'tutorials-repo/'

- name: Install dependencies
working-directory: ./tutorials-repo/
shell: bash -l {0}
run: make setup

- uses: quarto-dev/quarto-actions/setup@v2

- name: Render Quarto Project
uses: quarto-dev/quarto-actions/render@v2
with:
to: html
path: ./tutorials-repo/

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
publish_dir: ./_site
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,3 @@ repos:
args: ['--profile=black']
- id: nbqa-black
args: ['--nbqa-dont-skip-bad-cells', '--line-length=128']

- repo: https://github.com/fastai/nbdev/
rev: 2.3.13
hooks:
- id: nbdev_clean
args: ['--fname', './']
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ setup-quarto:

setup:
pip install -r requirements.txt && pip install -r requirements-dev.txt;
make setup-quarto

preview:
quarto preview .
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ $ make preview
$ quarto preview .
```

For Linux users, you can use the `make setup` which will download and install the quarto binary for linux. And pip install
the requirements.
For Linux users, you can use the `make setup-quarto` which will download and install the quarto binary for linux.
And the `make setup` which will pip install the requirements.

### How to add a new tutorial

Expand Down
6 changes: 5 additions & 1 deletion nbs/aliased_and_not_aliased_patch_extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/canny.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/color_conversions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/color_raw_to_rgb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/color_yuv420_to_rgb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/connected_components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/data_augmentation_2d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/data_augmentation_kornia_lightning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/data_augmentation_mosiac.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/data_augmentation_segmentation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/data_augmentation_sequential.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"!pip install kornia\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/data_patch_sequential.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"!pip install kornia\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/descriptors_matching.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/extract_combine_patches.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
"cell_type": "code",
"execution_count": null,
"id": "611b350e",
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
6 changes: 5 additions & 1 deletion nbs/face_detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"skip-execution"
]
},
"outputs": [],
"source": [
"%%capture\n",
Expand Down
Loading

0 comments on commit 6cf3b79

Please sign in to comment.