Stiffness file reading correction #376
Workflow file for this run
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
name: CMake | |
on: | |
push: | |
branches: [ $default-branch, master ] | |
pull_request: | |
branches: | |
- "**" | |
permissions: write-all | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
VTK_VERSION_MAJOR: 9 | |
VTK_VERSION_MINOR: 3 | |
VTK_VERSION_PATCH: 1 | |
jobs: | |
create_release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create_release.outputs.id }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'push' | |
- name: moordyn_tag_name | |
id: moordyn_tag_name | |
shell: bash | |
run: | | |
major=`cat CMakeLists.txt | grep MOORDYN_MAJOR_VERSION | head -1 | awk -F' ' '{print $2}' | awk -F')' '{print $1}'` | |
minor=`cat CMakeLists.txt | grep MOORDYN_MINOR_VERSION | head -1 | awk -F' ' '{print $2}' | awk -F')' '{print $1}'` | |
patch=`cat CMakeLists.txt | grep MOORDYN_PATCH_VERSION | head -1 | awk -F' ' '{print $2}' | awk -F')' '{print $1}'` | |
echo "moordyn_tag_name=v$major.$minor.$patch" >> $GITHUB_OUTPUT | |
if: github.event_name == 'push' | |
# - uses: dev-drprasad/[email protected] | |
# continue-on-error: true | |
# with: | |
# delete_release: true | |
# tag_name: "nightly" | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# if: github.event_name == 'push' | |
- uses: rickstaa/action-create-tag@v1 | |
id: create_tag | |
with: | |
tag: ${{steps.moordyn_tag_name.outputs.moordyn_tag_name}} | |
message: "Latest release (${{steps.moordyn_tag_name.outputs.moordyn_tag_name}})" | |
force_push_tag: true | |
if: github.event_name == 'push' | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{steps.moordyn_tag_name.outputs.moordyn_tag_name}} | |
release_name: ${{steps.moordyn_tag_name.outputs.moordyn_tag_name}} | |
draft: false | |
prerelease: false | |
if: github.event_name == 'push' | |
build: | |
runs-on: ${{ matrix.os }} | |
needs: [create_release] | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, windows-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: moordyn_version | |
id: moordyn_version | |
shell: bash | |
run: | | |
major=`cat CMakeLists.txt | grep MOORDYN_MAJOR_VERSION | head -1 | awk -F' ' '{print $2}' | awk -F')' '{print $1}'` | |
minor=`cat CMakeLists.txt | grep MOORDYN_MINOR_VERSION | head -1 | awk -F' ' '{print $2}' | awk -F')' '{print $1}'` | |
patch=`cat CMakeLists.txt | grep MOORDYN_PATCH_VERSION | head -1 | awk -F' ' '{print $2}' | awk -F')' '{print $1}'` | |
echo "moordyn_version=$major.$minor.$patch" >> $GITHUB_OUTPUT | |
- name: Setup GCC Fortran (Linux) | |
uses: awvwgk/setup-fortran@main | |
id: setup-fortran | |
with: | |
compiler: gcc | |
if: runner.os == 'Linux' | |
- name: Install VTK (Linux) | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -qq -y install libvtk9-dev | |
if: runner.os == 'Linux' | |
- name: Install VTK (MacOS) | |
run: | | |
brew install vtk | |
if: runner.os == 'MacOS' | |
- name: download pre-built VTK static library | |
uses: suisei-cn/[email protected] | |
with: | |
url: https://github.com/sanguinariojoe/vtk-builds/releases/download/VTK-${{env.VTK_VERSION_MAJOR}}.${{env.VTK_VERSION_MINOR}}.${{env.VTK_VERSION_PATCH}}-static/vtk-${{runner.os}}-x86_64.tar.gz | |
target: ${{github.workspace}}/ | |
if: runner.os == 'Windows' | |
- name: Create VTK folder | |
run: | | |
mkdir -p ${{github.workspace}}/vtk | |
if: runner.os == 'Windows' | |
- name: Extract VTK tgz | |
run: | | |
tar -xvzf vtk-${{runner.os}}-x86_64.tar.gz -C vtk/ | |
if: runner.os == 'Windows' | |
- name: Create install folder | |
run: | | |
mkdir -p ${{github.workspace}}/install | |
- name: Configure CMake (Linux) | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DEXTERNAL_EIGEN:BOOL=OFF -DPYTHON_WRAPPER:BOOL=OFF -DFORTRAN_WRAPPER:BOOL=ON -DRUST_WRAPPER:BOOL=OFF -DUSE_VTK=ON -DBUILD_TESTING=ON | |
if: runner.os == 'Linux' | |
- name: Configure CMake (MacOS) | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DEXTERNAL_EIGEN:BOOL=OFF -DPYTHON_WRAPPER:BOOL=OFF -DFORTRAN_WRAPPER:BOOL=OFF -DRUST_WRAPPER:BOOL=OFF -DUSE_VTK=ON -DBUILD_TESTING=ON | |
if: runner.os == 'MacOS' | |
- name: Configure CMake (Windows) | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DEXTERNAL_EIGEN:BOOL=OFF -DPYTHON_WRAPPER:BOOL=OFF -DFORTRAN_WRAPPER:BOOL=OFF -DRUST_WRAPPER:BOOL=OFF -DUSE_VTK=ON -DVTK_DIR=${{github.workspace}}/vtk/lib/cmake/vtk-${{env.VTK_VERSION_MAJOR}}.${{env.VTK_VERSION_MINOR}}/ -DMOORDYN_PACKAGE_IGNORE_VTK_DEPENDENCY=ON -DBUILD_TESTING=ON | |
if: runner.os == 'Windows' | |
- name: Build | |
id: build | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
# We do a little hack here. We install the library so we perfectly know the | |
# path. Then we set the environment variable to let the OS find the | |
# libraries | |
- name: Install | |
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Set $PATH (Windows) | |
run: Add-Content $env:GITHUB_PATH "${{github.workspace}}\install\bin" | |
if: runner.os == 'Windows' | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# We are just testing in Linux | |
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure | |
- name: Create Installer | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
# Package the installer | |
run: cpack -C ${{env.BUILD_TYPE}} | |
- name: Upload Linux installer | |
id: upload-linux-installer | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{github.workspace}}/build/Moordyn-${{steps.moordyn_version.outputs.moordyn_version}}-Linux.sh | |
asset_name: Moordyn-${{steps.moordyn_version.outputs.moordyn_version}}-Linux.sh | |
asset_content_type: application/exe | |
if: ${{ (github.event_name == 'push') && (runner.os == 'Linux') }} | |
- name: Upload MacOS installer | |
id: upload-macos-installer | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{github.workspace}}/build/Moordyn-${{steps.moordyn_version.outputs.moordyn_version}}-Darwin.sh | |
asset_name: Moordyn-${{steps.moordyn_version.outputs.moordyn_version}}-Darwin.sh | |
asset_content_type: application/exe | |
if: ${{ (github.event_name == 'push') && (runner.os == 'MacOS') }} | |
- name: Upload Windows installer | |
id: upload-windows-installer | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{github.workspace}}/build/Moordyn-${{steps.moordyn_version.outputs.moordyn_version}}-win64.exe | |
asset_name: Moordyn-${{steps.moordyn_version.outputs.moordyn_version}}-win64.exe | |
asset_content_type: application/exe | |
if: ${{ (github.event_name == 'push') && (runner.os == 'Windows') }} |