From 9e8c2c7391815608ad3db0f5d464ad2b5445ba12 Mon Sep 17 00:00:00 2001 From: aymanhab Date: Sat, 27 Jun 2020 23:05:41 -0700 Subject: [PATCH 1/4] Different workflow to build application against specific opensim-core commit for testing --- .github/workflows/special-core-commit.yml | 375 ++++++++++++++++++++++ 1 file changed, 375 insertions(+) create mode 100644 .github/workflows/special-core-commit.yml diff --git a/.github/workflows/special-core-commit.yml b/.github/workflows/special-core-commit.yml new file mode 100644 index 000000000..24353f239 --- /dev/null +++ b/.github/workflows/special-core-commit.yml @@ -0,0 +1,375 @@ +name: opensim-special-build + +on: + pull_request: + branches: + - '*' + push: + branches: + - master + tags: + - '*' + +jobs: + windows: + name: Windows + + runs-on: windows-latest + + steps: + - name: Checkout opensim-gui + uses: actions/checkout@v2 + + - name: Install SWIG + run: choco install swig --version 3.0.12 --yes --limit-output + + - name: Install NumPy + run: python -m pip install numpy + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Install Netbeans + # Make sure the NetBeans installer is not corrupted. + run: | + (New-Object System.Net.WebClient).DownloadFile("https://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-windows.exe", "netbeans-8.2-javase-windows.exe") + $expectedHash = "7b0646306a7488e617837da1517a86c08b7cf6fbe4dd9d74e8a4564b5ffde004".ToUpper() + $hashFromFile = Get-FileHash -Algorithm SHA256 -Path .\netbeans-8.2-javase-windows.exe + if (($hashFromFile.Hash) -ne ($expectedHash)) { Write-Error "Hash doesn't match." } + .\netbeans-8.2-javase-windows.exe --silent | Out-Null # This installer is gregarious. + echo "::set-env name=ANT_HOME:C:\\Program Files\\NetBeans 8.2\\extide\\ant" + + - name: Checkout opensim-core master + uses: actions/checkout@v2 + with: + repository: opensim-org/opensim-core + path: 'opensim-core' + ref: '00fe47f818d7a62d60a21caf629981908682b130' + + - name: Cache opensim-core-dependencies + id: cache-dependencies + uses: actions/cache@v1 + 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 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install + $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 "::set-output name=hash::$opensim_core_commit" + + - name: Cache opensim-core + id: cache-core + uses: actions/cache@v1 + 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 -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 8.2;-Dnbplatform.default.harness.dir=C:/Program Files/NetBeans 8.2/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 "::set-env name=VERSION::$version" + echo "::set-output name=version::$version" + + - 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@v2 + with: + name: OpenSim-${{ steps.build-gui.outputs.version }}-win64 + path: OpenSim-${{ steps.build-gui.outputs.version }}-win64.exe + + mac: + name: Mac + + runs-on: macOS-latest + + steps: + - name: Checkout opensim-gui + uses: actions/checkout@v2 + + - name: Checkout opensim-core master + uses: actions/checkout@v2 + with: + repository: opensim-org/opensim-core + path: 'opensim-core' + + - name: Install packages + run: | + brew install doxygen swig@3 ant + pip3 install numpy + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + # - name: Setup tmate session to debug the workflow through SSH. + # uses: mxschmitt/action-tmate@v2 + + - name: Install NetBeans + # `brew cask install netbeans-java-se` requires sudo but brew won't allow sudo, + # so we install NetBeans ourselves. + # Note: Cask 'netbeans' gives version 11.2, while 'netbeans-java-se' gives 8.2. + run: | + # We remove JDKs newer than 8 to force the NetBeans installer to use JDK 8. + # If using JDK 14, the NetBeans installer fails because it cannot find unpack200, + # which was removed from the JDK. See: + # https://netbeans.apache.org/download/nb113/nb113.html + # "The installers will NOT run under JDK 14 because usage is made of the Pack200 + # Tools and API, for packing and unpacking, which is removed in JDK 14, see JEP 367." + sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-14.jdk + sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-13.jdk + sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-12.jdk + sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-11.jdk + /usr/libexec/java_home -V + export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) + echo "::set-env name=JAVA_HOME::$JAVA_HOME" + echo $JAVA_HOME + wget https://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-macosx.dmg + hdiutil attach netbeans-8.2-javase-macosx.dmg + sudo installer -pkg /Volumes/NetBeans\ 8.2/NetBeans\ 8.2.pkg -target / + sudo -k + + - name: Cache opensim-core-dependencies + id: cache-dependencies + uses: actions/cache@v1 + 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: | + mkdir build_deps + cd build_deps + cmake ../opensim-core/dependencies -DSUPERBUILD_ezc3d:BOOL=on -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DCMAKE_BUILD_TYPE=Release + cmake . -LAH + cmake --build . --config Release + + - name: Obtain opensim-core commit + id: opensim-core-commit + run: | + cd opensim-core + opensim_core_commit=$(git rev-parse HEAD) + echo "::set-output name=hash::$opensim_core_commit" + + - name: Cache opensim-core + id: cache-core + uses: actions/cache@v1 + with: + path: ~/opensim-core-install + key: ${{ runner.os }}-${{ steps.opensim-core-commit.outputs.hash }} + + - name: Build opensim-core + if: steps.cache-core.outputs.cache-hit != 'true' + run: | + mkdir build_core + cd build_core + cmake ../opensim-core -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DSWIG_EXECUTABLE=/usr/local/opt/swig@3/bin/swig -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_INSTALL_UNIX_FHS=OFF + cmake . -LAH + cmake --build . --config Release + 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 + # TODO: Do not hard-code NetBeans version. + # TODO: Could download from https://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-macosx.dmg + # cmake ../ -DCMAKE_PREFIX_PATH=~/opensim-core -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=/Applications/NetBeans/Apache NetBeans 11.2.app/Contents/Resources/NetBeans/netbeans;-Dnbplatform.default.harness.dir=/Applications/NetBeans/Apache NetBeans 11.2.app/Contents/Resources/NetBeans/netbeans/harness" + cmake ../ -DCMAKE_PREFIX_PATH=~/opensim-core-install -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans;-Dnbplatform.default.harness.dir=/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/harness" + make CopyOpenSimCore + make PrepareInstaller + # Read the value of the cache variable storing the GUI build version. + VERSION=`cmake -L . | grep OPENSIMGUI_BUILD_VERSION | cut -d "=" -f2` + echo $VERSION + echo "::set-env name=VERSION::$VERSION" + echo "::set-output name=version::$VERSION" + cd $GITHUB_WORKSPACE + ls Gui/opensim/dist + mv Gui/opensim/dist/OpenSim-$VERSION.pkg $GITHUB_WORKSPACE + + - name: Upload GUI installer + uses: actions/upload-artifact@v2 + with: + name: OpenSim-${{ steps.build-gui.outputs.version }}-mac + path: OpenSim-${{ steps.build-gui.outputs.version }}.pkg + + ubuntu: + name: Ubuntu + + runs-on: ubuntu-18.04 + + steps: + + - name: Checkout opensim-gui + uses: actions/checkout@v2 + + - name: Checkout opensim-core master + uses: actions/checkout@v2 + with: + repository: opensim-org/opensim-core + path: 'opensim-core' + + - name: Install packages + run: sudo apt-get install --yes liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen python3 python3-dev python3-numpy python3-setuptools swig + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Cache Netbeans + id: cache-netbeans + uses: actions/cache@v1 + with: + path: ~/netbeans-8.2 + key: netbeans-8.2 + + - name: Download and Install Netbeans + if: steps.cache-netbeans.outputs.cache-hit != 'true' + run: | + wget -q https://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-linux.sh + chmod 755 netbeans-8.2-javase-linux.sh + ./netbeans-8.2-javase-linux.sh --silent + ls $HOME/netbeans-8.2 + + - name: Cache opensim-core-dependencies + id: cache-dependencies + uses: actions/cache@v1 + 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: | + mkdir build_deps + cd build_deps + cmake ../opensim-core/dependencies -DSUPERBUILD_ezc3d:BOOL=on -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install + cmake . -LAH + cmake --build . --config Release + + - name: Obtain opensim-core commit + id: opensim-core-commit + run: | + cd opensim-core + opensim_core_commit=$(git rev-parse HEAD) + echo "::set-output name=hash::$opensim_core_commit" + + - name: Cache opensim-core + id: cache-core + uses: actions/cache@v1 + with: + path: ~/opensim-core-install + key: ${{ runner.os }}-${{ steps.opensim-core-commit.outputs.hash }} + + - name: Build opensim-core + if: steps.cache-core.outputs.cache-hit != 'true' + run: | + mkdir build_core + cd build_core + cmake ../opensim-core -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DBUILD_JAVA_WRAPPING=on -DBUILD_PYTHON_WRAPPING=on -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_TESTING=off -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_INSTALL_UNIX_FHS=OFF + cmake . -LAH + cmake --build . --config Release + 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 ../ -DCMAKE_PREFIX_PATH=~/opensim-core-install -DANT_ARGS="-Dnbplatform.default.netbeans.dest.dir=$HOME/netbeans-8.2;-Dnbplatform.default.harness.dir=$HOME/netbeans-8.2/harness" + make CopyOpenSimCore + make PrepareInstaller + # Read the value of the cache variable storing the GUI build version. + VERSION=`cmake -L . | grep OPENSIMGUI_BUILD_VERSION | cut -d "=" -f2` + echo $VERSION + echo "::set-env name=VERSION::$VERSION" + echo "::set-output name=version::$VERSION" + cd $GITHUB_WORKSPACE + ls Gui/opensim/dist + mv Gui/opensim/dist/OpenSim-$VERSION.tar.gz $GITHUB_WORKSPACE + + - name: Upload GUI installer + uses: actions/upload-artifact@v2 + with: + name: OpenSim-${{ steps.build-gui.outputs.version }}-linux + path: OpenSim-${{ steps.build-gui.outputs.version }}.tar.gz From 984c5a4b939b326c1f1807f2a47574f4432805a4 Mon Sep 17 00:00:00 2001 From: Ayman Habib Date: Tue, 30 Jun 2020 08:42:14 -0700 Subject: [PATCH 2/4] Update special-core-commit.yml Update commit hash on mac, linux --- .github/workflows/special-core-commit.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/special-core-commit.yml b/.github/workflows/special-core-commit.yml index 24353f239..366b7b582 100644 --- a/.github/workflows/special-core-commit.yml +++ b/.github/workflows/special-core-commit.yml @@ -150,7 +150,8 @@ jobs: with: repository: opensim-org/opensim-core path: 'opensim-core' - + ref: '00fe47f818d7a62d60a21caf629981908682b130' + - name: Install packages run: | brew install doxygen swig@3 ant @@ -278,7 +279,8 @@ jobs: with: repository: opensim-org/opensim-core path: 'opensim-core' - + ref: '00fe47f818d7a62d60a21caf629981908682b130' + - name: Install packages run: sudo apt-get install --yes liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen python3 python3-dev python3-numpy python3-setuptools swig From 38b316c812953b3b92e2dee4875937f97e55d1bf Mon Sep 17 00:00:00 2001 From: Ayman Habib Date: Tue, 30 Jun 2020 12:09:34 -0700 Subject: [PATCH 3/4] Update special-core-commit.yml explicitly specify javahome to netbeans installer --- .github/workflows/special-core-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/special-core-commit.yml b/.github/workflows/special-core-commit.yml index 366b7b582..c52585831 100644 --- a/.github/workflows/special-core-commit.yml +++ b/.github/workflows/special-core-commit.yml @@ -186,7 +186,7 @@ jobs: echo $JAVA_HOME wget https://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-macosx.dmg hdiutil attach netbeans-8.2-javase-macosx.dmg - sudo installer -pkg /Volumes/NetBeans\ 8.2/NetBeans\ 8.2.pkg -target / + sudo installer -pkg /Volumes/NetBeans\ 8.2/NetBeans\ 8.2.pkg -target --javahome /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/ sudo -k - name: Cache opensim-core-dependencies From 0dd28502683bf914e354fb18c8d53dee8596902b Mon Sep 17 00:00:00 2001 From: Ayman Habib Date: Tue, 30 Jun 2020 13:23:50 -0700 Subject: [PATCH 4/4] Update special-core-commit.yml Remove more later jdks on osx --- .github/workflows/special-core-commit.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/special-core-commit.yml b/.github/workflows/special-core-commit.yml index c52585831..a284a7c8a 100644 --- a/.github/workflows/special-core-commit.yml +++ b/.github/workflows/special-core-commit.yml @@ -180,13 +180,17 @@ jobs: sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-13.jdk sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-12.jdk sudo rm -rf /Library/Java/JavaVirtualMachines/zulu-11.jdk + sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk + sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk + sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-12.jdk + sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk /usr/libexec/java_home -V export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) echo "::set-env name=JAVA_HOME::$JAVA_HOME" echo $JAVA_HOME wget https://download.netbeans.org/netbeans/8.2/final/bundles/netbeans-8.2-javase-macosx.dmg hdiutil attach netbeans-8.2-javase-macosx.dmg - sudo installer -pkg /Volumes/NetBeans\ 8.2/NetBeans\ 8.2.pkg -target --javahome /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/ + sudo installer -pkg /Volumes/NetBeans\ 8.2/NetBeans\ 8.2.pkg -target / sudo -k - name: Cache opensim-core-dependencies