From 78804fde397f9056773151c913fab535a7e77315 Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 20 Jun 2022 18:03:24 +0200 Subject: [PATCH] Updated ci to include Visual Studio 2022 and Windows Server 2022. (#3227) --- .github/workflows/continuous_integration.yml | 102 +++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 88d7845c8e..49d26205d8 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -150,6 +150,108 @@ jobs: # asset_name: opensim-core-${{ github.ref }}.zip # asset_content_type: application/zip + windows2022: + name: Windows2022 + + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v1 + + - name: Install Doxygen + # choco install doxygen.portable # <-- too unreliable. + run: | + (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "doxygen.zip") + 7z x $env:GITHUB_WORKSPACE/doxygen.zip -odoxygen + echo "$env:GITHUB_WORKSPACE\\doxygen" >> $GITHUB_PATH + + - name: Install Python packages + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install numpy + #Need numpy to use SWIG numpy typemaps. + run: python3 -m pip install numpy==1.20.2 + + - name: Install SWIG + run: choco install swig --version 4.0.2 --yes --limit-output --allow-downgrade + + - name: Cache 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('dependencies/*') }} + + - name: Build 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 + # /W0 disables warnings. + # https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx + # TODO: CMake provides /W3, which overrides our /W0 + cmake -E env CXXFLAGS="/W0" cmake $env:GITHUB_WORKSPACE/dependencies -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim_dependencies_install -DSUPERBUILD_ezc3d=ON -DOPENSIM_WITH_TROPTER=ON -DOPENSIM_WITH_CASADI=ON + cmake --build . --config Release -- /maxcpucount:4 + + - name: Configure opensim-core + id: configure + run: | + mkdir $env:GITHUB_WORKSPACE\\build + chdir $env:GITHUB_WORKSPACE\\build + # TODO: Can remove /WX when we use that in CMakeLists.txt. + # Set the CXXFLAGS environment variable to turn warnings into errors. + # Skip timing test section included by default. + cmake -E env CXXFLAGS="/WX -DSKIP_TIMING" cmake $env:GITHUB_WORKSPACE -LAH -G"Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX=~/opensim-core-install -DOPENSIM_DEPENDENCIES_DIR=~/opensim_dependencies_install -DOPENSIM_C3D_PARSER=ezc3d -DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on -DPython3_ROOT_DIR=C:\hostedtoolcache\windows\Python\3.8.10\x64 + $env:match = cmake -L . | Select-String -Pattern OPENSIM_QUALIFIED_VERSION + $version = $env:match.split('=')[1] + echo $version + echo "VERSION=$version" >> $GITHUB_ENV + echo "::set-output name=version::$VERSION" + + - name: Build opensim-core + # Install now to avoid building bindings twice (TODO: issue when using Visual Studio 2019, is this an issue too in Visual Studio 2022?). + run: | + chdir $env:GITHUB_WORKSPACE\\build + cmake --build . --config Release --target doxygen -- /maxcpucount:4 + cmake --build . --config Release --target install -- /maxcpucount:4 + + - name: Test opensim-core + run: | + chdir $env:GITHUB_WORKSPACE\\build + ctest --parallel 4 --output-on-failure --build-config Release -E python* + + - name: Install opensim-core + # TODO: This is where we wish to do the installing, but it's done above for now. + run: | + chdir $env:GITHUB_WORKSPACE\\build + chdir $env:GITHUB_WORKSPACE + Copy-Item -Path "~/opensim-core-install" -Destination "opensim-core-${{ steps.configure.outputs.version }}" -Recurse + 7z a "opensim-core-${{ steps.configure.outputs.version }}.zip" "opensim-core-${{ steps.configure.outputs.version }}" + + - name: Test Python bindings + run: | + echo "PYTHONPATH= $env:USERPROFILE/opensim-core-install/bin">> $GITHUB_ENV + # Move to the installed location of the python package. + cd ~/opensim-core-install/sdk/python + python setup_win_python38.py + # Run python tests. + python -m unittest discover --start-directory opensim/tests --verbose + + - name: Upload opensim-core + uses: actions/upload-artifact@v2 + with: + name: opensim-core-${{ steps.configure.outputs.version }}-win + path: opensim-core-${{ steps.configure.outputs.version }}.zip + mac: name: Mac