Skip to content

Commit bc13faf

Browse files
authored
Merge pull request #115 from svalinn/building_ubuntu_and_debian_inside_docker
Building ubuntu and debian inside docker
2 parents 8e41f01 + 9b5daa1 commit bc13faf

3 files changed

Lines changed: 213 additions & 56 deletions

File tree

.github/workflows/unix_linux.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: Linux builds
2+
3+
on:
4+
# allows us to run workflows manually
5+
workflow_dispatch:
6+
pull_request:
7+
branches:
8+
- develop
9+
- master
10+
push:
11+
branches:
12+
- develop
13+
- master
14+
release:
15+
types: # This configuration does not affect the page_build event above
16+
- created
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
20+
jobs:
21+
building-plugin:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
cubit: [2021.4, 2021.5]
26+
os: [ubuntu]
27+
os_version: [20.04, 21.04]
28+
include:
29+
- os: ubuntu
30+
os_version: 18.04
31+
cubit: 17.1.0
32+
33+
- os: debian
34+
os_version: '10.10' # using a 'string' here as the 0 gets rounded away otherwise
35+
cubit: 2021.5
36+
37+
38+
name: 'Cubit ${{ matrix.cubit }} Build for ${{ matrix.os }} ${{ matrix.os_version }} of Svalinn Plugin'
39+
40+
container:
41+
image: ${{ matrix.os }}:${{ matrix.os_version }}
42+
43+
steps:
44+
- name: install new git
45+
shell: bash -l {0}
46+
run: |
47+
apt-get update
48+
apt-get install -y software-properties-common curl
49+
if [ "${{ matrix.os }}" == "ubuntu" ]; then
50+
add-apt-repository ppa:git-core/ppa
51+
apt-get update
52+
fi
53+
apt-get install -y git
54+
- uses: actions/checkout@v2
55+
56+
- name: Environment Variables
57+
shell: bash -l {0}
58+
run: |
59+
COREFORM_BASE_URL=https://f002.backblazeb2.com/file/cubit-downloads/Coreform-Cubit/Releases
60+
61+
if [ "${{ matrix.cubit }}" == "17.1.0" ]; then
62+
BASE=Trelis-17.1.0
63+
BASESDK=Trelis-SDK-17.1.0
64+
CUBIT_BASE_NAME=Trelis-17.1
65+
HDF5_PATH=/usr/lib/x86_64-linux-gnu/hdf5/serial
66+
elif [ "${{ matrix.cubit }}" == "2021.4" ]; then
67+
BASE=Coreform-Cubit-2021.4%2B15017_05893177
68+
CUBIT_BASE_NAME=Coreform-Cubit-2021.4
69+
HDF5_PATH=/usr/local/HDF_Group/HDF5/1.12.0
70+
elif [ "${{ matrix.cubit }}" == "2021.5" ]; then
71+
BASE=Coreform-Cubit-2021.5%2B15962_5043ef39
72+
CUBIT_BASE_NAME=Coreform-Cubit-2021.5
73+
HDF5_PATH=/usr/local/HDF_Group/HDF5/1.12.0
74+
fi
75+
76+
SUFFIX=Lin64
77+
EXT=deb
78+
echo "SED=sed" >> $GITHUB_ENV
79+
echo "BUILD_SHARED_LIBS=ON" >> $GITHUB_ENV
80+
echo "BUILD_STATIC_LIBS=OFF" >> $GITHUB_ENV
81+
echo "system=linux" >> $GITHUB_ENV
82+
echo "CUBIT_PATH=/opt/${CUBIT_BASE_NAME}" >> $GITHUB_ENV
83+
echo "COREFORM_BASE_URL=${COREFORM_BASE_URL}/Linux/" >> $GITHUB_ENV
84+
echo "HDF5_PATH=${HDF5_PATH}" >> $GITHUB_ENV
85+
86+
echo "OS=${{ matrix.os }}" >> $GITHUB_ENV
87+
echo "OS_VERSION=${{ matrix.os_version }}" >> $GITHUB_ENV
88+
echo "CMAKE_ADDITIONAL_FLAGS=-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0" >> $GITHUB_ENV
89+
90+
echo "CUBIT_PKG=${BASE}-${SUFFIX}.${EXT}" >> $GITHUB_ENV
91+
echo "CUBIT_SDK_PKG=${BASESDK}-${SUFFIX}.tar.gz" >> $GITHUB_ENV
92+
echo "CUBIT_BASE_NAME=${CUBIT_BASE_NAME}" >> $GITHUB_ENV
93+
94+
echo "CURRENT=$(pwd)" >> $GITHUB_ENV
95+
echo "SCRIPTPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
96+
echo "PLUGIN_ABS_PATH=$GITHUB_WORKSPACE/.." >> $GITHUB_ENV
97+
echo "FOLDER_PKG=$GITHUB_WORKSPACE/pkg" >> $GITHUB_ENV
98+
99+
echo "" >> ${HOME}/.bash_profile
100+
echo "source $GITHUB_WORKSPACE/scripts/unix_share_build.sh" >> $HOME/.bash_profile
101+
102+
- name: Initial setup
103+
shell: bash -l {0}
104+
run: |
105+
${system}_install_prerequisites
106+
107+
- name: Downloading packages
108+
shell: bash -l {0}
109+
run: |
110+
mkdir -p $FOLDER_PKG
111+
cd ${FOLDER_PKG}
112+
curl -L ${COREFORM_BASE_URL}${CUBIT_PKG} --output ${CUBIT_PKG}
113+
if [ "${{ matrix.cubit }}" = "17.1.0" ]; then
114+
curl -L ${COREFORM_BASE_URL}${CUBIT_SDK_PKG} --output ${CUBIT_SDK_PKG}
115+
fi
116+
mkdir ${SCRIPTPATH}/release
117+
118+
- name: Cubit setup
119+
shell: bash -l {0}
120+
run: |
121+
${system}_setup_cubit ${{ matrix.cubit }}
122+
123+
- name: Build HDF5
124+
shell: bash -l {0}
125+
run: |
126+
${system}_build_hdf5
127+
128+
- name: Build MOAB
129+
shell: bash -l {0}
130+
run: |
131+
build_moab
132+
133+
- name: Build DAGMC
134+
shell: bash -l {0}
135+
run: |
136+
build_dagmc
137+
138+
- name: Build plugin
139+
shell: bash -l {0}
140+
run: |
141+
build_plugin
142+
143+
- name: Prepare package
144+
shell: bash -l {0}
145+
run: |
146+
${system}_build_plugin_pkg ${{ matrix.cubit }}
147+
148+
- if: github.event_name != 'release'
149+
name: Upload artifact for CI
150+
uses: actions/upload-artifact@v2
151+
with:
152+
name: svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
153+
path: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
154+
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
155+
156+
- if: github.event_name == 'release'
157+
name: Upload binaries into the release
158+
uses: svenstaro/upload-release-action@v2
159+
with:
160+
repo_token: ${{ secrets.GITHUB_TOKEN }}
161+
file: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
162+
asset_name: svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
163+
tag: ${{ github.ref }}
Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Unix
1+
name: Mac builds
22

33
on:
44
# allows us to run workflows manually
@@ -19,20 +19,14 @@ env:
1919

2020
jobs:
2121
main:
22-
runs-on: ${{ matrix.os }}
22+
runs-on: ${{ matrix.os }}-${{ matrix.os_version }}
2323
strategy:
2424
matrix:
2525
cubit: [17.1.0, 2021.4, 2021.5]
26-
os: [ubuntu-20.04, macos-10.15]
27-
include:
28-
- cubit: 17.1.0
29-
os: ubuntu-18.04
30-
exclude:
31-
- cubit: 17.1.0
32-
os: ubuntu-20.04
33-
34-
name: 'Cubit Svalinn Plugin ${{ matrix.cubit }} Build for ${{ matrix.os }}'
26+
os: [macos]
27+
os_version: [10.15]
3528

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

3731
steps:
3832
- uses: actions/checkout@v2
@@ -57,29 +51,17 @@ jobs:
5751
HDF5_PATH=/usr/local/HDF_Group/HDF5/1.12.0
5852
fi
5953
60-
if [[ "${{ matrix.os }}" == "ubuntu"* ]]; then
61-
SUFFIX=Lin64
62-
EXT=deb
63-
echo "SED=sed" >> $GITHUB_ENV
64-
echo "SUDO=sudo " >> $GITHUB_ENV
65-
echo "BUILD_SHARED_LIBS=ON" >> $GITHUB_ENV
66-
echo "BUILD_STATIC_LIBS=OFF" >> $GITHUB_ENV
67-
echo "system=linux" >> $GITHUB_ENV
68-
echo "CUBIT_PATH=/opt/${CUBIT_BASE_NAME}" >> $GITHUB_ENV
69-
echo "COREFORM_BASE_URL=${COREFORM_BASE_URL}/Linux/" >> $GITHUB_ENV
70-
echo "HDF5_PATH=${HDF5_PATH}" >> $GITHUB_ENV
71-
elif [[ "${{ matrix.os }}" == "mac"* ]]; then
72-
SUFFIX=Mac64
73-
EXT=dmg
74-
echo "SED=gsed" >> $GITHUB_ENV
75-
echo "BUILD_SHARED_LIBS=OFF" >> $GITHUB_ENV
76-
echo "BUILD_STATIC_LIBS=ON" >> $GITHUB_ENV
77-
echo "system=mac" >> $GITHUB_ENV
78-
echo "CUBIT_PATH=/Applications/${CUBIT_BASE_NAME}.app/Contents" >> $GITHUB_ENV
79-
echo "COREFORM_BASE_URL=${COREFORM_BASE_URL}/MacOS/" >> $GITHUB_ENV
80-
fi
54+
SUFFIX=Mac64
55+
EXT=dmg
56+
echo "SED=gsed" >> $GITHUB_ENV
57+
echo "BUILD_SHARED_LIBS=OFF" >> $GITHUB_ENV
58+
echo "BUILD_STATIC_LIBS=ON" >> $GITHUB_ENV
59+
echo "system=mac" >> $GITHUB_ENV
60+
echo "CUBIT_PATH=/Applications/${CUBIT_BASE_NAME}.app/Contents" >> $GITHUB_ENV
61+
echo "COREFORM_BASE_URL=${COREFORM_BASE_URL}/MacOS/" >> $GITHUB_ENV
8162
8263
echo "OS=${{ matrix.os }}" >> $GITHUB_ENV
64+
echo "OS_VERSION=${{ matrix.os_version }}" >> $GITHUB_ENV
8365
echo "CMAKE_ADDITIONAL_FLAGS=-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0" >> $GITHUB_ENV
8466
8567
echo "CUBIT_PKG=${BASE}-${SUFFIX}.${EXT}" >> $GITHUB_ENV
@@ -144,14 +126,15 @@ jobs:
144126
name: Upload artifact for CI
145127
uses: actions/upload-artifact@v2
146128
with:
147-
name: svalinn-plugin_${{ matrix.os }}_cubit_${{ matrix.cubit }}.tgz
148-
path: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}_cubit_${{ matrix.cubit }}.tgz
129+
name: svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
130+
path: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
131+
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
149132

150133
- if: github.event_name == 'release'
151134
name: Upload binaries into the release
152135
uses: svenstaro/upload-release-action@v2
153136
with:
154137
repo_token: ${{ secrets.GITHUB_TOKEN }}
155-
file: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}_cubit_${{ matrix.cubit }}.tgz
156-
asset_name: svalinn-plugin_${{ matrix.os }}_cubit_${{ matrix.cubit }}.tgz
138+
file: ${{ github.workspace }}/release/svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
139+
asset_name: svalinn-plugin_${{ matrix.os }}-${{ matrix.os_version }}_cubit_${{ matrix.cubit }}.tgz
157140
tag: ${{ github.ref }}

scripts/unix_share_build.sh

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# - SUDO : specify the command prefix to run as root (if any)
1313
# - SED : command to run sed (usually sed for linux, gsed for mac)
1414
# - OS : reference to the Operating system, used to name the plugin tarball (and when using setup_var() function)
15-
15+
# - OS_VERSION : reference to the Operating system version, used to name the plugin tarball (and when using setup_var() function)
1616

1717
set -ex
1818

@@ -25,19 +25,26 @@ function mac_install_prerequisites() {
2525
brew install eigen gcc@6 gsed
2626
}
2727

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

3333
function linux_install_prerequisites() {
3434
TZ=America/Chicago
3535
$SUDO ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
3636
$SUDO sh -c 'echo $TZ > /etc/timezone'
3737
$SUDO apt-get update -y
38-
$SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3 lsb-core
38+
if [ "$OS" == "ubuntu" ]; then
39+
$SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3 lsb-core
40+
fi
41+
if [ "$OS" == "debian" ]; then
42+
$SUDO apt-get install -y g++ libeigen3-dev patchelf git cmake curl lsb-release python3
43+
fi
3944
$SUDO update-alternatives --install /usr/bin/python python /usr/bin/python3 10; \
45+
if [ $LINUX_VERSION -lt 21 ] && [ "$OS" == "ubuntu" ]; then
4046
$SUDO update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10; \
47+
fi
4148
}
4249

4350
function setup() {
@@ -72,28 +79,31 @@ function setup_var() {
7279
return 1
7380
fi
7481

75-
if [ "OS" == "MAC" ]; then
82+
if [ "$OS" == "MAC" ]; then
7683
BUILD_SHARED_LIBS="OFF"
7784
BUILD_STATIC_LIBS="ON"
78-
elif [ "OS" == "UBUNTU"]; then
85+
elif [ "$OS" == "ubuntu"]; then
86+
BUILD_SHARED_LIBS="ON"
87+
BUILD_STATIC_LIBS="OFF"
88+
elif [ "$OS" == "debian"]; then
7989
BUILD_SHARED_LIBS="ON"
8090
BUILD_STATIC_LIBS="OFF"
8191
else
82-
echo "OS ENV variable needs to be defined to either UBUNTU or MAC"
92+
echo "OS ENV variable needs to be defined to either UBUNTU, DEBIAN or MAC"
8393
return 1
8494
fi
8595
}
8696

8797
function linux_build_hdf5() {
8898
# if ubuntu 18.04 or lower rely on apt-get hdf5
89-
ubuntu_version
90-
if [ $UBUNTU_VERSION -lt 20 ]; then
99+
unix_version
100+
if [ $LINUX_VERSION -lt 20 ] && [ "$OS" == "ubuntu" ]; then
91101
$SUDO apt-get install -y libhdf5-serial-dev
92102
else
93103
cd ${PLUGIN_ABS_PATH}
94104
mkdir -p hdf5/bld
95105
cd hdf5
96-
git clone https://github.com/HDFGroup/hdf5.git -b hdf5-1_12_0 --depth 1
106+
git clone https://github.com/HDFGroup/hdf5.git -b hdf5-1_12_0 --depth 1 --shallow-submodules
97107
cd bld
98108
cmake ../hdf5 -DBUILD_SHARED_LIBS:BOOL=ON
99109
make
@@ -110,7 +120,7 @@ function build_moab() {
110120
cd ${PLUGIN_ABS_PATH}
111121
mkdir -pv moab/bld
112122
cd moab
113-
git clone https://bitbucket.org/fathomteam/moab -b 5.3.0 --depth 1
123+
git clone https://bitbucket.org/fathomteam/moab -b 5.3.0 --depth 1 --shallow-submodules
114124
cd moab
115125
# patching MOAB CMakeLists.txt to use default find(HDF5)
116126
$SED -i "s/HDF5_MOAB/HDF5/" CMakeLists.txt
@@ -134,7 +144,7 @@ function build_dagmc(){
134144
cd ${PLUGIN_ABS_PATH}
135145
mkdir -pv DAGMC/bld
136146
cd DAGMC
137-
git clone https://github.com/svalinn/DAGMC -b develop --depth 1
147+
git clone https://github.com/svalinn/DAGMC -b develop --depth 1 --shallow-submodules
138148
cd bld
139149
cmake ../DAGMC -DMOAB_DIR=${PLUGIN_ABS_PATH}/moab \
140150
-DBUILD_UWUW=ON \
@@ -262,9 +272,10 @@ function linux_build_plugin_pkg(){
262272
cd ..
263273
ln -sv svalinn/libsvalinn_plugin.so .
264274
cd ../..
265-
tar --sort=name -czvf svalinn-plugin_${OS}_cubit_$1.tgz bin
266-
chmod 666 svalinn-plugin_${OS}_cubit_$1.tgz
267-
cp svalinn-plugin_${OS}_cubit_$1.tgz $SCRIPTPATH/release/
275+
PLUGIN_FILENAME=svalinn-plugin_${OS}-${OS_VERSION}_cubit_$1.tgz
276+
tar --sort=name -czvf ${PLUGIN_FILENAME} bin
277+
chmod 666 ${PLUGIN_FILENAME}
278+
cp ${PLUGIN_FILENAME} $SCRIPTPATH/release/
268279
}
269280

270281
function mac_build_plugin_pkg(){
@@ -287,12 +298,12 @@ function mac_build_plugin_pkg(){
287298
install_name_tool -rpath ${CUBIT_PATH}/bin ${CUBIT_PATH}/MacOS libsvalinn_plugin.so
288299
fi
289300

290-
291301
# Create the Svalinn plugin tarball
292302
cd ..
293303
ln -sv svalinn/libsvalinn_plugin.so .
294304
cd ../..
295-
tar -czvf svalinn-plugin_${OS}_cubit_${1}.tgz MacOS
296-
chmod 666 svalinn-plugin_${OS}_cubit_$1.tgz
297-
cp svalinn-plugin_${OS}_cubit_$1.tgz $SCRIPTPATH/release/
305+
PLUGIN_FILENAME=svalinn-plugin_${OS}-${OS_VERSION}_cubit_$1.tgz
306+
tar -czvf ${PLUGIN_FILENAME} MacOS
307+
chmod 666 ${PLUGIN_FILENAME}
308+
cp ${PLUGIN_FILENAME} $SCRIPTPATH/release/
298309
}

0 commit comments

Comments
 (0)