Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building ubuntu and debian inside docker #115

Merged
merged 26 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
91c017d
isolated mac build
shimwell Aug 9, 2021
7e8acb0
isolated ubuntu and debian builds
shimwell Aug 9, 2021
add0e6d
split into two scripts
shimwell Aug 9, 2021
5fa3236
accomdated os version and os debian
shimwell Aug 9, 2021
df9f994
changed run-on cmd to include mac version
shimwell Aug 9, 2021
ee908bb
adding RPATH back in
shimwell Aug 9, 2021
74a9fc9
renamed actions
shimwell Aug 9, 2021
11004ff
updated to moab 5.3.0 version
shimwell Aug 9, 2021
61cfc42
shallow clone of submodules for speedy download
shimwell Aug 9, 2021
bb0fed3
Merge branch 'develop' into building_ubuntu_and_debian_inside_docker
shimwell Aug 9, 2021
e3d1603
removed some mac specific code
shimwell Aug 9, 2021
9ca5be2
Merge branch 'building_ubuntu_and_debian_inside_docker' of github.com…
shimwell Aug 9, 2021
c240997
comment from review
shimwell Aug 9, 2021
ea85835
trigger error when no asset file found
shimwell Aug 10, 2021
e634ff8
added os_version to unix build macro
shimwell Aug 10, 2021
63cd0ae
using varible for filename
shimwell Aug 10, 2021
24534f2
Merge pull request #116 from svalinn/option_1_for_getting_os_version
shimwell Aug 10, 2021
06ce7c6
raise error if mac of build doesn't make a file
shimwell Aug 10, 2021
6dc6a66
sudo and os_version set as enviromental varibles
shimwell Aug 10, 2021
1eb8739
no longer setting SUDO to empty string
shimwell Aug 10, 2021
8cb3fdc
using strings for os_version to avoid rounding
shimwell Aug 10, 2021
90feb37
adding more combination of os and os version for builds
shimwell Aug 10, 2021
089a9ad
reversed name to make jobs more readable
shimwell Aug 10, 2021
631f97d
simplified build matrix with less cubit 17.0.1 builds
shimwell Aug 10, 2021
c29347b
adding ubuntu 18.04 to the matrix
shimwell Aug 10, 2021
9b5daa1
removing ubuntu 18.04 from matrix
shimwell Aug 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 43 additions & 26 deletions .github/workflows/unix.yml → .github/workflows/unix_linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unix
name: Linux builds

on:
# allows us to run workflows manually
Expand All @@ -18,23 +18,49 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
main:
runs-on: ${{ matrix.os }}
building-plugin:
runs-on: ubuntu-latest
strategy:
matrix:
cubit: [17.1.0, 2021.4, 2021.5]
os: [ubuntu-20.04, macos-10.15]
cubit: [2021.5]
os: [ubuntu]
os_version: [21.04]
include:
- cubit: 17.1.0
os: ubuntu-18.04
exclude:
- cubit: 17.1.0
os: ubuntu-20.04

name: 'Cubit Svalinn Plugin ${{ matrix.cubit }} Build for ${{ matrix.os }}'
# this combination is in the inital matrix
# - os: ubuntu
# os_version: 21.04
# cubit: 2021.5

- os: ubuntu
os_version: 20.04
cubit: 2021.5

- os: debian
os_version: 10.10
cubit: 2021.5

name: 'Cubit Svalinn Plugin ${{ matrix.cubit }} Build for ${{ matrix.os }} ${{ matrix.os_version }}'

container:
image: ${{ matrix.os }}:${{ matrix.os_version }}

steps:
- name: install new git
shell: bash -l {0}
run: |
if [ "${{ matrix.os }}" == "ubuntu" ]; then
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:git-core/ppa
apt-get update
apt-get install -y git
elif [ "${{ matrix.os }}" == "debian" ]; then
apt update
apt-get install -y software-properties-common
apt update
shimwell marked this conversation as resolved.
Show resolved Hide resolved
apt install -y git
fi
- uses: actions/checkout@v2

- name: Environment Variables
Expand All @@ -57,26 +83,16 @@ jobs:
HDF5_PATH=/usr/local/HDF_Group/HDF5/1.12.0
fi

if [[ "${{ matrix.os }}" == "ubuntu"* ]]; then
if [ "${{ matrix.os }}" == "debian" ] || [ "${{ matrix.os }}" == "ubuntu" ]; then
shimwell marked this conversation as resolved.
Show resolved Hide resolved
SUFFIX=Lin64
EXT=deb
echo "SED=sed" >> $GITHUB_ENV
echo "SUDO=sudo " >> $GITHUB_ENV
shimwell marked this conversation as resolved.
Show resolved Hide resolved
echo "BUILD_SHARED_LIBS=ON" >> $GITHUB_ENV
echo "BUILD_STATIC_LIBS=OFF" >> $GITHUB_ENV
echo "system=linux" >> $GITHUB_ENV
echo "CUBIT_PATH=/opt/${CUBIT_BASE_NAME}" >> $GITHUB_ENV
echo "COREFORM_BASE_URL=${COREFORM_BASE_URL}/Linux/" >> $GITHUB_ENV
echo "HDF5_PATH=${HDF5_PATH}" >> $GITHUB_ENV
elif [[ "${{ matrix.os }}" == "mac"* ]]; then
SUFFIX=Mac64
EXT=dmg
echo "SED=gsed" >> $GITHUB_ENV
echo "BUILD_SHARED_LIBS=OFF" >> $GITHUB_ENV
echo "BUILD_STATIC_LIBS=ON" >> $GITHUB_ENV
echo "system=mac" >> $GITHUB_ENV
echo "CUBIT_PATH=/Applications/${CUBIT_BASE_NAME}.app/Contents" >> $GITHUB_ENV
echo "COREFORM_BASE_URL=${COREFORM_BASE_URL}/MacOS/" >> $GITHUB_ENV
fi

echo "OS=${{ matrix.os }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -104,6 +120,7 @@ jobs:
run: |
mkdir -p $FOLDER_PKG
cd ${FOLDER_PKG}
apt-get install -y curl
shimwell marked this conversation as resolved.
Show resolved Hide resolved
curl -L ${COREFORM_BASE_URL}${CUBIT_PKG} --output ${CUBIT_PKG}
if [ "${{ matrix.cubit }}" = "17.1.0" ]; then
curl -L ${COREFORM_BASE_URL}${CUBIT_SDK_PKG} --output ${CUBIT_SDK_PKG}
Expand Down Expand Up @@ -144,14 +161,14 @@ jobs:
name: Upload artifact for CI
uses: actions/upload-artifact@v2
with:
name: svalinn-plugin_${{ matrix.os }}_cubit_${{ matrix.cubit }}.tgz
path: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}_cubit_${{ matrix.cubit }}.tgz
name: svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
shimwell marked this conversation as resolved.
Show resolved Hide resolved
path: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
shimwell marked this conversation as resolved.
Show resolved Hide resolved

- if: github.event_name == 'release'
name: Upload binaries into the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}_cubit_${{ matrix.cubit }}.tgz
asset_name: svalinn-plugin_${{ matrix.os }}_cubit_${{ matrix.cubit }}.tgz
file: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
asset_name: svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
tag: ${{ github.ref }}
139 changes: 139 additions & 0 deletions .github/workflows/unix_mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Mac builds

on:
# allows us to run workflows manually
workflow_dispatch:
pull_request:
branches:
- develop
- master
push:
branches:
- develop
- master
release:
types: # This configuration does not affect the page_build event above
- created
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
main:
runs-on: ${{ matrix.os }}-${{ matrix.os_version }}
strategy:
matrix:
cubit: [17.1.0, 2021.4, 2021.5]
os: [macos]
os_version: [10.15]

name: 'Cubit Svalinn Plugin ${{ matrix.cubit }} Build for ${{ matrix.os }} ${{ matrix.os_version }}'


steps:
- uses: actions/checkout@v2

- name: Environment Variables
shell: bash -l {0}
run: |
COREFORM_BASE_URL=https://f002.backblazeb2.com/file/cubit-downloads/Coreform-Cubit/Releases

if [ "${{ matrix.cubit }}" == "17.1.0" ]; then
BASE=Trelis-17.1.0
BASESDK=Trelis-SDK-17.1.0
CUBIT_BASE_NAME=Trelis-17.1
HDF5_PATH=/usr/lib/x86_64-linux-gnu/hdf5/serial
elif [ "${{ matrix.cubit }}" == "2021.4" ]; then
BASE=Coreform-Cubit-2021.4%2B15017_05893177
CUBIT_BASE_NAME=Coreform-Cubit-2021.4
HDF5_PATH=/usr/local/HDF_Group/HDF5/1.12.0
elif [ "${{ matrix.cubit }}" == "2021.5" ]; then
BASE=Coreform-Cubit-2021.5%2B15962_5043ef39
CUBIT_BASE_NAME=Coreform-Cubit-2021.5
HDF5_PATH=/usr/local/HDF_Group/HDF5/1.12.0
fi

SUFFIX=Mac64
EXT=dmg
echo "SED=gsed" >> $GITHUB_ENV
echo "BUILD_SHARED_LIBS=OFF" >> $GITHUB_ENV
echo "BUILD_STATIC_LIBS=ON" >> $GITHUB_ENV
echo "system=mac" >> $GITHUB_ENV
echo "CUBIT_PATH=/Applications/${CUBIT_BASE_NAME}.app/Contents" >> $GITHUB_ENV
echo "COREFORM_BASE_URL=${COREFORM_BASE_URL}/MacOS/" >> $GITHUB_ENV

echo "OS=${{ matrix.os }}" >> $GITHUB_ENV
echo "CMAKE_ADDITIONAL_FLAGS=-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0" >> $GITHUB_ENV

echo "CUBIT_PKG=${BASE}-${SUFFIX}.${EXT}" >> $GITHUB_ENV
echo "CUBIT_SDK_PKG=${BASESDK}-${SUFFIX}.tar.gz" >> $GITHUB_ENV
echo "CUBIT_BASE_NAME=${CUBIT_BASE_NAME}" >> $GITHUB_ENV

echo "CURRENT=$(pwd)" >> $GITHUB_ENV
echo "SCRIPTPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "PLUGIN_ABS_PATH=$GITHUB_WORKSPACE/.." >> $GITHUB_ENV
echo "FOLDER_PKG=$GITHUB_WORKSPACE/pkg" >> $GITHUB_ENV

echo "" >> ${HOME}/.bash_profile
echo "source $GITHUB_WORKSPACE/scripts/unix_share_build.sh" >> $HOME/.bash_profile

- name: Initial setup
shell: bash -l {0}
run: |
${system}_install_prerequisites

- name: Downloading packages
shell: bash -l {0}
run: |
mkdir -p $FOLDER_PKG
cd ${FOLDER_PKG}
curl -L ${COREFORM_BASE_URL}${CUBIT_PKG} --output ${CUBIT_PKG}
if [ "${{ matrix.cubit }}" = "17.1.0" ]; then
curl -L ${COREFORM_BASE_URL}${CUBIT_SDK_PKG} --output ${CUBIT_SDK_PKG}
fi
mkdir ${SCRIPTPATH}/release

- name: Cubit setup
shell: bash -l {0}
run: |
${system}_setup_cubit ${{ matrix.cubit }}

- name: Build HDF5
shell: bash -l {0}
run: |
${system}_build_hdf5

- name: Build MOAB
shell: bash -l {0}
run: |
build_moab

- name: Build DAGMC
shell: bash -l {0}
run: |
build_dagmc

- name: Build plugin
shell: bash -l {0}
run: |
build_plugin

- name: Prepare package
shell: bash -l {0}
run: |
${system}_build_plugin_pkg ${{ matrix.cubit }}

- if: github.event_name != 'release'
name: Upload artifact for CI
uses: actions/upload-artifact@v2
with:
name: svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
path: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
shimwell marked this conversation as resolved.
Show resolved Hide resolved

- if: github.event_name == 'release'
name: Upload binaries into the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
asset_name: svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
tag: ${{ github.ref }}
36 changes: 22 additions & 14 deletions scripts/unix_share_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# - SED : command to run sed (usually sed for linux, gsed for mac)
# - OS : reference to the Operating system, used to name the plugin tarball (and when using setup_var() function)


set -ex


Expand All @@ -25,19 +24,26 @@ function mac_install_prerequisites() {
brew install eigen gcc@6 gsed
}

function ubuntu_version() {
export UBUNTU_VERSION=$(lsb_release -rs |cut -d"." -f1)
echo "Ubuntu Version: " $UBUNTU_VERSION
function unix_version() {
export LINUX_VERSION=$(lsb_release -rs |cut -d"." -f1)
echo "Linux Version: " $LINUX_VERSION
}

function linux_install_prerequisites() {
TZ=America/Chicago
$SUDO ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
$SUDO sh -c 'echo $TZ > /etc/timezone'
$SUDO apt-get update -y
$SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3 lsb-core
if [ "$OS" == "ubuntu" ]; then
$SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3 lsb-core
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that this script relies on SUDO but it never gets set. Current behavior is probably that this resolves to nothing and doesn't matter... but we should either remove the $SUDO here, or set the variable as appropriate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now set SUDO to an empty string in the mac and linux github actions scripts in commit 6dc6a66

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that setting of SUDO to an empty string appears to have not worked

fi
if [ "$OS" == "debian" ]; then
$SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3
fi
$SUDO update-alternatives --install /usr/bin/python python /usr/bin/python3 10; \
if [ $LINUX_VERSION -lt 21 ] && [ "$OS" == "ubuntu" ]; then
$SUDO update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10; \
fi
}

function setup() {
Expand Down Expand Up @@ -72,28 +78,31 @@ function setup_var() {
return 1
fi

if [ "OS" == "MAC" ]; then
if [ "$OS" == "MAC" ]; then
BUILD_SHARED_LIBS="OFF"
BUILD_STATIC_LIBS="ON"
elif [ "OS" == "UBUNTU"]; then
elif [ "$OS" == "ubuntu"]; then
BUILD_SHARED_LIBS="ON"
BUILD_STATIC_LIBS="OFF"
elif [ "$OS" == "debian"]; then
BUILD_SHARED_LIBS="ON"
BUILD_STATIC_LIBS="OFF"
else
echo "OS ENV variable needs to be defined to either UBUNTU or MAC"
echo "OS ENV variable needs to be defined to either UBUNTU, DEBIAN or MAC"
return 1
fi
}

function linux_build_hdf5() {
# if ubuntu 18.04 or lower rely on apt-get hdf5
ubuntu_version
if [ $UBUNTU_VERSION -lt 20 ]; then
unix_version
if [ $LINUX_VERSION -lt 20 ] && [ "$OS" == "ubuntu" ]; then
$SUDO apt-get install -y libhdf5-serial-dev
else
cd ${PLUGIN_ABS_PATH}
mkdir -p hdf5/bld
cd hdf5
git clone https://github.com/HDFGroup/hdf5.git -b hdf5-1_12_0 --depth 1
git clone https://github.com/HDFGroup/hdf5.git -b hdf5-1_12_0 --depth 1 --shallow-submodules
cd bld
cmake ../hdf5 -DBUILD_SHARED_LIBS:BOOL=ON
make
Expand All @@ -110,7 +119,7 @@ function build_moab() {
cd ${PLUGIN_ABS_PATH}
mkdir -pv moab/bld
cd moab
git clone https://bitbucket.org/fathomteam/moab -b 5.3.0 --depth 1
git clone https://bitbucket.org/fathomteam/moab -b 5.3.0 --depth 1 --shallow-submodules
cd moab
# patching MOAB CMakeLists.txt to use default find(HDF5)
$SED -i "s/HDF5_MOAB/HDF5/" CMakeLists.txt
Expand All @@ -134,7 +143,7 @@ function build_dagmc(){
cd ${PLUGIN_ABS_PATH}
mkdir -pv DAGMC/bld
cd DAGMC
git clone https://github.com/svalinn/DAGMC -b develop --depth 1
git clone https://github.com/svalinn/DAGMC -b develop --depth 1 --shallow-submodules
cd bld
cmake ../DAGMC -DMOAB_DIR=${PLUGIN_ABS_PATH}/moab \
-DBUILD_UWUW=ON \
Expand Down Expand Up @@ -287,7 +296,6 @@ function mac_build_plugin_pkg(){
install_name_tool -rpath ${CUBIT_PATH}/bin ${CUBIT_PATH}/MacOS libsvalinn_plugin.so
fi


# Create the Svalinn plugin tarball
cd ..
ln -sv svalinn/libsvalinn_plugin.so .
Expand Down