Skip to content

Defining the time-step as a function of the current simulation time #426

Defining the time-step as a function of the current simulation time

Defining the time-step as a function of the current simulation time #426

name: Build and Test SLOTH on Linux and MacOS
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build-linux:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# os: [ubuntu-22.04, ubuntu-24.04]
# gcc_version: [11, 14]
# exclude:
# - os: ubuntu-22.04
# gcc_version: 14
# - os: ubuntu-24.04
# gcc_version: 11
steps:
- uses: actions/checkout@v4
- name: Set number of cores
run: echo "CORES=$(nproc)" >> $GITHUB_ENV
- name: Set up Spack
uses: spack/setup-spack@v2
with:
ref: develop # Spack version (examples: develop, releases/v0.21)
buildcache: true # Configure oci://ghcr.io/spack/github-actions-buildcache
color: true # Force color output (SPACK_COLOR=always)
path: ${{github.workspace}}/spack # Where to clone Spack
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y mpich libmpich-dev wget unzip libncurses-dev libboost-all-dev libopenblas-dev perl
- name: Install MFEM
shell: spack-bash {0}
run: |
spack compiler find
spack external find openmpi mpich openblas perl
spack env activate .
spack concretize -f
spack install -j $CORES --fail-fast
echo "ExprTk_INCLUDE_DIR=$(spack location -i exprtk)/include/exprtk" >> $GITHUB_ENV
- name: Setup Python
uses: actions/setup-python@v5
with:
cache: 'pip'
- name: Install Python dependencies
run: |
python3 -m venv pysloth
source pysloth/bin/activate
python3 -m pip install --upgrade pip gcovr cpplint matplotlib pandas numpy scipy sympy vtk
- name: Build SLOTH
shell: spack-bash {0}
run: |
spack env activate .
source pysloth/bin/activate
mkdir -p ${{ github.workspace }}/build
cd ${{ github.workspace }}/build
bash ../envSloth.sh --coverage --exprtk=$ExprTk_INCLUDE_DIR --np=$CORES
make -j $CORES tests
- name: Test SLOTH
shell: spack-bash {0}
run: |
spack env activate .
source pysloth/bin/activate
cd ${{ github.workspace }}/build
find . -type d -name "Save*" -exec rm -rf {} +
ctest -j $CORES --output-on-failure
- name: Save Tests on Failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-reports-linux
path: ${{ github.workspace }}/build/tests
retention-days: 1
build-MacOS:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set number of cores
run: echo "CORES=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
- name: Install MFEM
run: brew install mfem
- name: Install Voro++ (for test)
run: brew install voro++
- name: Setup Python
uses: actions/setup-python@v5
with:
cache: 'pip'
- name: Install Python dependencies
run: |
python3 -m venv pysloth
source pysloth/bin/activate
python3 -m pip install --upgrade pip gcovr cpplint matplotlib pandas numpy scipy sympy vtk
- name: Install ExprTk
run: |
git clone https://github.com/ArashPartow/exprtk.git
- name: Set ExprTk path
run: echo "ExprTk_INCLUDE_DIR=${{ github.workspace }}/exprtk" >> $GITHUB_ENV
- name: Build SLOTH
run: |
source pysloth/bin/activate
mkdir -p ${{ github.workspace }}/build
cd ${{ github.workspace }}/build
bash ../envSloth.sh --coverage --exprtk=$ExprTk_INCLUDE_DIR --voro=$(brew --prefix voro++)
make -j $CORES tests
- name: Test SLOTH
run: |
source pysloth/bin/activate
cd ${{ github.workspace }}/build
find . -type d -name "Save*" -exec rm -rf {} +
ctest -j $CORES --output-on-failure
- name: Save Tests on Failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-reports-macos
path: ${{ github.workspace }}/build/tests
retention-days: 1
- name: Code Coverage Analysis
if: ${{ always() }}
run: |
source pysloth/bin/activate
cd ${{ github.workspace }}/build
make cc
- name: Save Code Coverage Analysis
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ${{ github.workspace }}/build/Coverage
retention-days: 1
- name: CppLint
if: ${{ always() }}
continue-on-error: true
run: |
cd ${{ github.workspace }}/build
cpplint \
--filter=-runtime/references,-build/header_guard,-runtime/string,-build/include \
--counting=total \
--extensions=cpp,cxx,hpp,h,hxx,tpp \
--linelength=100 \
--recursive ../kernel ../tests \
COMMENT "Linting source files"