Add tests for the code blocks in Markdown files (courtesy of @tlambert03) #10
Workflow file for this run
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: 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 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: 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) | |
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 |