Fix usage of properties #112
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: wsidicomizer pytest | |
on: [push, pull_request] | |
jobs: | |
cache_test_images: | |
name: cache test images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prevent cache-miss on windows | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Load test images from cache | |
id: cache-test-images | |
uses: actions/cache@v3 | |
with: | |
key: test-images-cache-${{ hashFiles('tests/download_test_images.py') }} | |
path: WSIDICOMIZER_TESTDATA | |
enableCrossOsArchive: true | |
- name: Load test images | |
if: steps.cache-test-images.outputs.cache-hit != 'true' | |
env: | |
WSIDICOMIZER_TESTDIR: WSIDICOMIZER_TESTDATA | |
run: | | |
python -m pip install -U pip | |
python -m pip install requests | |
python tests/download_test_images.py | |
tests: | |
needs: [cache_test_images] | |
name: pytest ${{ matrix.os }}::py${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 6 | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Prevent cache-miss on windows | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Use GNU tar instead BSD tar | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" | |
- name: Load test images from cache | |
id: cache-test-images | |
uses: actions/cache@v3 | |
with: | |
key: test-images-cache-${{ hashFiles('tests/download_test_images.py') }} | |
path: WSIDICOMIZER_TESTDATA | |
enableCrossOsArchive: true | |
- name: Check test images are loaded | |
if: steps.cache-test-images.outputs.cache-hit != 'true' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.setFailed('test images were not cached') | |
- name: Set up Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install -y libturbojpeg libopenslide0 | |
- name: Set up OSX | |
if: matrix.os == 'macos-latest' | |
run: brew install jpeg-turbo openslide | |
- name: Set up Windows | |
shell: pwsh | |
if: matrix.os == 'windows-latest' | |
run: | | |
Invoke-WebRequest -Uri https://sourceforge.net/projects/libjpeg-turbo/files/2.1.4/libjpeg-turbo-2.1.4-vc64.exe/download -OutFile libjpeg-turbo-2.1.4-vc64.exe -UserAgent "NativeHost" | |
7z e libjpeg-turbo-2.1.4-vc64.exe -oC:\turbojpeg bin/turbojpeg.dll | |
Invoke-WebRequest -Uri https://github.com/openslide/openslide-winbuild/releases/download/v20221217/openslide-win64-20221217.zip -OutFile openslide-win64-20221217.zip -UserAgent "NativeHost" | |
7z e openslide-win64-20221217.zip -oC:\openslide openslide-win64-20221217\bin | |
- name: Set up paths in windows | |
if: matrix.os == 'windows-latest' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.addPath('C:\\openslide') | |
core.addPath('C:\\turbojpeg') | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry | |
- name: Install Application | |
run: python -m poetry install | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
python -m poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
python -m poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics | |
- name: Run tests | |
env: | |
TURBOJPEG: C:\turbojpeg | |
WSIDICOMIZER_TESTDIR: WSIDICOMIZER_TESTDATA | |
run: python -m poetry run pytest |