Skip to content

Commit

Permalink
Merge pull request #24 from virtualcell/vcellstoch-testing
Browse files Browse the repository at this point in the history
Vcellstoch testing
  • Loading branch information
jcschaff authored Aug 21, 2023
2 parents 7cc90d4 + 1b9817d commit feabcc3
Show file tree
Hide file tree
Showing 43 changed files with 1,343 additions and 454 deletions.
41 changes: 41 additions & 0 deletions .github/scripts/install_name_tool_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

shopt -s -o nounset

#
# change path to bundled dylibs in executables from absolute path (usr/local/lib/) to same directory
#
for exe in `ls *_x64`
do
echo "fixing paths in ${exe}"
for libpath in `otool -L ${exe} | grep "/" | grep -v "System" | awk '{print $1}'`
do
libfilename=${libpath##*/}
echo install_name_tool -change $libpath @executable_path/$libfilename $exe
install_name_tool -change $libpath @executable_path/$libfilename $exe
done
done

#
# change path from each dylib to each other (dylibs can refer to other dylibs) from /usr/local/lib to @loader_path (same directory)
# if there is not dependency, then ignore the errors.
#
for libfilename in `ls *.dylib`
do
echo "fixing paths in ${libfilename}"
#
# set id of dynamic library to @loader_path/libname
#
echo install_name_tool -id "@loader_path/$libfilename" $libfilename
install_name_tool -id "@loader_path/$libfilename" $libfilename

for dependentlibpath in `otool -L ${libfilename} | grep "/" | grep -v "System" | awk '{print $1}'`
do
dependentlibfilename=${dependentlibpath##*/}
#
# for each library, change path to dependent libraries to be based on @loader_path
#
echo install_name_tool -change $dependentlibpath @loader_path/$dependentlibfilename $libfilename
install_name_tool -change $dependentlibpath @loader_path/$dependentlibfilename $libfilename
done
done
282 changes: 239 additions & 43 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,45 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# build-and-push-image:
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Log in to the Container registry
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
#
# - name: Build and push Docker image
# uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
# with:
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

native-build:
name:
native-build-${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [macos-latest, windows-latest, ubuntu-18.04]
# platform: [macos-latest, windows-latest, ubuntu-18.04]
platform: [macos-latest]
runs-on: ${{ matrix.platform }}

steps:
Expand Down Expand Up @@ -92,7 +93,7 @@ jobs:
-DOPTION_TARGET_FV_SOLVER=ON \
-DOPTION_TARGET_STOCHASTIC_SOLVER=ON \
-DOPTION_TARGET_NFSIM_SOLVER=ON \
-DOPTION_TARGET_MOVINGBOUNDARY_SOLVER=ON \
-DOPTION_TARGET_MOVINGBOUNDARY_SOLVER=OFF \
-DOPTION_TARGET_SUNDIALS_SOLVER=ON \
-DOPTION_TARGET_HY3S_SOLVERS=OFF \
-B . -S ..
Expand Down Expand Up @@ -125,18 +126,213 @@ jobs:
echo "------ running ziptool ------"
./bin/ziptool || true
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ failure() }}
# - name: Install Windows Dependencies
# if: matrix.platform == 'windows-latest'
# uses: msys2/setup-msys2@v2
# with:
# msystem: CLANG64
# update: true
# install: >
# git
# mingw-w64-clang-x86_64-toolchain
# mingw-w64-clang-x86_64-flang
# mingw-w64-clang-x86_64-cmake
# mingw-w64-clang-x86_64-boost
# mingw-w64-clang-x86_64-hdf5
# mingw-w64-clang-x86_64-libzip
# mingw-w64-clang-x86_64-netcdf
#
# - name: Build Windows
# if: matrix.platform == 'windows-latest'
# shell: msys2 {0}
# run: |
# platform=windows
# echo "working dir is $PWD"
#
# mkdir build
# cd build
#
# PATH="/c/Program Files/LLVM/bin:$PATH"
#
# cmake \
# -G Ninja \
# -DCMAKE_C_COMPILER=clang \
# -DCMAKE_CXX_COMPILER=clang++ \
# -DOPTION_TARGET_MESSAGING=OFF \
# -DOPTION_TARGET_PARALLEL=OFF \
# -DOPTION_TARGET_CHOMBO2D_SOLVER=OFF \
# -DOPTION_TARGET_CHOMBO3D_SOLVER=OFF \
# -DOPTION_TARGET_SMOLDYN_SOLVER=ON \
# -DOPTION_TARGET_FV_SOLVER=ON \
# -DOPTION_TARGET_STOCHASTIC_SOLVER=ON \
# -DOPTION_TARGET_NFSIM_SOLVER=ON \
# -DOPTION_TARGET_MOVINGBOUNDARY_SOLVER=OFF \
# -DOPTION_TARGET_SUNDIALS_SOLVER=ON \
# -DOPTION_TARGET_HY3S_SOLVERS=OFF \
# -B . -S ..
#
# ninja -j 1
#
# - name: Test Windows
# if: matrix.platform == 'windows-latest'
# shell: msys2 {0}
# run: |
# platform=windows
# echo "working dir is $PWD"
#
# cd build
#
# ctest -VV
#
# echo "------ running FiniteVolume_x64 ------"
# ./bin/FiniteVolume_x64 || true
# echo
# echo "------ running NFsim_x64 ------"
# ./bin/NFsim_x64 || true
# echo "------ running SundialsSolverStandalone_x64 ------"
# ./bin/SundialsSolverStandalone_x64 || true
# echo "------ running VCellStoch_x64 ------"
# ./bin/VCellStoch_x64 || true
# echo "------ running smoldyn_x64 ------"
# ./bin/smoldyn_x64 || true
# echo "------ running testzip ------"
# ./bin/testzip || true
# echo "------ running ziptool ------"
# ./bin/ziptool || true

# Uncomment to debug Windows builds
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: ${{ matrix.platform == 'windows-latest' }}
# - name: Install Linux Dependencies
# if: matrix.platform == 'ubuntu-18.04'
# run: |
# sudo apt-get update
# sudo apt-get install -y libboost-all-dev
# sudo apt-get install -y libhdf5-dev
# sudo apt-get install -y ninja-build
#
# gcc --version
# gfortran --version
# cmake --version
# dpkg -s libboost-all-dev
# dpkg -s libhdf5-dev
#
# - name: Build Linux
# if: matrix.platform == 'ubuntu-18.04'
# run: |
# platform=linux
# echo "working dir is $PWD"
#
# mkdir build
# cd build
#
# cmake \
# -G Ninja \
# -DOPTION_TARGET_MESSAGING=OFF \
# -DOPTION_TARGET_PARALLEL=OFF \
# -DOPTION_TARGET_CHOMBO2D_SOLVER=OFF \
# -DOPTION_TARGET_CHOMBO3D_SOLVER=OFF \
# -DOPTION_TARGET_SMOLDYN_SOLVER=ON \
# -DOPTION_TARGET_FV_SOLVER=ON \
# -DOPTION_TARGET_STOCHASTIC_SOLVER=ON \
# -DOPTION_TARGET_NFSIM_SOLVER=ON \
# -DOPTION_TARGET_MOVINGBOUNDARY_SOLVER=OFF \
# -DOPTION_TARGET_SUNDIALS_SOLVER=ON \
# -DOPTION_TARGET_HY3S_SOLVERS=OFF \
# -B . -S ..
#
# ninja
#
# - name: Test Linux
# if: matrix.platform == 'ubuntu-18.04'
# run: |
# platform=linux
# echo "working dir is $PWD"
#
# cd build
#
# ctest -VV
#
# echo "------ running FiniteVolume_x64 ------"
# ./bin/FiniteVolume_x64 || true
# echo
# echo "------ running NFsim_x64 ------"
# ./bin/NFsim_x64 || true
# echo "------ running SundialsSolverStandalone_x64 ------"
# ./bin/SundialsSolverStandalone_x64 || true
# echo "------ running VCellStoch_x64 ------"
# ./bin/VCellStoch_x64 || true
# echo "------ running smoldyn_x64 ------"
# ./bin/smoldyn_x64 || true
# echo "------ running testzip ------"
# ./bin/testzip || true
# echo "------ running ziptool ------"
# ./bin/ziptool || true
#

- name: fix Macos shared object paths
if: matrix.platform == 'macos-latest'
shell: bash
run: |
mkdir build/upload
cd build/bin
rm hello_test TestVCellStoch testzip ziptool || true
ls *_x64 | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dylib | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
ls *.dylib | awk '{print $1}' | xargs -I '{}' otool -L '{}' | grep ")" | grep -v "build" | grep -v "System" | awk '{print $1}' | xargs -I '{}' cp -vn '{}' . || true
chmod u+w,+x *
tar czvf ../upload/mac64_bad_paths.tgz .
../../.github/scripts/install_name_tool_macos.sh
tar czvf ../upload/mac64.tgz --dereference .
# - name: handle shared object paths for Windows native build
# if: matrix.platform == 'windows-latest'
# shell: msys2 {0}
# run: |
# cd build/bin
# ls *_x64 | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
# ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
# ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
# chmod u+w,+x *
# tar czvf ../linux64.tgz --dereference .
# cd ../..
# fi
#
# - name: handle shared object paths for Linux native build
# if: matrix.platform == 'ubuntu-18.04'
# shell: bash
# run: |
# cd build/bin
# ls *_x64 | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
# ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
# ls *.so | awk '{print $1}' | xargs -I '{}' ldd '{}' | grep "=> /" | grep -v "build" | awk '{print $3}' | xargs -I '{}' cp -vn '{}' . || true
# chmod u+w,+x *
# tar czvf ../linux64.tgz --dereference .
# cd ../..
# fi
#
- name: Upload Macos binaries
if: matrix.platform == 'macos-latest'
uses: actions/upload-artifact@v3
with:
name: mac64.tgz
path: build/upload/mac64.tgz

- name: Upload Windows binaries
if: matrix.platform == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: win64.tgz
path: build/upload/win64.tgz

- name: Upload Linux binaries
if: matrix.platform == 'ubuntu-18.04'
uses: actions/upload-artifact@v3
with:
name: linux64.tgz
path: build/upload/linux64.tgz

- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: false

# Uncomment to debug Linux builds
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: ${{ matrix.platform == 'ubuntu-18.04' }}
Loading

0 comments on commit feabcc3

Please sign in to comment.