Skip to content

CI

CI #295

Workflow file for this run

name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
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:
jobs:
core:
name: Unit Tests
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
- operating-system: ubuntu-latest
path: ~/.cache/pypoetry
- operating-system: windows-latest
path: ~\AppData\Local\pypoetry\Cache
- operating-system: macos-latest
path: ~/Library/Caches/pypoetry
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Restore Python cache
uses: actions/cache/restore@v4
with:
path: ${{ matrix.path }}/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-
- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install all dependencies
run: poetry install
shell: bash
- name: Install PyTorch
run: |
if [ "${{ matrix.operating-system }}" = "macos-latest" ]; then
poetry run pip install torch==2.10.0 torchvision==0.25.0
else
poetry run pip install torch==2.10.0+cpu torchvision==0.25.0+cpu --extra-index-url https://download.pytorch.org/whl/cpu
fi
shell: bash
- name: Run PyTest
env:
# macOS-arm64 only: numkong and torch each ship their own libomp,
# which dyld loads as two separate runtimes. Concurrent OMP work
# from both copies segfaults torch tensor ops mid-suite. Pinning
# OMP to one thread eliminates the contention.
OMP_NUM_THREADS: ${{ matrix.operating-system == 'macos-latest' && '1' || '' }}
run: poetry run pytest
shell: bash
- name: Save Python cache
uses: actions/cache/save@v4
with:
path: ${{ matrix.path }}/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
pre_commit_hooks:
name: Check Pre-Commit Hooks
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
python-version: ["3.10"]
include:
- operating-system: ubuntu-latest
path: ~/.cache/pypoetry
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Restore Python cache
uses: actions/cache/restore@v4
with:
path: ${{ matrix.path }}/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-
- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install all dependencies
run: poetry install
- name: Run checks
run: poetry run pre-commit run --files $(find albumentations albucore -type f)
check_defaults_in_apply:
name: Check Defaults In Apply
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
python-version: ["3.10"]
include:
- operating-system: ubuntu-latest
path: ~/.cache/pypoetry
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Restore Python cache
uses: actions/cache/restore@v4
with:
path: ${{ matrix.path }}/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-
- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Install all dependencies
run: poetry install
- name: check-defaults-in-apply
run: poetry run python -m tools.check_defaults