-
-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[.NET, CI] Add workflow for building native libs needed for Nuget pkg
- Loading branch information
Showing
1 changed file
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: Build Nuget package native libraries | ||
|
||
on: | ||
workflow_dispatch: | ||
# allow manual triggering of this workflow | ||
inputs: | ||
outgoing_ref: | ||
description: "The ref to be built. Can be a tag, commit hash, or branch name" | ||
required: true | ||
default: "main" | ||
push: | ||
# Run when the main branch is pushed to | ||
branches: | ||
- main | ||
pull_request: | ||
# Build when a pull request targets main | ||
branches: | ||
- main | ||
|
||
# use oldest version of OS runner availability for maximum backward compatibility | ||
# this workflow identifies different builds by their .NET Runtime Identifier (RID) | ||
# for consistency with the Nuget packaging scheme | ||
jobs: | ||
linux-x64: | ||
name: Build linux-x64 native lib | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 60 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout the repository | ||
with: | ||
submodules: recursive | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
architecture: x64 | ||
- name: Install Apt dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install libboost-dev scons | ||
# todo blas and lapack | ||
gcc --version | ||
- name: Build Cantera | ||
run: | | ||
python3 `which scons` build env_vars=all -j2 debug=n --debug=time \ | ||
system_fmt=n python_package=n | ||
- name: Upload native library | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: build/lib/libcantera_shared.so | ||
name: libcantera_shared.so-linux-64 | ||
retention-days: 7 | ||
|
||
win-x64: | ||
name: Build win-x64 native lib | ||
runs-on: windows-2019 | ||
timeout-minutes: 60 | ||
env: | ||
BOOST_ROOT: ${{github.workspace}}/3rdparty/boost | ||
BOOST_URL: https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.7z | ||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout the repository | ||
with: | ||
submodules: recursive | ||
- name: Set Up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
architecture: x64 | ||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install -U pip | ||
python -m pip install '"scons<4.4.0"' | ||
- name: Restore Boost cache | ||
uses: actions/cache@v3 | ||
id: cache-boost | ||
with: | ||
path: ${{env.BOOST_ROOT}} | ||
key: boost-178-win | ||
- name: Install Boost Headers | ||
if: steps.cache-boost.outputs.cache-hit != 'true' | ||
run: | | ||
BOOST_ROOT=$(echo $BOOST_ROOT | sed 's/\\/\//g') | ||
mkdir -p $BOOST_ROOT | ||
curl --progress-bar --location --output $BOOST_ROOT/download.7z $BOOST_URL | ||
7z -o$BOOST_ROOT x $BOOST_ROOT/download.7z -y -bd boost_1_78_0/boost | ||
mv $BOOST_ROOT/boost_1_78_0/boost $BOOST_ROOT/boost | ||
rm $BOOST_ROOT/download.7z | ||
shell: bash | ||
- name: Build Cantera | ||
run: scons build -j2 boost_inc_dir=%BOOST_ROOT% debug=n logging=debug | ||
python_package=n env_vars=USERPROFILE,GITHUB_ACTIONS | ||
msvc_version=14.1 f90_interface=n --debug=time | ||
shell: cmd | ||
- name: Upload native library | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: build/lib/cantera_shared.dll | ||
name: cantera_shared.dll-win-64 | ||
retention-days: 7 | ||
|
||
osx-x64: | ||
name: Build osx-x64 native lib | ||
runs-on: macos-11 | ||
timeout-minutes: 90 | ||
steps: | ||
# Attempt to fix intermittent cloning errors. The error message says something like | ||
# error: RPC failed; curl 18 transfer closed with outstanding read data remaining | ||
# The clone is already being done with --depth=1, so the next recommended fix is to | ||
# increase the buffer size. See also: | ||
# https://github.com/actions/virtual-environments/issues/2198 | ||
# https://stackoverflow.com/q/38618885 | ||
- name: Configure git | ||
run: /usr/local/bin/git config --global http.postBuffer 1048576000 | ||
- uses: actions/checkout@v3 | ||
name: Checkout the repository | ||
with: | ||
submodules: recursive | ||
- name: Install Brew dependencies | ||
run: brew install --display-times boost scons | ||
- name: Build Cantera | ||
run: scons build env_vars=all -j3 python_package=n debug=n --debug=time | ||
- name: Upload shared library | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: build/lib/libcantera_shared.dylib | ||
name: libcantera_shared.dylib-osx-x64 | ||
retention-days: 7 |