Skip to content

Commit

Permalink
Merge pull request #424 from Xiangyu-Hu/178-examples-should-run-entir…
Browse files Browse the repository at this point in the history
…ely-by-default-unless-flags-are-given

178 examples should run entirely by default unless flags are given
  • Loading branch information
Xiangyu-Hu authored Sep 1, 2023
2 parents 1a06b77 + 5b6a966 commit f7be0a1
Show file tree
Hide file tree
Showing 54 changed files with 641 additions and 610 deletions.
179 changes: 148 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: CI

# Controls when the action will run.
# 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 ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -16,7 +16,6 @@ env:

# 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
Expand Down Expand Up @@ -47,7 +46,7 @@ jobs:
key: ${{ github.job }}

- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}}
with:
with:
committish: ${{ env.VCPKG_VERSION }}
cache: false

Expand Down Expand Up @@ -78,11 +77,11 @@ jobs:
-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:
Expand Down Expand Up @@ -112,7 +111,7 @@ jobs:
key: ${{ github.job }}

- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}}
with:
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{env.VCPKG_VERSION}}

Expand Down Expand Up @@ -144,7 +143,7 @@ jobs:
-D SPHINXSYS_MODULE_OPENCASCADE=ON \
-S ${{github.workspace}} \
-B ${{github.workspace}}/build
- name: Build using double
run: cmake --build build --config Release --verbose

Expand Down Expand Up @@ -183,7 +182,7 @@ jobs:
libgl-dev
- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}}
with:
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{env.VCPKG_VERSION}}

Expand Down Expand Up @@ -219,56 +218,57 @@ jobs:

- name: Test with the second try for failed cases
id: second-try
if: ${{ steps.first-try.outcome == 'failure' }}
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' }}
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' }}
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' }}
if: ${{ steps.fourth-try.outcome == 'failure' }}
run: |
cd build
ctest --rerun-failed --output-on-failure
###############################################################################

Windows:
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:
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{env.VCPKG_VERSION}}

Expand All @@ -282,7 +282,7 @@ jobs:
simbody `
gtest `
xsimd `
pybind11
pybind11
- uses: ilammy/msvc-dev-cmd@v1

Expand All @@ -296,10 +296,64 @@ jobs:
-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: |
Expand All @@ -309,37 +363,37 @@ jobs:

- name: Test with the second try for failed cases
id: second-try
if: ${{ steps.first-try.outcome == 'failure' }}
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' }}
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' }}
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' }}
if: ${{ steps.fourth-try.outcome == 'failure' }}
run: |
cd C:\build
ctest.exe --rerun-failed --output-on-failure
###############################################################################

macOS:
macOS-build:
runs-on: macos-12
env:
VCPKG_DEFAULT_TRIPLET: x64-osx
Expand All @@ -358,14 +412,16 @@ jobs:
pkg-config `# for installing libraries with vcpkg`\
git \
cmake \
ninja
ninja \
zip \
unzip
- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}}
with:
with:
committish: ${{ env.VCPKG_VERSION }}
cache-version: ${{env.VCPKG_VERSION}}

Expand Down Expand Up @@ -397,6 +453,67 @@ jobs:
- 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: |
Expand All @@ -406,30 +523,30 @@ jobs:

- name: Test with the second try for failed cases
id: second-try
if: ${{ steps.first-try.outcome == 'failure' }}
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' }}
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' }}
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' }}
if: ${{ steps.fourth-try.outcome == 'failure' }}
run: |
cd build
ctest --rerun-failed --output-on-failure
Loading

0 comments on commit f7be0a1

Please sign in to comment.