Merge pull request #429 from Xiangyu-Hu/xiaojing-wuliezhao-viscous #1009
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: CI | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
VCPKG_VERSION: "1c5a340f6e10985e2d92af174a68dbd15c1fa4e1" # 29/05/2023 commit at https://github.com/microsoft/vcpkg/pull/29067 | |
CTEST_PARALLEL_LEVEL: "1" | |
# A workflow is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
############################################################################### | |
Linux-float: | |
runs-on: ubuntu-22.04 | |
env: | |
VCPKG_DEFAULT_TRIPLET: x64-linux | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Install system dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y \ | |
apt-utils \ | |
build-essential \ | |
curl zip unzip tar `# when starting fresh on a WSL image for bootstrapping vcpkg`\ | |
pkg-config `# for installing libraries with vcpkg`\ | |
git \ | |
cmake \ | |
ninja-build \ | |
libfontconfig1-dev `# From here required for vcpkg opencascade`\ | |
libx11-dev \ | |
libgl-dev | |
- uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }} | |
- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} | |
with: | |
committish: ${{ env.VCPKG_VERSION }} | |
cache: false | |
- name: Install dependencies | |
run: | | |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build openblas[dynamic-arch] --allow-unsupported # last argument to remove after regression introduced by microsoft/vcpkg#30192 is addressed | |
# Simbody depends on (open)blas implementation, which -march=native by default, conflicting with cache restore, hence dynamic-arch feature | |
# Above problem might also be resolved by adding the hash of architecture in the cache key, esp. if more package do the same | |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build \ | |
eigen3 \ | |
tbb \ | |
boost-program-options \ | |
boost-geometry \ | |
simbody \ | |
gtest \ | |
xsimd \ | |
pybind11 \ | |
opencascade | |
- name: Generate buildsystem using float (No test) | |
run: | | |
cmake -G Ninja \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
-D CMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake" \ | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-D SPHINXSYS_USE_FLOAT=ON \ | |
-D SPHINXSYS_MODULE_OPENCASCADE=ON \ | |
-D SPHINXSYS_CI=ON \ | |
-S ${{github.workspace}} \ | |
-B ${{github.workspace}}/build | |
- name: Build using float | |
run: cmake --build build --config Release --verbose | |
############################################################################### | |
Linux-build: | |
runs-on: ubuntu-22.04 | |
env: | |
VCPKG_DEFAULT_TRIPLET: x64-linux | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Install system dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y \ | |
apt-utils \ | |
build-essential \ | |
curl zip unzip tar `# when starting fresh on a WSL image for bootstrapping vcpkg`\ | |
pkg-config `# for installing libraries with vcpkg`\ | |
git \ | |
cmake \ | |
ninja-build \ | |
libfontconfig1-dev `# From here required for vcpkg opencascade`\ | |
libx11-dev \ | |
libgl-dev | |
- uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }} | |
- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} | |
with: | |
committish: ${{ env.VCPKG_VERSION }} | |
cache-version: ${{env.VCPKG_VERSION}} | |
- name: Install dependencies | |
run: | | |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build openblas[dynamic-arch] --allow-unsupported # last argument to remove after regression introduced by microsoft/vcpkg#30192 is addressed | |
# Simbody depends on (open)blas implementation, which -march=native by default, conflicting with cache restore, hence dynamic-arch feature | |
# Above problem might also be resolved by adding the hash of architecture in the cache key, esp. if more package do the same | |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build \ | |
eigen3 \ | |
tbb \ | |
boost-program-options \ | |
boost-geometry \ | |
simbody \ | |
gtest \ | |
xsimd \ | |
pybind11 \ | |
opencascade | |
- name: Generate buildsystem using double | |
run: | | |
cmake -G Ninja \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
-D CMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake" \ | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-D SPHINXSYS_CI=ON \ | |
-D SPHINXSYS_USE_FLOAT=OFF \ | |
-D TEST_STATE_RECORDING=OFF \ | |
-D SPHINXSYS_MODULE_OPENCASCADE=ON \ | |
-S ${{github.workspace}} \ | |
-B ${{github.workspace}}/build | |
- name: Build using double | |
run: cmake --build build --config Release --verbose | |
- name: Zip build folder | |
run: zip -r build.zip ./build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Linux-build | |
path: ${{github.workspace}}/build.zip | |
if-no-files-found: error | |
retention-days: 1 | |
Linux-test: | |
needs: Linux-build | |
runs-on: ubuntu-22.04 | |
env: | |
VCPKG_DEFAULT_TRIPLET: x64-linux | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install system dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y \ | |
apt-utils \ | |
build-essential \ | |
curl zip unzip tar `# when starting fresh on a WSL image for bootstrapping vcpkg`\ | |
pkg-config `# for installing libraries with vcpkg`\ | |
git \ | |
cmake \ | |
ninja-build \ | |
libfontconfig1-dev `# From here required for vcpkg opencascade`\ | |
libx11-dev \ | |
libgl-dev | |
- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} | |
with: | |
committish: ${{ env.VCPKG_VERSION }} | |
cache-version: ${{env.VCPKG_VERSION}} | |
- name: Install dependencies | |
run: | | |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build openblas[dynamic-arch] --allow-unsupported # last argument to remove after regression introduced by microsoft/vcpkg#30192 is addressed | |
# Simbody depends on (open)blas implementation, which -march=native by default, conflicting with cache restore, hence dynamic-arch feature | |
# Above problem might also be resolved by adding the hash of architecture in the cache key, esp. if more package do the same | |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build \ | |
eigen3 \ | |
tbb \ | |
boost-program-options \ | |
boost-geometry \ | |
simbody \ | |
gtest \ | |
xsimd \ | |
pybind11 \ | |
opencascade | |
- uses: actions/download-artifact@v3 | |
with: | |
name: Linux-build | |
- name: Unzip build folder | |
run: unzip build.zip | |
- name: Test with the first try | |
id: first-try | |
run: | | |
cd build | |
ctest --output-on-failure | |
continue-on-error: true | |
- name: Test with the second try for failed cases | |
id: second-try | |
if: ${{ steps.first-try.outcome == 'failure' }} | |
run: | | |
cd build | |
ctest --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the third try for failed cases | |
id: third-try | |
if: ${{ steps.second-try.outcome == 'failure' }} | |
run: | | |
cd build | |
ctest --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the fourth try for failed cases | |
id: fourth-try | |
if: ${{ steps.third-try.outcome == 'failure' }} | |
run: | | |
cd build | |
ctest --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the last try for failed cases | |
if: ${{ steps.fourth-try.outcome == 'failure' }} | |
run: | | |
cd build | |
ctest --rerun-failed --output-on-failure | |
############################################################################### | |
Windows-build: | |
runs-on: windows-latest | |
env: | |
VCPKG_DEFAULT_TRIPLET: x64-windows | |
steps: | |
- uses: actions/checkout@v3 # Checks-out the repository under ${{github.workspace}} | |
- name: Update ccache and ninja # For correct caching with ccache on Windows | |
shell: bash | |
run: | | |
choco install ccache | |
choco install ninja | |
choco install 7zip | |
- uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }} | |
- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} | |
with: | |
committish: ${{ env.VCPKG_VERSION }} | |
cache-version: ${{env.VCPKG_VERSION}} | |
- name: Install dependencies | |
run: | | |
${{github.workspace}}\vcpkg\vcpkg.exe install --clean-after-build ` | |
eigen3 ` | |
tbb ` | |
boost-program-options ` | |
boost-geometry ` | |
simbody ` | |
gtest ` | |
xsimd ` | |
pybind11 | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Generate buildsystem | |
run: | | |
cmake.exe -G Ninja ` | |
-D CMAKE_BUILD_TYPE=Release ` | |
-D CMAKE_TOOLCHAIN_FILE="${{github.workspace}}\vcpkg\scripts\buildsystems\vcpkg.cmake" ` | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache ` | |
-D SPHINXSYS_CI=ON ` | |
-D TEST_STATE_RECORDING=OFF ` | |
-S ${{github.workspace}} ` | |
-B C:\build | |
- name: Build | |
run: cmake.exe --build C:\build --config Release --verbose | |
- name: Zip build folder | |
run: 7z.exe a C:\build.7z "C:\build" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Windows-build | |
path: C:\build.7z | |
if-no-files-found: error | |
retention-days: 1 | |
Windows-test: | |
needs: Windows-build | |
runs-on: windows-latest | |
env: | |
VCPKG_DEFAULT_TRIPLET: x64-windows | |
steps: | |
- uses: actions/checkout@v3 # Checks-out the repository under ${{github.workspace}} | |
- name: Update ccache and ninja # For correct caching with ccache on Windows | |
shell: bash | |
run: | | |
choco install ccache | |
choco install ninja | |
choco install 7zip | |
- uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }} | |
- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} | |
with: | |
committish: ${{ env.VCPKG_VERSION }} | |
cache-version: ${{env.VCPKG_VERSION}} | |
- name: Install dependencies | |
run: | | |
${{github.workspace}}\vcpkg\vcpkg.exe install --clean-after-build ` | |
eigen3 ` | |
tbb ` | |
boost-program-options ` | |
boost-geometry ` | |
simbody ` | |
gtest ` | |
xsimd ` | |
pybind11 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: Windows-build | |
- name: Unzip build folder | |
run: 7z.exe x build.7z -oC:\ | |
- name: Test with the first try | |
id: first-try | |
run: | | |
cd C:\build | |
ctest.exe --output-on-failure | |
continue-on-error: true | |
- name: Test with the second try for failed cases | |
id: second-try | |
if: ${{ steps.first-try.outcome == 'failure' }} | |
run: | | |
cd C:\build | |
ctest.exe --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the third try for failed cases | |
id: third-try | |
if: ${{ steps.second-try.outcome == 'failure' }} | |
run: | | |
cd C:\build | |
ctest.exe --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the fourth try for failed cases | |
id: fourth-try | |
if: ${{ steps.third-try.outcome == 'failure' }} | |
run: | | |
cd C:\build | |
ctest.exe --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the last try for failed cases | |
if: ${{ steps.fourth-try.outcome == 'failure' }} | |
run: | | |
cd C:\build | |
ctest.exe --rerun-failed --output-on-failure | |
############################################################################### | |
macOS-build: | |
runs-on: macos-12 | |
env: | |
VCPKG_DEFAULT_TRIPLET: x64-osx | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Install system dependencies | |
run: | | |
brew reinstall gfortran # to force having gfortran on PATH because github runners don't have it, just the versioned aliases, i.e. gfortran-11 | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md | |
# https://github.com/actions/runner-images/issues/3371#issuecomment-839882565 | |
# https://github.com/modflowpy/install-gfortran-action and https://github.com/awvwgk/setup-fortran | |
brew install \ | |
pkg-config `# for installing libraries with vcpkg`\ | |
git \ | |
cmake \ | |
ninja \ | |
zip \ | |
unzip | |
- uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }} | |
- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} | |
with: | |
committish: ${{ env.VCPKG_VERSION }} | |
cache-version: ${{env.VCPKG_VERSION}} | |
- name: Install dependencies | |
run: | | |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build --allow-unsupported \ | |
eigen3 \ | |
tbb \ | |
boost-program-options \ | |
boost-geometry \ | |
gtest \ | |
simbody \ | |
xsimd \ | |
pybind11 \ | |
opencascade | |
- name: Generate buildsystem | |
run: | | |
cmake -G Ninja \ | |
-D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
-D CMAKE_TOOLCHAIN_FILE="${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake" \ | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-D SPHINXSYS_CI=ON \ | |
-D TEST_STATE_RECORDING=OFF \ | |
-S ${{github.workspace}} \ | |
-B ${{github.workspace}}/build | |
- name: Build | |
run: cmake --build build --config Release --verbose | |
- name: Zip build folder | |
run: zip -r build.zip ./build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: macOS-build | |
path: ${{github.workspace}}/build.zip | |
if-no-files-found: error | |
retention-days: 1 | |
macOS-test: | |
needs: macOS-build | |
runs-on: macos-12 | |
env: | |
VCPKG_DEFAULT_TRIPLET: x64-osx | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Install system dependencies | |
run: | | |
brew reinstall gfortran # to force having gfortran on PATH because github runners don't have it, just the versioned aliases, i.e. gfortran-11 | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md | |
# https://github.com/actions/runner-images/issues/3371#issuecomment-839882565 | |
# https://github.com/modflowpy/install-gfortran-action and https://github.com/awvwgk/setup-fortran | |
brew install \ | |
pkg-config `# for installing libraries with vcpkg`\ | |
git \ | |
cmake \ | |
ninja | |
- uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ github.job }} | |
- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} | |
with: | |
committish: ${{ env.VCPKG_VERSION }} | |
cache-version: ${{env.VCPKG_VERSION}} | |
- name: Install dependencies | |
run: | | |
${{github.workspace}}/vcpkg/vcpkg install --clean-after-build --allow-unsupported \ | |
eigen3 \ | |
tbb \ | |
boost-program-options \ | |
boost-geometry \ | |
gtest \ | |
simbody \ | |
xsimd \ | |
pybind11 \ | |
opencascade | |
- uses: actions/download-artifact@v3 | |
with: | |
name: macOS-build | |
- name: Unzip build folder | |
run: unzip build.zip | |
- name: Test with the first try | |
id: first-try | |
run: | | |
cd build | |
ctest --output-on-failure | |
continue-on-error: true | |
- name: Test with the second try for failed cases | |
id: second-try | |
if: ${{ steps.first-try.outcome == 'failure' }} | |
run: | | |
cd build | |
ctest --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the third try for failed cases | |
id: third-try | |
if: ${{ steps.second-try.outcome == 'failure' }} | |
run: | | |
cd build | |
ctest --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the fourth try for failed cases | |
id: fourth-try | |
if: ${{ steps.third-try.outcome == 'failure' }} | |
run: | | |
cd build | |
ctest --rerun-failed --output-on-failure | |
continue-on-error: true | |
- name: Test with the last try for failed cases | |
if: ${{ steps.fourth-try.outcome == 'failure' }} | |
run: | | |
cd build | |
ctest --rerun-failed --output-on-failure |