Imaris Extension Testing #178
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Imaris Extension Testing | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: # ignore auto-generated files, only run when source files change | |
- docs/*.html | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: # ignore auto-generated files, only run when source files change | |
- docs/*.html | |
# Enable manual running of workflow, so we can force execution | |
workflow_dispatch: | |
# run testing on the first of each month 5am ET / 9am UTC | |
schedule: | |
- cron: '0 9 1 * *' | |
jobs: | |
# linting and checking for secrets is only done once | |
# no need for multi platform/Python versions. | |
preliminary_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Run pre-commit tests | |
run: | | |
pip install pre-commit | |
pre-commit run --all-files | |
# run trufflehog3 with no-entropy because our testing code | |
# uses md5 hashes which are all high entropy | |
- name: Install and run trufflehog3 secrets scanner | |
run: | | |
python -m pip install trufflehog3 | |
trufflehog3 -v --no-entropy . && echo "tufflehog3 secrets scan passed" | |
test: | |
# only run the code testing if linting and secrets passed | |
needs: preliminary_test | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.7, "3.10"] | |
exclude: # macos-latest, 14, does not have Python 3.7, so workaround for now | |
- python-version: "3.7" | |
os: macos-latest | |
include: # Run Python 3.7 on older macos | |
- python-version: "3.7" | |
os: macos-13 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create LFS file list | |
run: | | |
git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: lfs-v1-${{ hashFiles('.lfs-assets-id') }} | |
restore-keys: | |
lfs-v1- | |
- name: Git LFS Pull | |
run: | | |
git lfs pull | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
#problems with package hashes when using latest pip so | |
#removed the pip upgrade from the run command below | |
#python -m pip install --upgrade pip | |
run: | | |
pip install -r requirements_dev.txt | |
- name: Test with pytest | |
run: | | |
python -m pytest | |
documentation: | |
# only run if this workflow was triggered by a push event on main branch | |
# either direct push to main or a merged pull request which also generates | |
# a push event. | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
# PySide6 import caused an ImportError: libEGL.so.1: cannot open shared object file: No such file or directory | |
# so installing libegl1-mesa-dev | |
run: | | |
sudo apt update | |
sudo apt install libegl1-mesa-dev | |
sudo apt install pandoc | |
python -m pip install --upgrade pip | |
pip install -r requirements_dev.txt | |
- name: Update documentation | |
run: | | |
python docs/generate_documentation.py | |
ls -la docs | |
- name: Commit and push | |
shell: bash | |
run: | # Only run if the docs changed | |
if ! git diff --quiet *.html; then | |
git config --local user.email "$(git log --format='%ae' HEAD^!)" | |
git config --local user.name "$(git log --format='%an' HEAD^!)" | |
git add docs/*.html | |
git commit -m "Adding extension documentation." | |
git push | |
fi | |
github_release: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Prepare release notes | |
run: | | |
python .github/workflows/create_release_notes.py CHANGELOG.md ${{ github.ref_name }} release_notes.txt | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: release_notes.txt |