Skip to content

CI/CD workflow using GitHub Actions is added. #59

CI/CD workflow using GitHub Actions is added.

CI/CD workflow using GitHub Actions is added. #59

Workflow file for this run

name: BuildRoadRunner
on:
push:
branches:
- develop
pull_request:
branches:
- '**'
jobs:
build_on_OSs:
name: Build RoadRunner on ${{ matrix.platform.name }}-python${{ matrix.python_version.version }}
strategy:
fail-fast: false
matrix:
platform:
- name: macos-11-release
os_type: macos
os_name: macos-11
build_type: Release
build_tests: ON
build_plugins: ON
build_python: ON
- name: macos-11-debug
os_type: macos
os_name: macos-11
build_type: Debug
build_tests: ON
build_plugins: ON
build_python: ON
- name: macos-latest-release
os_type: macos
os_name: macos-latest
build_type: Release
build_tests: OFF
build_plugins: ON
build_python: ON
- name: macos-latest-debug
os_type: macos
os_name: macos-latest
build_type: Debug
build_tests: ON
build_plugins: ON
build_python: ON
- name: ubuntu-latest-release
os_type: ubuntu
os_name: ubuntu-latest
build_type: Release
build_tests: ON
build_plugins: ON
build_python: ON
- name: ubuntu-latest-debug
os_type: ubuntu
os_name: ubuntu-latest
build_type: Debug
build_tests: ON
build_plugins: ON
build_python: ON
- name: windows-latest-release
os_type: windows
os_name: windows-latest
build_type: Release
build_tests: ON
build_plugins: ON
build_python: ON
- name: windows-latest-debug
os_type: windows
os_name: windows-latest
build_type: Debug
build_tests: OFF
build_plugins: OFF
build_python: OFF
- name: manylinux2014-release
os_type: manylinux
os_name: ubuntu-latest
container_image: quay.io/pypa/manylinux2014_x86_64
build_type: Release
build_tests: ON
build_plugins: ON
build_python: ON
libroadrunner_deps_owner: [ "sys-bio" ]
libroadrunner_deps_repo: [ "libroadrunner-deps" ]
libroadrunner_deps_name: [ "libroadrunner-deps" ]
libroadrunner_deps_release_version: [ "v2.1.1" ]
llvm_owner: [ "sys-bio" ]
llvm_repo: [ "llvm-13.x" ]
llvm_name: [ "llvm-13.x" ]
llvm_release_version: [ "v13.0" ]
python_version:
- name: py39
version: "3.9"
run_tests: OFF
- name: py310
version: "3.10"
run_tests: OFF
- name: py311
version: "3.11"
run_tests: OFF
- name: py312
version: "3.12"
run_tests: ON
runs-on: ${{ matrix.platform.os_name }}
container:
image: ${{ matrix.platform.container_image || '' }}
steps:
- name: Checkout RoadRunner (manylinux)
if: matrix.platform.os_type == 'manylinux'
uses: actions/checkout@v4
- name: Checkout RoadRunner (non-manylinux)
if: matrix.platform.os_type != 'manylinux'
uses: actions/checkout@v4
- name: Set MSVC as the default compiler on Windows
if: matrix.platform.os_type == 'windows'
uses: ilammy/[email protected]
- name: Upgrade gcc on Linux
if: matrix.platform.os_type == 'manylinux'
shell: bash
run: |
if [ "${{ matrix.platform.os_type }}" == 'ubuntu' ]; then
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install -y gcc-11 g++-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 90
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 90
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
yum install -y centos-release-scl
yum install -y devtoolset-11
scl enable devtoolset-11 bash
echo "/opt/rh/devtoolset-11/root/usr/bin" >> "${GITHUB_PATH}"
fi
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Get Host Architecture
shell: bash
run: |
architecture=$(uname -m)
echo "host_architecture=$architecture" >> "${GITHUB_ENV}"
if [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
echo "OSX_ARCHITECTURES=$architecture" >> "${GITHUB_ENV}"
fi
- name: Install ccache
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
if [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
brew install ccache
elif [ "${{ matrix.platform.os_type }}" == 'ubuntu' ]; then
sudo apt-get update
sudo apt-get install -y ccache
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
mkdir -p ccache
cd ccache
curl -L https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1.tar.gz > ccache.tar.gz
tar -zxf ccache.tar.gz
rm ccache.tar.gz
mkdir -p build-ccache
mkdir -p install-ccache
cd build-ccache
cmake -DCMAKE_INSTALL_PREFIX="$RUNNER_WORKSPACE/ccache/install-ccache" -DCMAKE_BUILD_TYPE=Release ../ccache-4.9.1
cmake --build . --target install
echo "$RUNNER_WORKSPACE/ccache/install-ccache/bin" >> "${GITHUB_PATH}"
fi
- name: Prepare ccache timestamp on non-Windows platforms
if: matrix.platform.os_type != 'windows'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("timestamp=${current_date}" >> $GITHUB_OUTPUT)
# message("::set-output name=timestamp::${current_date}")
- name: Set ccache cache directory on non-Windows
if: matrix.platform.os_type != 'windows'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
echo "CCACHE_DIR=${RUNNER_WORKSPACE}/.ccache" >> "${GITHUB_ENV}"
echo "COMPILER_LAUNCHER=ccache" >> "${GITHUB_ENV}"
- name: Cache ccache files on manylinux
if: matrix.platform.os_type == 'manylinux'
uses: actions/cache@v3
with:
path: ${RUNNER_WORKSPACE}/.ccache
key:
${{ runner.os }}-${{ steps.ccache_cache_timestamp.outputs.timestamp
}}
restore-keys: |
${{ runner.os }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
${{ runner.os }}-
- name: Cache ccache files on non-Windows
if: matrix.platform.os_type != 'windows' && matrix.platform.os_type != 'manylinux'
uses: actions/cache@v4
with:
path: ${RUNNER_WORKSPACE}/.ccache
key:
${{ runner.os }}-${{ steps.ccache_cache_timestamp.outputs.timestamp
}}
restore-keys: |
${{ runner.os }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
${{ runner.os }}-
- name: Setup Python for non-Manylinux platforms
if: matrix.platform.build_python == 'ON' && matrix.platform.os_type != 'manylinux'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version.version }}
- name: Setup Python for Manylinux platforms
if: matrix.platform.build_python == 'ON' && matrix.platform.os_type == 'manylinux'
shell: bash
run: |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p /Miniconda3
/Miniconda3/bin/conda create -y --name py39 python=3.9 pytest
/Miniconda3/bin/conda create -y --name py310 python=3.10 pytest
/Miniconda3/bin/conda create -y --name py311 python=3.11 pytest -c conda-forge
/Miniconda3/bin/conda create -y --name py312 python=3.12 pytest -c conda-forge
/Miniconda3/bin/conda init && bash ~/.bashrc && . ~/.bashrc cd ${RUNNER_WORKSPACE}
sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure
mkdir -p install-python
if [ -z "$CFLAGS" ]; then
export CFLAGS="-fPIC"
else
export CFLAGS="$CFLAGS -fPIC"
fi
./configure --enable-optimizations --prefix=${RUNNER_WORKSPACE}/python${{ matrix.python_version.version }}/install-python
make install
echo "${RUNNER_WORKSPACE}/python${{ matrix.python_version.version }}/install-python/bin" >> "${GITHUB_PATH}"
- name: Install Python dependencies
if: matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/roadrunner
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
python -m pip install -r requirements.txt
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
python${{ matrix.python_version.version }} -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt
else
python${{ matrix.python_version.version }} -m pip install -r requirements.txt
fi
- name: Install Swig
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
# running against the latest version of swig fails, os we build version 4.0.2
if [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
brew install pcre pcre2
mkdir -p ${RUNNER_WORKSPACE}/swig
cd swig
curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.0.2/swig-4.0.2.tar.gz/download > swig.tar.gz
tar -zxf swig.tar.gz
rm swig.tar.gz
mkdir -p install-swig
cd swig-4.0.2/
./configure --prefix=${RUNNER_WORKSPACE}/swig/install-swig
make
make install
echo SWIG_DIR="-DSWIG_EXECUTABLE=${RUNNER_WORKSPACE}/swig/install-swig/bin/swig" >> "${GITHUB_ENV}"
elif [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
mkdir -p swig
cd swig
curl -L https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.0.2/swigwin-4.0.2.zip/download > swig.zip
unzip -q swig.zip -d install-swig
rm swig.zip
echo SWIG_DIR="-DSWIG_EXECUTABLE=${RUNNER_WORKSPACE}/swig/install-swig/swigwin-4.0.2/" >> "${GITHUB_PATH}"
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
yum install -y pcre-devel
mkdir -p swig
cd swig
curl -L https://sourceforge.net/projects/swig/files/swig/swig-4.0.2/swig-4.0.2.tar.gz/download > swig.tar.gz
tar -zxf swig.tar.gz
rm swig.tar.gz
mkdir -p install-swig
cd swig-4.0.2/
./configure --disable-dependency-tracking --prefix=${RUNNER_WORKSPACE}/swig/install-swig
make
make install
echo SWIG_DIR="-DSWIG_EXECUTABLE=${RUNNER_WORKSPACE}/swig/install-swig/bin/swig" >> "${GITHUB_ENV}"
fi
- name: Download LibRoadRunner Dependencies binaries
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
mkdir -p ${{ matrix.libroadrunner_deps_name }}-binaries
cd ${{ matrix.libroadrunner_deps_name }}-binaries
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
compiler_version=$(ls "C:\Program Files\Microsoft Visual Studio")
binary_file_name=${{ matrix.libroadrunner_deps_name }}-${{ matrix.platform.os_type }}-msvc${compiler_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
os_version=$(sw_vers -productVersion | cut -d '.' -f 1)
binary_file_name=${{ matrix.libroadrunner_deps_name }}-${{ matrix.platform.os_type }}-${os_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'ubuntu' ]; then
os_version=$(lsb_release -rs | cut -d '.' -f 1)
binary_file_name=${{ matrix.libroadrunner_deps_name }}-${{ matrix.platform.os_type }}-${os_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
os_name="${{ matrix.platform.name }}"
os_name_without_build_type="${os_name%%-*}"
binary_file_name=${{ matrix.libroadrunner_deps_name }}-${os_name_without_build_type}-${host_architecture}-${{ matrix.platform.build_type }}
fi
curl -LO "https://github.com/${{ matrix.libroadrunner_deps_owner }}/${{ matrix.libroadrunner_deps_repo }}/releases/download/${{ matrix.libroadrunner_deps_release_version }}/$binary_file_name.zip"
unzip -q $binary_file_name.zip
rm $binary_file_name.zip
echo RR_DEPENDENCIES_INSTALL_PREFIX="${RUNNER_WORKSPACE}/${{ matrix.libroadrunner_deps_name }}-binaries" >> "${GITHUB_ENV}"
- name: Download LLVM binaries
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
mkdir -p ${{ matrix.llvm_name }}-binaries
cd ${{ matrix.llvm_name }}-binaries
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
compiler_version=$(ls "C:\Program Files\Microsoft Visual Studio")
binary_file_name=${{ matrix.llvm_name }}-${{ matrix.platform.os_type }}-msvc${compiler_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
os_version=$(sw_vers -productVersion | cut -d '.' -f 1)
binary_file_name=${{ matrix.llvm_name }}-${{ matrix.platform.os_type }}-${os_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'ubuntu' ]; then
os_version=$(lsb_release -rs | cut -d '.' -f 1)
binary_file_name=${{ matrix.llvm_name }}-${{ matrix.platform.os_type }}-${os_version}-${host_architecture}-${{ matrix.platform.build_type }}
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
os_name="${{ matrix.platform.name }}"
os_name_without_build_type="${os_name%%-*}"
binary_file_name=${{ matrix.llvm_name }}-${os_name_without_build_type}-${host_architecture}-${{ matrix.platform.build_type }}
fi
curl -LO "https://github.com/${{ matrix.llvm_owner }}/${{ matrix.llvm_repo }}/releases/download/${{ matrix.llvm_release_version }}/$binary_file_name.zip"
unzip -q $binary_file_name.zip
rm $binary_file_name.zip
echo LLVM_INSTALL_PREFIX="${RUNNER_WORKSPACE}/${{ matrix.llvm_name }}-binaries" >> "${GITHUB_ENV}"
# make llvm-config executable
chmod a+x ${RUNNER_WORKSPACE}/${{ matrix.llvm_name }}-binaries/bin/llvm-config
- name: Create build directory
shell: bash
run: mkdir -p ${RUNNER_WORKSPACE}/build-roadrunner
- name: Configure CMake for RoadRunner
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-roadrunner
cmake $GITHUB_WORKSPACE \
-G "Ninja" \
-DCMAKE_C_COMPILER_LAUNCHER=${COMPILER_LAUNCHER} \
-DCMAKE_CXX_COMPILER_LAUNCHER=${COMPILER_LAUNCHER} \
-DCMAKE_BUILD_TYPE=${{ matrix.platform.build_type }} \
-DCMAKE_OSX_ARCHITECTURES=${OSX_ARCHITECTURES} \
-DCMAKE_INSTALL_PREFIX="${RUNNER_WORKSPACE}/install-roadrunner" \
-DRR_DEPENDENCIES_INSTALL_PREFIX=${RR_DEPENDENCIES_INSTALL_PREFIX} \
-DLLVM_INSTALL_PREFIX=${LLVM_INSTALL_PREFIX} \
-DBUILD_TESTS=${{ matrix.platform.build_tests }} \
-DBUILD_RR_PLUGINS=${{ matrix.platform.build_plugins }} \
-DBUILD_PYTHON=${{ matrix.platform.build_python }} \
${SWIG_DIR}
- name: Build and install RoadRunner
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-roadrunner
cmake --build . --target install --config ${{ matrix.platform.build_type }}
- name: Install test dependencies
if: matrix.platform.build_tests == 'ON' && matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/roadrunner
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
python -m pip install -r requirements.txt
python -m pip install -r test-requirements.txt
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
python${{ matrix.python_version.version }} -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt
python${{ matrix.python_version.version }} -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r test-requirements.txt
else
python${{ matrix.python_version.version }} -m pip install -r requirements.txt
python${{ matrix.python_version.version }} -m pip install -r test-requirements.txt
fi
- name: Run RoadRunner tests
if : matrix.platform.build_type == 'Release' && matrix.platform.build_tests == 'ON' && matrix.python_version.run_tests == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-roadrunner
ctest -C ${{ matrix.platform.build_type }} --output-on-failure --verbose --extra-verbose --progress --exclude-regex "^python_tests.*"
- name: Run RoadRunner Python tests
if : matrix.platform.build_type == 'Release' && matrix.platform.build_tests == 'ON' && matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/build-roadrunner
ctest -C ${{ matrix.platform.build_type }} --output-on-failure --verbose --extra-verbose --tests-regex ^python_tests*
- name: Set artifacts path and name
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
artifacts_name=""
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
compiler_version=$(ls "C:\Program Files\Microsoft Visual Studio")
echo "artifacts_name=roadrunner-${{ matrix.platform.os_type }}-msvc$compiler_version-${host_architecture}-${{ matrix.platform.build_type }}" >> "${GITHUB_ENV}"
elif [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
os_version=$(sw_vers -productVersion | cut -d '.' -f 1)
echo "artifacts_name=roadrunner-${{ matrix.platform.os_type }}-$os_version-${host_architecture}-${{ matrix.platform.build_type }}" >> "${GITHUB_ENV}"
elif [ "${{ matrix.platform.os_type }}" == 'ubuntu' ]; then
os_version=$(lsb_release -rs | cut -d '.' -f 1)
echo "artifacts_name=roadrunner-${{ matrix.platform.os_type }}-$os_version-${host_architecture}-${{ matrix.platform.build_type }}" >> "${GITHUB_ENV}"
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
os_name="${{ matrix.platform.name }}"
os_name_without_build_type="${os_name%%-*}"
echo "artifacts_name=roadrunner-${os_name_without_build_type}-${host_architecture}-${{ matrix.platform.build_type }}" >> "${GITHUB_ENV}"
fi
echo "artifacts_path=../install-roadrunner" >> "${GITHUB_ENV}"
- name: Upload roadrunner binaries
uses: actions/upload-artifact@v4
with:
name: ${{env.artifacts_name}}
path: ${{env.artifacts_path}}
- name: Create Python wheel artifacts
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/install-roadrunner
if [ "${{ matrix.platform.os_type }}" == 'windows' ]; then
python -m pip install setuptools wheel
python setup.py bdist_wheel
python setup_rrplugins.py bdist_wheel
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
python${{ matrix.python_version.version }} -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org setuptools wheel
python${{ matrix.python_version.version }} setup.py bdist_wheel
python${{ matrix.python_version.version }} setup_rrplugins.py bdist_wheel
else
python${{ matrix.python_version.version }} -m pip install setuptools wheel
python${{ matrix.python_version.version }} setup.py bdist_wheel
python${{ matrix.python_version.version }} setup_rrplugins.py bdist_wheel
fi
- name: Rename Python wheel artifacts
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}/install-roadrunner/dist
if [ "${{ matrix.platform.os_type }}" == 'macos' ]; then
mv libroadrunner*.whl $(echo libroadrunner*.whl | sed "s/universal2/${host_architecture}/g")
mv rrplugins*.whl $(echo rrplugins*.whl | sed "s/universal2/${host_architecture}/g")
elif [ "${{ matrix.platform.os_type }}" == 'manylinux' ]; then
mv libroadrunner*.whl $(echo libroadrunner*.whl | sed "s/linux/manylinux2014/g")
mv rrplugins*.whl $(echo rrplugins*.whl | sed "s/linux/manylinux2014/g")
fi
- name: Set Python wheel artifacts path and name
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
shell: bash
run: |
cd ${RUNNER_WORKSPACE}
roadrunner_python_wheel_file_name=$(ls install-roadrunner/dist | grep '^libroadrunner')
echo "roadrunner_python_wheel_artifacts_name=${roadrunner_python_wheel_file_name}" >> "${GITHUB_ENV}"
roadrunner_plugins_python_wheel_file_name=$(ls install-roadrunner/dist | grep '^rrplugins')
echo "roadrunner_plugins_python_wheel_artifacts_name=${roadrunner_plugins_python_wheel_file_name}" >> "${GITHUB_ENV}"
# we need to use relative path as actions/upload-artifact@v1 cannot find it on containerized runners
echo "roadrunner_python_wheel_artifacts_file=../install-roadrunner/dist/$roadrunner_python_wheel_file_name" >> "${GITHUB_ENV}"
echo "roadrunner_plugins_python_wheel_artifacts_file=../install-roadrunner/dist/$roadrunner_plugins_python_wheel_file_name" >> "${GITHUB_ENV}"
- name: Upload RoadRunner Python wheel artifacts
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
uses: actions/upload-artifact@v4
with:
name: ${{env.roadrunner_python_wheel_artifacts_name}}
path: ${{env.roadrunner_python_wheel_artifacts_file}}
- name: Upload RoadRunner Plugins Python wheel artifacts
if: matrix.platform.build_type == 'Release' && matrix.platform.build_python == 'ON'
uses: actions/upload-artifact@v4
with:
name: ${{env.roadrunner_plugins_python_wheel_artifacts_name}}
path: ${{env.roadrunner_plugins_python_wheel_artifacts_file}}