Skip to content

Added function template example #2460

Added function template example

Added function template example #2460

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
strategy:
max-parallel: 4
matrix:
# remove ubuntu runner for now because pip is broken on ubuntu
# with error pip._vendor.packaging.version.InvalidVersion: Invalid version: '6.5.0-1025-azure'
# and I don't have time to try to fix this
# os: [macos-14, ubuntu-latest]
os: [macos-14]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
# virtual env must be used on Linux to avoid issue with setuptools
# this action creates and activates a virtual env while also caching it
- uses: syphar/restore-virtualenv@v1
id: cache-virtualenv
with:
requirement_files: "*requirements.txt"
- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
# the package installation will only be executed when the
# requirements-files have changed.
- run: pip install -r requirements.txt
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
- run: pip install -r dev_requirements.txt
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
# - name: Install dependencies
# run: |
# python3 -m pip install --upgrade pip
# python3 -m pip install -r dev_requirements.txt
# python3 -m pip install -r requirements.txt
- name: Install exiftool
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [ "$RUNNER_OS" == "Linux" ]; then
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/runner/.bash_profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "macOS: brew should already be on path"
else
echo "$RUNNER_OS not supported"
exit 1
fi
brew install exiftool
- name: Test with pytest
run: |
python -m pytest -v tests/
- name: Send failure notification
if: ${{ failure() }}
run: |
curl \
-H "Click: https://github.com/RhetTbull/osxphotos/actions/" \
-d "osxphotos test failed" \
ntfy.sh/rhettbull_github_actions