Skip to content

Fxing segfault cause by test showing window but not closing window #1300

Fxing segfault cause by test showing window but not closing window

Fxing segfault cause by test showing window but not closing window #1300

Workflow file for this run

name: Python APP
on: [pull_request]
jobs:
fetch_cache:
name: fetch cache
runs-on: 'ubuntu-24.04'
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.12'
- '3.10'
- '3.11'
os:
# - 'ubuntu-20.04'
- 'ubuntu-24.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'
# USER_ONKODICOM_HIDDEN: '/tmp/.onkodicom'
steps:
- uses: actions/checkout@v3
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python - --version 1.8.5
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
# currently having poetry going straight to the github main branch for pyradiomics ~ 3.1.1
# - 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 mkdir -p /tmp/.onkodicom
# sudo chmod 777 /tmp/.onkodicom
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 libglut3.12 libglut-dev freeglut3-dev libgeos-c1v5 libgeos++-dev libgeos-dev libxcb-cursor0
# install everything related to xcb. libxcb-cursor0 is required for Qt >=6.5 and it has numerous dependencies
sudo apt-get install -y libxcb1 libxcb-cursor0 libxcb-glx0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render0 libxcb-render-util0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1
# 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
# Check system resources
free -m
ulimit -a
- name: Testing and Coverage with pytest
run: |
# First try single test file without coverage as part of debugging Ubuntu 24.04 build
export QT_DEBUG_PLUGINS=1
export PYTHONFAULTHANDLER=1
# export MPLBACKEND=Agg
# poetry run python -m pytest "test/test_machine_learning_preprocessing.py" -v -s
# 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.12'
- '3.10'
- '3.11'
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
# currently having poetry going straight to the github main branch for pyradiomics ~ 3.1.1
# - 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