Skip to content

[pre-commit.ci] pre-commit autoupdate #510

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #510

name: Continuous Integration - Quality & Unit Tests
on: [push, pull_request]
jobs:
continuous-integration-quality-unit-tests:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
python-version: ["3.10", 3.11, 3.12, 3.13]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Environment Variables
run: |
echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
echo "CI_PACKAGE=colour_hdri" >> $GITHUB_ENV
echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
echo "MPLBACKEND=AGG" >> $GITHUB_ENV
shell: bash
- name: Set up Python 3.10 for Pre-Commit
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies (macOS)
if: matrix.os == 'macOS-latest'
run: |
brew install dcraw exiftool
brew install --cask adobe-dng-converter
brew install freeimage
# TODO: Drop when https://github.com/imageio/imageio/issues/628 is addressed
echo "IMAGEIO_FREEIMAGE_LIB=/opt/homebrew/Cellar/freeimage/3.18.0/lib/libfreeimage.3.18.0.dylib" >> $GITHUB_ENV
- name: Install Dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get --yes install dcraw exiftool
- name: Install Dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
curl -L https://exiftool.org/exiftool-12.98_64.zip -o exiftool-12.98_64.zip
unzip -d exiftool exiftool-12.98_64.zip
cp exiftool/exiftool-12.98_64/exiftool\(-k\).exe exiftool/exiftool-12.98_64/exiftool.exe
echo "$PWD/exiftool/exiftool-12.98_64" | sed -e 's/^\///' -e 's/\//\\/g' -e 's/^./\0:/' >> $GITHUB_PATH
curl -L https://cdn.fastpictureviewer.com/bin/dcraw.zip?v=201605100 -o dcraw.zip
unzip -d dcraw dcraw.zip
echo "$PWD/dcraw" | sed -e 's/^\///' -e 's/\//\\/g' -e 's/^./\0:/' >> $GITHUB_PATH
shell: bash
- name: Install Adobe DNG Converter (Windows)
if: matrix.os == 'windows-latest'
run: |
curl -L https://download.adobe.com/pub/adobe/dng/win/DNGConverter_11_4.exe -o DNGConverter_11_4.exe
DNGConverter_11_4.exe /S
shell: cmd
- name: Add Adobe DNG Converter to %PATH% (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "C:\Program Files\Adobe\Adobe DNG Converter" >> $GITHUB_PATH
shell: bash
- name: Install uv
run: |
pip install uv
shell: bash
- name: Install Package Dependencies
run: |
uv sync --all-extras --no-dev
uv run python -c "import imageio;imageio.plugins.freeimage.download()"
shell: bash
- name: Pre-Commit (All Files)
run: |
uv run pre-commit run --all-files
shell: bash
- name: Test Optimised Python Execution
run: |
uv run python -OO -c "import $CI_PACKAGE"
shell: bash
- name: Test with Pytest
run: |
uv run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
shell: bash
- name: Upload Coverage to coveralls.io
if: matrix.os == 'macOS-latest' && matrix.python-version == '3.12'
run: |
if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else uv run coveralls; fi
shell: bash