Skip to content

Merge pull request #313 from sjswerdloff/grid_size_for_temp_rt_dose #989

Merge pull request #313 from sjswerdloff/grid_size_for_temp_rt_dose

Merge pull request #313 from sjswerdloff/grid_size_for_temp_rt_dose #989

Workflow file for this run

name: Python APP
on: [push, pull_request]
jobs:
fetch_cache:
name: fetch cache
runs-on: 'ubuntu-latest'
env:
TestDataUrl: 'https://zenodo.org/record/5147737/files/DICOM-RT-02.zip'
steps:
- name: Cache Test Data
id: cache-TestData
uses: actions/cache@v3
with:
enableCrossOsArchive: true
lookup-only: true
path: DICOM-RT-02.zip
key: ${{ env.TestDataUrl }}
- name: Download Test Data
if: steps.cache-TestData.outputs.cache-hit != 'true'
run: |
sudo apt-get install wget
wget -O DICOM-RT-02.zip $TestDataUrl
build_Linux:
needs: fetch_cache
strategy:
fail-fast: false
matrix:
python:
- '3.9'
- '3.10'
os:
- 'ubuntu-20.04'
# - 'ubuntu-22.04'
name: Build - ${{ matrix.os }} - Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
timeout-minutes: 40
env:
DISPLAY: ':99.0'
TestDataUrl: 'https://zenodo.org/record/5147737/files/DICOM-RT-02.zip'
steps:
- uses: actions/checkout@v3
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python -
poetry --version
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'poetry'
- name: Upgrade pip and setuptools
run: |
pip install --upgrade pip wheel setuptools
- name: Install plastimatch
run: |
sudo apt-get update
sudo apt-get install plastimatch
- name: Install dependencies
run: |
# python -m pip install --upgrade pip wheel setuptools
poetry install --no-root
- name: Workaround Install pyradiomics (no-use-pep517)
# https://github.com/AIM-Harvard/pyradiomics/issues/653#issuecomment-1245039225
# pyradiomics 3.1.0 has a metadata mismatch
run: |
poetry run pip install pyradiomics==3.0.1
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
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
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Download Cached Test Data
uses: actions/cache@v3
with:
enableCrossOsArchive: true
fail-on-cache-miss: true
path: DICOM-RT-02.zip
key: ${{ env.TestDataUrl }}
- name: Install test data
run: |
sudo apt-get install unzip
mkdir test/testdata
mkdir test/batchtestdata
unzip DICOM-RT-02.zip -d test/testdata
unzip DICOM-RT-02.zip -d test/batchtestdata
sudo chmod -R 777 test/testdata
sudo chmod -R 777 test/batchtestdata
- name: Testing setup
run: |
sudo apt-get update
sudo apt-get install xvfb libxkbcommon-x11-0 herbstluftwm libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libopengl0 freeglut3 freeglut3-dev
# sudo Xvfb :1 -screen 0 1024x768x24 </dev/null &
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX
sleep 3
herbstluftwm &
sleep 1
- name: Testing and Coverage with pytest
run: |
# Append this for fail under x percent "--cov-fail-under=80"
poetry run python -m pytest "test/" -v --durations=10 --cov-config=.coveragerc --cov-report term-missing --cov=.
build_Windows:
needs: fetch_cache
strategy:
fail-fast: false
matrix:
python:
- '3.9'
- '3.10'
os:
# - 'windows-2019'
- 'windows-2022'
name: Build - ${{ matrix.os }} - Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
timeout-minutes: 50
# Tests on Windows are unstable. We do not want it to fail the entire test result
continue-on-error: true
env:
DISPLAY: ':99.0' # do we need this in Windows?
TestDataUrl: 'https://zenodo.org/record/5147737/files/DICOM-RT-02.zip'
PlastimatchWindowsUrl: 'https://downloads.sourceforge.net/project/plastimatch/Windows%20Binaries/Plastimatch-1.9.0-win64.msi'
steps:
- uses: actions/checkout@v3
- name: Install Poetry
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
Add-Content $env:GITHUB_PATH "$env:APPDATA\Python\Scripts"
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'poetry'
- name: Upgrade pip and setuptools
run: |
python.exe -m pip install --upgrade pip wheel setuptools
- name: Install plastimatch
run: |
Invoke-WebRequest -Uri ${{ env.PlastimatchWindowsUrl }} -OutFile Plastimatch.msi
Start-Process -Wait msiexec -ArgumentList '/i Plastimatch.msi /passive'
Add-Content $env:GITHUB_PATH "C:\Program Files\Plastimatch"
- name: Install dependencies
run: |
poetry install --no-root
- name: Workaround Install pyradiomics (no-use-pep517)
# https://github.com/AIM-Harvard/pyradiomics/issues/653#issuecomment-1245039225
run: |
poetry run pip install pyradiomics==3.0.1
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
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
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Download Cached Test Data
uses: actions/cache@v3
with:
enableCrossOsArchive: true
fail-on-cache-miss: true
path: DICOM-RT-02.zip
key: ${{ env.TestDataUrl }}
- name: Install test data
run: |
7z x DICOM-RT-02.zip -o${{ github.workspace }}\test\testdata
7z x DICOM-RT-02.zip -o${{ github.workspace }}\test\batchtestdata
- name: Testing and Coverage with pytest
continue-on-error: true
run: |
# Append this for fail under x percent "--cov-fail-under=80"
# todo: currently in Windows some tests halt. Set timeout (in seconds) as a workaround.
cd ${{ github.workspace }}
poetry run python -m pytest "test/" -v --durations=10 --cov-config=.coveragerc --cov-report term-missing --cov=. --timeout=180