Skip to content

CI Ubuntu 18.04

CI Ubuntu 18.04 #643

Workflow file for this run

name: CI Ubuntu 18.04
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:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
build:
name: Build
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-20.04
container:
image: ubuntu:18.04
steps:
- name: Check free space
run: |
df -h
- uses: actions/checkout@v2
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
- name: Install dependencies
run: |
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 '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt install -y libopenslide-dev libjpeg-turbo8-dev # Needed for WSI module
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 numpy==1.19.5 pylddwrap==1.2.0 twine wheel==0.37.1
- name: Install CUDA and TensorRT
run: |
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 libcudnn8 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev
- name: Configure CMake
run: |
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
- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}} -j 4
- name: Free some space
run: |
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
- name: Build Python wheel
run: |
cmake --build build --config ${{env.BUILD_TYPE}} --target python-wheel -j 4
cp build/python/dist/pyFAST-*.whl build/
- name: Free some space
run: |
df -h
rm -Rf build/python/
df -h
- name: Package
run: |
cmake --build build --config ${{env.BUILD_TYPE}} --target package -j 4
- name: Upload Debian package
uses: actions/upload-artifact@v3
with:
name: Debian package
path: ${{github.workspace}}/build/fast_*.deb
if-no-files-found: error
- name: Upload archive package
uses: actions/upload-artifact@v3
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@v3
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/upload-release-action@2.7.0
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/upload-release-action@2.7.0
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/upload-release-action@2.7.0
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: |
twine upload --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} ${{github.workspace}}/build/pyFAST-*.whl
test-cpp:
name: Run C++ Tests
needs: [build]
runs-on: [self-hosted, linux]
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
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: Download test data
run: |
cd ${{github.workspace}}
cd fast*
cd fast/bin/
./downloadTestData
- name: Run tests
env:
DISPLAY: ':1'
run: |
cd ${{github.workspace}}
cd fast_*
cd fast/bin/
./testFAST ~[visual]
- name: Cleanup
if: always()
run: |
rm -Rf ${{github.workspace}}
rm -Rf $HOME/FAST/kernel_binaries/*
test-python:
name: Run Python Tests
needs: [build]
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v3
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
pip3 install ${{github.workspace}}/download/pyFAST-*.whl
- name: Run tests
env:
DISPLAY: ':1'
run: |
cd ${{github.workspace}}/tmp/
source venv/bin/activate
pytest ../source/FAST/
- name: Cleanup
if: always()
run: |
rm -Rf ${{github.workspace}}/download/
rm -Rf ${{github.workspace}}/tmp/
rm -Rf $HOME/FAST/kernel_binaries/*