Renamed DicomMultiFrameStreamer to DICOMMultiFrameStreamer and FAST_M… #910
This file contains hidden or 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: CI Ubuntu | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| release: | |
| types: [ published ] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| env: | |
| BUILD_TYPE: Release | |
| ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
| jobs: | |
| build: | |
| name: Build on Ubuntu 18.04 | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: false | |
| android: true | |
| dotnet: false | |
| haskell: false | |
| large-packages: false | |
| docker-images: false | |
| swap-storage: false | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Use docker-run-action instead of container to get around githubs node20 requirement which doesn't work with ubuntu 18 | |
| - uses: addnab/docker-run-action@v3 | |
| with: | |
| image: ubuntu:18.04 | |
| options: -v ${{ github.workspace }}:${{ github.workspace }} | |
| shell: bash | |
| run: | | |
| echo "===========> Check free space" | |
| df -h | |
| echo "===========> Install dependencies" | |
| apt update && apt install -y sudo | |
| mkdir -p ${{github.workspace}}/artifacts | |
| # Get a newer version of cmake | |
| sudo apt install -y gpg wget software-properties-common lsb-release ca-certificates | |
| wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null | |
| echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null | |
| sudo apt-get update | |
| sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg | |
| sudo apt-get install kitware-archive-keyring | |
| sudo apt install -y cmake | |
| sudo apt install -y g++ patchelf | |
| sudo apt install -y libx11-dev | |
| sudo apt install -y pkgconf libusb-1.0-0-dev # Needed for realsense | |
| sudo apt install -y python3 libpython3-dev python3-pip python3-setuptools | |
| sudo pip3 install --upgrade pip | |
| pip3 install pylddwrap==1.2.* | |
| pip3 install --upgrade wheel | |
| echo "===========> Free some space" | |
| sudo apt clean | |
| sudo apt autoremove | |
| echo "===========> Install CUDA and TensorRT" | |
| wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin | |
| sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |
| sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub | |
| sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | |
| sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" | |
| sudo apt-get update | |
| sudo apt-get install -y cuda-toolkit-11-0 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev | |
| echo "===========> Set work dir" | |
| cd ${{ github.workspace }} | |
| echo "===========> Configure CMake" | |
| cmake -B build \ | |
| -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}\ | |
| -DFAST_MODULE_OpenVINO=ON \ | |
| -DFAST_MODULE_DICOM=ON \ | |
| -DFAST_MODULE_WholeSlideImaging=ON \ | |
| -DFAST_MODULE_OpenIGTLink=ON \ | |
| -DFAST_MODULE_Clarius=ON \ | |
| -DFAST_MODULE_TensorFlow=ON \ | |
| -DCUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda/" \ | |
| -DFAST_MODULE_TensorRT=ON \ | |
| -DFAST_MODULE_HDF5=ON \ | |
| -DFAST_MODULE_Plotting=ON \ | |
| -DFAST_MODULE_Python=ON \ | |
| -DFAST_MODULE_RealSense=ON \ | |
| -DFAST_BUILD_EXAMPLES=ON | |
| echo "===========> Build" | |
| cmake --build build --config ${{env.BUILD_TYPE}} -j 4 | |
| echo "===========> Free some space" | |
| df -h | |
| rm -Rf build/external/tensorflow/src/tensorflow/ | |
| rm -Rf build/external/openvino/src/openvino/ | |
| rm -Rf build/external/qt5/src/qt5/ | |
| rm -Rf build/external/clarius/src/clarius/ | |
| df -h | |
| echo "===========> Build Python Wheel" | |
| cmake --build build --config ${{env.BUILD_TYPE}} --target python-wheel -j 4 | |
| cp build/python/dist/pyfast-*.whl build/ | |
| echo "===========> Free some space" | |
| df -h | |
| rm -Rf build/python/ | |
| df -h | |
| echo "===========> Package" | |
| cmake --build build --config ${{env.BUILD_TYPE}} --target package -j 4 | |
| - name: Check C/C++ standard library version dependency | |
| run: | | |
| # Throw error if GLIBCXX dependency above 3.4.25 | |
| temp_file=$(mktemp) | |
| find . -wholename "${{ github.workspace }}/build/lib/*.so" -print0 | | |
| while IFS= read -r -d $'\0' file; do | |
| strings "$file" | grep -E "^GLIBCXX_3\.4\.(2[6-9]|[3-9][0-9])$" | | |
| while IFS= read -r line; do | |
| echo "File: $file neeeds GLIBCXX version: $line" | |
| echo "true" > $temp_file | |
| done | |
| done | |
| if grep -q "true" $temp_file; then | |
| echo "Version error found." | |
| exit 1 # indicate error to github action | |
| else | |
| echo "No version errors found." | |
| fi | |
| - name: Upload Debian package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Debian package | |
| path: ${{github.workspace}}/build/fast_*.deb | |
| if-no-files-found: error | |
| - name: Upload archive package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Archive package (tar.xz) | |
| path: ${{github.workspace}}/build/fast_*.tar.xz | |
| if-no-files-found: error | |
| - name: Upload Python wheel | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Python wheel | |
| path: ${{github.workspace}}/build/pyfast-*.whl | |
| if-no-files-found: error | |
| - name: Upload Debian package to release | |
| if: ${{ github.event_name == 'release' }} | |
| uses: svenstaro/[email protected] | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ${{github.workspace}}/build/fast_*.deb | |
| file_glob: true | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| - name: Upload archive package to release | |
| if: ${{ github.event_name == 'release' }} | |
| uses: svenstaro/[email protected] | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ${{github.workspace}}/build/fast_*.tar.xz | |
| file_glob: true | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| - name: Upload Python wheel to release | |
| if: ${{ github.event_name == 'release' }} | |
| uses: svenstaro/[email protected] | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ${{github.workspace}}/build/pyfast-*.whl | |
| file_glob: true | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| - name: Upload Python wheel to PyPi | |
| if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }} | |
| run: | | |
| pip3 install twine | |
| twine upload --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} ${{github.workspace}}/build/pyfast-*.whl | |
| test-python-wheel: | |
| name: Test Python Wheel | |
| needs: [build] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, ubuntu-22.04] | |
| python-version: ['3.8', '3.10', '3.12', '3.x'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install libpocl2 xvfb libgl1 libopengl0 libusb-1.0-0 libxcb-xinerama0 libglib2.0-0 | |
| - name: Download wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: 'Python wheel' | |
| path: ${{github.workspace}}/download/ | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Display Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Install wheel | |
| run: | | |
| cd ${{github.workspace}} | |
| python -m pip install ${{github.workspace}}/download/pyfast-*.whl | |
| - name: Import FAST with Python | |
| run: | | |
| cd ${{github.workspace}} | |
| python -c "import fast" | |
| # For old ubuntu versions we use a container | |
| test-python-wheel-container: | |
| name: Test Python Wheel on old Ubuntu versions | |
| needs: [build] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ['ubuntu:18.04', 'ubuntu:20.04'] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: 'Python wheel' | |
| path: ${{github.workspace}}/download/ | |
| - name: Run in container | |
| uses: addnab/docker-run-action@v3 | |
| with: | |
| image: ${{ matrix.os }} | |
| options: -v ${{ github.workspace }}:${{ github.workspace }} | |
| shell: bash | |
| run: | | |
| # Install dependencies | |
| apt-get update | |
| DEBIAN_FRONTEND=noninteractive apt install -y libpocl2 xvfb libgl1 libopengl0 libusb-1.0-0 libxcb-xinerama0 libxkbcommon0 python3 python3-pip libglib2.0-0 | |
| python3 -c "import sys; print(sys.version)" | |
| # Install wheel | |
| cd ${{github.workspace}} | |
| pip3 install ${{github.workspace}}/download/pyfast-*.whl | |
| # Import FAST with Python | |
| cd ${{github.workspace}} | |
| python3 -c "import fast" | |
| test-cpp: | |
| name: Run C++ Tests | |
| needs: [build] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install libpocl2t64 xvfb libgl1 libopengl0 libusb-1.0-0 libxcb-xinerama0 libxcb-icccm4 libxcb-image0 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: 'Archive package (tar.xz)' | |
| path: ${{github.workspace}}/download/ | |
| - name: Extract artifact | |
| run: | | |
| mkdir -p ${{github.workspace}}/download/ | |
| cd ${{github.workspace}}/download/ | |
| tar -xf fast_*.tar.xz -C ${{github.workspace}} | |
| - name: Cache test data | |
| id: cache-test-dataset | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/FAST/data/ | |
| key: test-dataset | |
| enableCrossOsArchive: true | |
| - name: Download test data | |
| run: | | |
| cd ${{github.workspace}} | |
| cd fast* | |
| cd fast/bin/ | |
| ./downloadTestData | |
| - name: Run tests | |
| env: | |
| DISPLAY: ':1' | |
| QT_DEBUG_PLUGINS: 1 | |
| run: | | |
| Xvfb "$DISPLAY" -screen 0 1024x768x24 & | |
| cd ${{github.workspace}} | |
| cd fast_* | |
| cd fast/bin/ | |
| ./testFAST ~[visual] | |
| test-python: | |
| name: Run Python Tests | |
| needs: [build] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install python3-virtualenv libpocl2 xvfb libgl1 libopengl0 libusb-1.0-0 libxcb-xinerama0 libxcb-icccm4 libxcb-image0 libegl1 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: 'Python wheel' | |
| path: ${{github.workspace}}/download/ | |
| - name: Create environment and install python packages | |
| run: | | |
| cd ${{github.workspace}} | |
| mkdir tmp | |
| cd tmp | |
| virtualenv -p python3 venv | |
| source venv/bin/activate | |
| pip3 install pytest numpy | |
| pip3 install torch --index-url https://download.pytorch.org/whl/cpu | |
| pip3 install ${{github.workspace}}/download/pyfast-*.whl | |
| - name: Cache test data | |
| id: cache-test-dataset | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/FAST/data/ | |
| key: test-dataset | |
| enableCrossOsArchive: true | |
| - name: Download test data | |
| run: | | |
| cd ${{github.workspace}}/tmp/ | |
| source venv/bin/activate | |
| python -c "import fast;fast.downloadTestDataIfNotExists()" | |
| - name: Run tests | |
| run: | | |
| cd ${{github.workspace}}/tmp/ | |
| source venv/bin/activate | |
| pytest ../source/FAST/ -v -k 'not test_shortcuts' | |