Skip to content

Add tests for the code blocks in Markdown files (courtesy of @tlambert03) #13

Add tests for the code blocks in Markdown files (courtesy of @tlambert03)

Add tests for the code blocks in Markdown files (courtesy of @tlambert03) #13

Workflow file for this run

name: Test docs
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test_release:
name: Test docs on latest release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python:
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip acquire-imaging
pip install -r tests/requirements-test.txt
- name: Test docs
run: |
python -m pytest -k test_tutorials --tb=short -s --color=yes --maxfail=5 --log-cli-level=0
test_prerelease:
name: Test docs on latest prerelease
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python:
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Check for a pre-release
run: |
export VER=$(curl -s https://pypi.org/rss/project/acquire-imaging/releases.xml | sed -n 's/\s*<title>\([^<]*\).*/ \1/p' | paste -sd, | cut -d, -f2 | awk '{print $1}')
if [[ $VER == *"rc"* ]]; then
echo "PRELEASE=1" >> $GITHUB_ENV
echo "PRELEASE_VERSION=$VER" >> $GITHUB_ENV
else
echo "PRELEASE=0" >> $GITHUB_ENV
fi
shell: bash
- name: Install dependencies
if: env.PRELEASE == 1
run: |
python -m pip install --upgrade pip acquire-imaging==$PRELEASE_VERSION
pip install -r tests/requirements-test.txt
- name: Test docs
if: env.PRELEASE == 1
run: |
python -m pytest -k test_tutorials --tb=short -s --color=yes --maxfail=5 --log-cli-level=0