Skip to content

Commit

Permalink
use spatial-model-editor/setup-ci action, bump deps, use ninja
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Apr 11, 2024
1 parent 1c2d964 commit ae8b13a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 88 deletions.
94 changes: 18 additions & 76 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,97 +3,39 @@ name: Release Builds
on: push

env:
SME_DEPS_COMMON_VERSION: "2024.03.28"
SME_DEPS_COMMON_VERSION: "2024.04.10"
DUNE_COPASI_VERSION: "master"

jobs:
linux:
name: Linux
runs-on: ubuntu-20.04
env:
INSTALL_PREFIX: "/opt/smelibs"
SUDOCMD: "sudo"
OS_TARGET: "linux"
CC: "clang"
CXX: "clang++"
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: "ubuntu-20.04"
shell: "bash"
- os: "macos-13"
shell: "bash"
- os: "windows-2022"
shell: "msys2 {0}"
defaults:
run:
shell: bash
shell: ${{ matrix.shell }}
steps:
- name: Add llvm repo for clang 18 & install
run: |
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main"
sudo apt update -yy
sudo apt install -yy clang-18
- name: Set clang version
run: |
sudo update-alternatives --remove-all clang || echo "nothing to remove"
sudo update-alternatives --remove-all clang++ || echo "nothing to remove"
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
- name: Disable system blas/lapack
run: |
sudo rm /usr/lib/x86_64-linux-gnu/libblas*
sudo rm /usr/lib/x86_64-linux-gnu/liblapack*
- uses: spatial-model-editor/setup-ci@v1
- uses: actions/checkout@v4
- name: Build script
run: ./build.sh
- uses: actions/upload-artifact@v4
with:
name: artifacts-linux
path: ./artefacts/*

macos:
name: MacOS
runs-on: macos-13
env:
INSTALL_PREFIX: "/opt/smelibs"
SUDOCMD: "sudo"
MACOSX_DEPLOYMENT_TARGET: "11"
OS_TARGET: "osx"
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.3"
- name: Build script
run: ./build.sh
- uses: actions/upload-artifact@v4
with:
name: artifacts-macos
path: ./artefacts/*

win64:
name: Windows 64-bit
runs-on: windows-2022
env:
INSTALL_PREFIX: "/c/smelibs"
SUDOCMD: ""
OS_TARGET: "win64-mingw"
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-git-lfs make git dos2unix
- name: Build script
run: ./build.sh
- uses: actions/upload-artifact@v4
with:
name: artifacts-win64
name: artifacts-${{ matrix.os }}
path: ./artefacts/*
retention-days: 3

release:
name: Upload Binaries to GitHub Release
needs: [linux, macos, win64]
needs: [build]
runs-on: ubuntu-latest
# upload binaries to github release if commit is tagged
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand Down
21 changes: 10 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,28 @@

set -e -x

DEPSDIR=${INSTALL_PREFIX}

echo "SME_DEPS_COMMON_VERSION: ${SME_DEPS_COMMON_VERSION}"
echo "DUNE_COPASI_VERSION: ${DUNE_COPASI_VERSION}"
echo "PATH: $PATH"
echo "MSYSTEM: $MSYSTEM"

echo "Downloading static libs for OS_TARGET: $OS_TARGET"
wget "https://github.com/spatial-model-editor/sme_deps_common/releases/download/${SME_DEPS_COMMON_VERSION}/sme_deps_common_${OS_TARGET}.tgz"
tar xf sme_deps_common_${OS_TARGET}.tgz
echo "Downloading static libs for OS: $OS"
wget "https://github.com/spatial-model-editor/sme_deps_common/releases/download/${SME_DEPS_COMMON_VERSION}/sme_deps_common_${OS}.tgz"
tar xf sme_deps_common_${OS}.tgz
# copy libs to desired location: workaround for tar -C / not working on windows
if [[ "$OS_TARGET" == *"win"* ]]; then
if [[ "$OS" == *"win"* ]]; then
mv c/smelibs /c/
# ls /c/smelibs
else
$SUDOCMD mv opt/* /opt/
${SUDO_CMD} mv opt/* /opt/
# ls /opt/smelibs
fi

# export vars for duneopts script to read
export CMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}"
export CMAKE_INSTALL_PREFIX=$DEPSDIR
export MAKE_OPTIONS="-j2 VERBOSE=1"
export CMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}
export CMAKE_GENERATOR="Ninja"
export MAKE_OPTIONS="-v"
# disable gcc 10 pstl TBB backend as it uses the old TBB API
export CMAKE_CXX_FLAGS='"-fvisibility=hidden -D_GLIBCXX_USE_TBB_PAR_BACKEND=0 -DNDEBUG"'
export BUILD_SHARED_LIBS=OFF
Expand Down Expand Up @@ -69,7 +68,7 @@ sed -i.bak 's|find_package(Python|#find_package(Python|' ${INSTALL_PREFIX}/share
sed -i.bak 's|dune_python_find_package(|#dune_python_find_package(|' ${INSTALL_PREFIX}/share/dune/cmake/modules/DunePythonCommonMacros.cmake
cat ${INSTALL_PREFIX}/share/dune/cmake/modules/DunePythonCommonMacros.cmake

ls $DEPSDIR
ls ${INSTALL_PREFIX}
mkdir artefacts
cd artefacts
tar -zcf sme_deps_${OS_TARGET}.tgz $DEPSDIR/*
tar -zcf sme_deps_${OS}.tgz ${INSTALL_PREFIX}/*

0 comments on commit ae8b13a

Please sign in to comment.