Skip to content

Commit 592e314

Browse files
Updated to use SMQTK-* GitHub workflows
1 parent 7daf0f5 commit 592e314

4 files changed

Lines changed: 291 additions & 136 deletions

File tree

.github/workflows/ci-unittests.yml

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
# name: CI
2+
3+
# on:
4+
# push:
5+
# branches:
6+
# - main
7+
# pull_request:
8+
# branches:
9+
# - main
10+
# - release*
11+
# schedule:
12+
# # Nightly run unit tests to check for implicit dependency issues between pull requests.
13+
# - cron: '0 0 * * *'
14+
# # Allows you to run this workflow manually from the Actions tab
15+
# workflow_dispatch:
16+
17+
# defaults:
18+
# run:
19+
# shell: bash
20+
21+
# jobs:
22+
# check_code_formatting:
23+
# name: Check code formatting with pre-commit
24+
# runs-on: ubuntu-latest
25+
# container: python:3.9
26+
# steps:
27+
# - uses: actions/checkout@v4
28+
# with:
29+
# fetch-depth: 0
30+
# - uses: actions/cache@v4
31+
# id: env-cache
32+
# with:
33+
# path: |
34+
# ~/.cache/pypoetry/virtualenvs/
35+
# ~/.local
36+
# key: python-3.9-${{ hashFiles('poetry.lock') }}
37+
# - name: Setup Environment
38+
# uses: ./.github/actions/python-poetry-setup
39+
# - name: Configure Git safe directory
40+
# run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
41+
# - name: Run pre-commit checks
42+
# run: poetry run pre-commit run --files $(find albumentations -type f)
43+
44+
# check_defaults:
45+
# name: Check defaults in apply
46+
# runs-on: ubuntu-latest
47+
# container: python:3.9
48+
# steps:
49+
# - uses: actions/checkout@v4
50+
# with:
51+
# fetch-depth: 0
52+
# - uses: actions/cache@v4
53+
# id: env-cache
54+
# with:
55+
# path: |
56+
# ~/.cache/pypoetry/virtualenvs/
57+
# ~/.local
58+
# ~/.cache/pip
59+
# ~\AppData\Local\pip\Cache
60+
# ~/Library/Caches/pip
61+
# key: python-3.9-${{ hashFiles('poetry.lock') }}
62+
# - name: Setup Environment
63+
# uses: ./.github/actions/python-poetry-setup
64+
# - name: Check defaults in apply
65+
# run: poetry run python -m tools.check_defaults
66+
67+
# check_transforms_docs:
68+
# name: Check transforms documentation is up to date
69+
# runs-on: ubuntu-latest
70+
# container: python:3.9
71+
# steps:
72+
# - uses: actions/checkout@v4
73+
# with:
74+
# fetch-depth: 0
75+
# - uses: actions/cache@v4
76+
# id: env-cache
77+
# with:
78+
# path: |
79+
# ~/.cache/pypoetry/virtualenvs/
80+
# ~/.local
81+
# ~/.cache/pip
82+
# ~\AppData\Local\pip\Cache
83+
# ~/Library/Caches/pip
84+
# key: python-3.9-${{ hashFiles('poetry.lock') }}
85+
# - name: Setup Environment
86+
# uses: ./.github/actions/python-poetry-setup
87+
# - name: Run checks for documentation
88+
# run: poetry run python -m tools.make_transforms_docs check README.md
89+
90+
# core:
91+
# name: Core tests (Python ${{ matrix.python-version }})
92+
# runs-on: ${{ matrix.operating-system }}
93+
# strategy:
94+
# matrix:
95+
# operating-system: [ubuntu-latest, windows-latest, macos-latest]
96+
# python-version: ["3.9", "3.10", "3.11", "3.12"]
97+
# include:
98+
# - operating-system: ubuntu-latest
99+
# path: ~/.cache/pip
100+
# - operating-system: windows-latest
101+
# path: ~\AppData\Local\pip\Cache
102+
# - operating-system: macos-latest
103+
# path: ~/Library/Caches/pip
104+
# fail-fast: false
105+
# container: python:${{ matrix.python-version }}
106+
# steps:
107+
# - name: Checkout
108+
# uses: actions/checkout@v4
109+
# with:
110+
# fetch-depth: 0
111+
112+
# - name: Set up Python
113+
# uses: actions/setup-python@v5
114+
# with:
115+
# python-version: ${{ matrix.python-version }}
116+
117+
# - name: Restore Python cache
118+
# uses: actions/cache/restore@v4
119+
# with:
120+
# path: |
121+
# ~/.cache/pypoetry/virtualenvs/
122+
# ~/.local
123+
# ~/.cache/pip
124+
# ~\AppData\Local\pip\Cache
125+
# ~/Library/Caches/pip
126+
# key: python-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
127+
# restore-keys: |
128+
# python-${{ matrix.python-version }}-
129+
130+
# - name: Setup Environment
131+
# uses: ./.github/actions/python-poetry-setup
132+
133+
# - name: Replace OpenCV with Headless
134+
# run: |
135+
# export PIP_LIST="$(poetry run pip list --format=json)"
136+
# if (echo "$PIP_LIST" | poetry run ./scripts/pycv2_is_installed.py)
137+
# then
138+
# echo "OpenCV-Python installed, replacing with equivalent headless version."
139+
# VERSION="$(echo "$PIP_LIST" | poetry run ./scripts/pycv2_installed_version.py)"
140+
# poetry run pip uninstall -y opencv-python opencv-python-headless
141+
# poetry run pip install --no-deps opencv-python-headless=="$VERSION"
142+
# else
143+
# echo "OpenCV-Python NOT installed, skipping."
144+
# fi
145+
146+
# - name: Run Unittests (core)
147+
# run: poetry run pytest
148+
149+
# - name: Save Python cache
150+
# uses: actions/cache/save@v4
151+
# with:
152+
# path: |
153+
# ~/.cache/pypoetry/virtualenvs/
154+
# ~/.local
155+
# ~/.cache/pip
156+
# ~\AppData\Local\pip\Cache
157+
# ~/Library/Caches/pip
158+
# key: python-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
159+
160+
# - name: Codecov report submission
161+
# if: github.event_name != 'schedule'
162+
# uses: codecov/codecov-action@v5
163+
# with:
164+
# token: ${{ secrets.CODECOV_TOKEN || '' }}
165+
# fail_ci_if_error: true
166+
# files: coverage.xml
167+
# flags: unittests
168+
169+
# # extras:
170+
# # name: Extras tests (Python ${{ matrix.python-version }}, ${{ matrix.opt-extra }})
171+
# # needs: core
172+
# # runs-on: ubuntu-latest
173+
# # strategy:
174+
# # matrix:
175+
# # python-version: ["3.9", "3.10", "3.11", "3.12"]
176+
# # opt-extra: ["hub", "torch", "text"]
177+
# # fail-fast: false
178+
# # container: python:${{ matrix.python-version }}
179+
# # steps:
180+
# # - uses: actions/checkout@v4
181+
# # with:
182+
# # fetch-depth: 0
183+
184+
# # - name: Restore Python cache
185+
# # uses: actions/cache/restore@v4
186+
# # with:
187+
# # path: |
188+
# # ~/.cache/pypoetry/virtualenvs/
189+
# # ~/.local
190+
# # ~/.cache/pip
191+
# # ~\AppData\Local\pip\Cache
192+
# # ~/Library/Caches/pip
193+
# # key: python-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
194+
# # restore-keys: |
195+
# # python-${{ matrix.python-version }}-
196+
197+
# # - name: Setup Environment
198+
# # uses: ./.github/actions/python-poetry-setup
199+
200+
# # - name: Install extras
201+
# # run: poetry install --extras "${{ matrix.opt-extra }}"
202+
203+
# # - name: Replace OpenCV with Headless
204+
# # run: |
205+
# # export PIP_LIST="$(poetry run pip list --format=json)"
206+
# # if (echo "$PIP_LIST" | poetry run ./scripts/pycv2_is_installed.py)
207+
# # then
208+
# # echo "OpenCV-Python installed, replacing with equivalent headless version."
209+
# # VERSION="$(echo "$PIP_LIST" | poetry run ./scripts/pycv2_installed_version.py)"
210+
# # poetry run pip uninstall -y opencv-python opencv-python-headless
211+
# # poetry run pip install --no-deps opencv-python-headless=="$VERSION"
212+
# # else
213+
# # echo "OpenCV-Python NOT installed, skipping."
214+
# # fi
215+
216+
# # - name: Run Unittests (extras)
217+
# # run: poetry run pytest
218+
219+
# # - name: Codecov report submission
220+
# # if: github.event_name != 'schedule'
221+
# # uses: codecov/codecov-action@v5
222+
# # with:
223+
# # token: ${{ secrets.CODECOV_TOKEN || '' }}
224+
# # fail_ci_if_error: true
225+
# # files: coverage.xml
226+
# # flags: unittests

.github/workflows/ci.yml

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
operating-system: [ubuntu-latest, windows-latest, macos-latest]
17-
python-version: [3.9, "3.10", "3.11", "3.12"]
17+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1818
include:
1919
- operating-system: ubuntu-latest
2020
path: ~/.cache/pip
@@ -26,6 +26,9 @@ jobs:
2626
steps:
2727
- name: Checkout
2828
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
2932
- name: Set up Python
3033
uses: actions/setup-python@v5
3134
with:
@@ -34,76 +37,75 @@ jobs:
3437
- name: Cache Python packages
3538
uses: actions/cache@v4
3639
with:
37-
path: ${{ matrix.path }}
38-
key: ${{ runner.os }}-uv-${{ hashFiles('**/requirements-dev.txt') }}
40+
path: ${cache-dir}/virtualenvs
41+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
3942
restore-keys: |
40-
${{ runner.os }}-uv-${{ matrix.python-version }}-
41-
${{ runner.os }}-uv-
43+
${{ runner.os }}-python-${{ matrix.python-version }}-
44+
45+
- name: Install and configure Poetry
46+
uses: snok/install-poetry@v1
4247

43-
- name: Install uv
44-
run: python -m pip install --upgrade uv
48+
# - name: Install uv
49+
# run: python -m pip install --upgrade uv
4550

46-
- name: Install PyTorch
47-
run: |
48-
if [ "${{ matrix.operating-system }}" = "macos-latest" ]; then
49-
uv pip install --system torch==2.6.0 torchvision==0.21.0
50-
else
51-
uv pip install --system torch==2.6.0+cpu torchvision==0.21.0+cpu --extra-index-url https://download.pytorch.org/whl/cpu
52-
fi
53-
shell: bash
51+
# - name: Install PyTorch
52+
# run: |
53+
# if [ "${{ matrix.operating-system }}" = "macos-latest" ]; then
54+
# uv pip install --system torch==2.6.0 torchvision==0.21.0
55+
# else
56+
# uv pip install --system torch==2.6.0+cpu torchvision==0.21.0+cpu --extra-index-url https://download.pytorch.org/whl/cpu
57+
# fi
58+
# shell: bash
5459

5560
- name: Install all dependencies
56-
run: |
57-
uv pip install --system wheel
58-
uv pip install --system -r requirements-dev.txt
59-
uv pip install --system .
61+
run: poetry install
6062

6163
- name: Run PyTest
62-
run: pytest
64+
run: poetry run pytest
6365

64-
check_code_formatting_types:
65-
name: Check code formatting with ruff and mypy
66-
runs-on: ubuntu-latest
67-
strategy:
68-
fail-fast: true
69-
matrix:
70-
python-version: ["3.9"]
71-
steps:
72-
- name: Checkout
73-
uses: actions/checkout@v4
74-
- name: Set up Python
75-
uses: actions/setup-python@v5
76-
with:
77-
python-version: ${{ matrix.python-version }}
66+
# check_code_formatting_types:
67+
# name: Check code formatting with ruff and mypy
68+
# runs-on: ubuntu-latest
69+
# strategy:
70+
# fail-fast: true
71+
# matrix:
72+
# python-version: ["3.9"]
73+
# steps:
74+
# - name: Checkout
75+
# uses: actions/checkout@v4
76+
# - name: Set up Python
77+
# uses: actions/setup-python@v5
78+
# with:
79+
# python-version: ${{ matrix.python-version }}
7880

79-
- name: Install all requirements
80-
run: |
81-
python -m pip install --upgrade uv
82-
uv pip install --system -r requirements-dev.txt
83-
uv pip install --system .
81+
# - name: Install all requirements
82+
# run: |
83+
# python -m pip install --upgrade uv
84+
# uv pip install --system -r requirements-dev.txt
85+
# uv pip install --system .
8486

85-
- name: Run checks
86-
run: pre-commit run --files $(find albumentations -type f)
87-
- name: check-defaults-in-apply
88-
run: python -m tools.check_defaults
87+
# - name: Run checks
88+
# run: pre-commit run --files $(find albumentations -type f)
89+
# - name: check-defaults-in-apply
90+
# run: python -m tools.check_defaults
8991

90-
check_transforms_docs:
91-
name: Check Readme is not outdated
92-
runs-on: ubuntu-latest
93-
strategy:
94-
matrix:
95-
python-version: [3.9]
96-
steps:
97-
- name: Checkout
98-
uses: actions/checkout@v4
99-
- name: Set up Python
100-
uses: actions/setup-python@v5
101-
with:
102-
python-version: ${{ matrix.python-version }}
103-
- name: Install all requirements
104-
run: |
105-
python -m pip install --upgrade uv
106-
uv pip install --system requests
107-
uv pip install --system .
108-
- name: Run checks for documentation
109-
run: python -m tools.make_transforms_docs check README.md
92+
# check_transforms_docs:
93+
# name: Check Readme is not outdated
94+
# runs-on: ubuntu-latest
95+
# strategy:
96+
# matrix:
97+
# python-version: [3.9]
98+
# steps:
99+
# - name: Checkout
100+
# uses: actions/checkout@v4
101+
# - name: Set up Python
102+
# uses: actions/setup-python@v5
103+
# with:
104+
# python-version: ${{ matrix.python-version }}
105+
# - name: Install all requirements
106+
# run: |
107+
# python -m pip install --upgrade uv
108+
# uv pip install --system requests
109+
# uv pip install --system .
110+
# - name: Run checks for documentation
111+
# run: python -m tools.make_transforms_docs check README.md

0 commit comments

Comments
 (0)