Skip to content

opensim-application-core-PR #5

opensim-application-core-PR

opensim-application-core-PR #5

name: opensim-application-core-PR
on:
workflow_dispatch:
inputs:
distinct_id:
jobs:
windows:
name: Windows
runs-on: windows-2019
steps:
- name: echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo ${{ github.event.inputs.distinct_id }}
- name: Checkout opensim-gui
uses: actions/checkout@v3
- name: Install SWIG
run: |
choco install swig --version 4.1.1 --yes --limit-output --allow-downgrade
swig -swiglib
- name: Install Python packages
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install NumPy
run: python3 -m pip install numpy==1.20.2
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
- name: Install Netbeans 12.3
# Make sure the NetBeans installer is not corrupted.
run: |
(New-Object System.Net.WebClient).DownloadFile("https://archive.apache.org/dist/netbeans/netbeans/12.3/Apache-NetBeans-12.3-bin-windows-x64.exe", "Apache-NetBeans-12.3-bin-windows-x64.exe")
$expectedHash = "0695d87d9c72dcf3738672ba83eb273dda02066fa5eee80896cb6ccf79175840367a13d22ab3cb9838dffaa9a219dd1f73aee0e27c085e5310da2e3bbbc92b2c"
$hashFromFile = Get-FileHash -Algorithm SHA512 -Path .\Apache-NetBeans-12.3-bin-windows-x64.exe
if (($hashFromFile.Hash) -ne ($expectedHash)) { Write-Error "Hash doesn't match." }
.\Apache-NetBeans-12.3-bin-windows-x64.exe --silent | Out-Null # This installer is gregarious.
echo "ANT_HOME=C:\\Program Files\\NetBeans-12.0\\netbeans\\extide\\ant" >> $GITHUB_ENV
- name: Checkout opensim-core pr branch
uses: actions/checkout@v3
with:
repository: opensim-org/opensim-core
path: 'opensim-core'
# obtain commit hash from event
ref: ${{ github.event.inputs.commit }}
- name: Cache opensim-core-dependencies
id: cache-dependencies
uses: actions/cache@v3
with:
path: ~/opensim_dependencies_install
# Every time a cache is created, it's stored with this key.
# In subsequent runs, if the key matches the key of an existing cache,
# then the cache is used. We chose for this key to depend on the
# operating system and a hash of the hashes of all files in the
# dependencies directory (non-recursive).
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
key: ${{ runner.os }}-dependencies-${{ hashFiles('opensim-core/dependencies/*') }}
- name: Build opensim-core-dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
echo $env:GITHUB_WORKSPACE\\build_deps
mkdir $env:GITHUB_WORKSPACE\\build_deps
chdir $env:GITHUB_WORKSPACE\\build_deps
# gci -r $env:GITHUB_WORKSPACE\\opensim-core
# /W0 disables warnings. The other flags are copied from CMake's
# default CMAKE_CXX_FLAGS.
# https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
$env:CXXFLAGS = "/W0"
cmake $env:GITHUB_WORKSPACE/opensim-core/dependencies -G"Visual Studio 16 2019" -A x64 -DSUPERBUILD_ezc3d:BOOL=on -DOPENSIM_WITH_CASADI:BOOL=on -DWIG_DIR=C:/ProgramData/chocolatey/lib/swig -DOPENSIM_WITH_TROPTER:BOOL=on -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.8.10\x64
$env:CXXFLAGS = ""
cmake . -LAH
cmake --build . --config Release -- /maxcpucount:2
- name: Obtain opensim-core commit
id: opensim-core-commit
run: |
cd opensim-core
$opensim_core_commit=(git rev-parse HEAD)
echo "hash=$opensim_core_commit" >> $GITHUB_OUTPUT
- name: Cache opensim-core
id: cache-core
uses: actions/cache@v3
with:
path: ~/opensim-core-install
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
key: ${{ runner.os }}-${{ steps.opensim-core-commit.outputs.hash }}
- name: Build opensim-core
# if: steps.cache-core.outputs.cache-hit != 'true'
run: |
echo $env:GITHUB_WORKSPACE\\build_core
mkdir $env:GITHUB_WORKSPACE\\build_core
chdir $env:GITHUB_WORKSPACE\\build_core
$env:CXXFLAGS = "/W0"
cmake $env:GITHUB_WORKSPACE/opensim-core -G"Visual Studio 16 2019" -A x64 -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.8.10\x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install
cmake . -LAH
cmake --build . --config Release -- /maxcpucount:2
cmake --install .
- name: Update submodules
run: git submodule update --init --recursive -- opensim-models opensim-visualizer Gui/opensim/threejs
- name: Build GUI
id: build-gui
run: |
mkdir build
cd build
cmake ../ -G"Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH=~/opensim-core-install -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=C:/Program Files/NetBeans-12.3/netbeans;-Dnbplatform.default.harness.dir=C:/Program Files/NetBeans-12.3/netbeans/harness"
cmake --build . --target CopyOpenSimCore --config Release
cmake --build . --target CopyModels --config Release
cmake --build . --target PrepareInstaller --config Release
cmake --build . --target CopyJRE --config Release
cmake --build . --target CopyVisualizer --config Release
# Read the value of the cache variable storing the GUI build version.
$env:match = cmake -L . | Select-String -Pattern OPENSIMGUI_BUILD_VERSION
$VERSION = $env:match.split('=')[1]
echo $VERSION
echo "name=VERSION::$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $env:GITHUB_OUTPUT
- name: Build GUI installer
run: |
cd Gui/opensim/dist/installer
makensis.exe make_installer.nsi
mv OpenSim-${{ steps.build-gui.outputs.version }}-win64.exe $env:GITHUB_WORKSPACE
- name: Upload GUI installer
uses: actions/upload-artifact@v3
with:
name: OpenSim-${{ steps.build-gui.outputs.version }}-win64
path: OpenSim-${{ steps.build-gui.outputs.version }}-win64.exe