Skip to content

try to use presets

try to use presets #79

Workflow file for this run

name: Build and test
# Build on every branch push, tag push, and pull request change:
on: [push]
jobs:
build_wheels:
name: Build and test shark on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
CI_BUILD_DIR: build
TEST_INPUTS_DIR: inputs
TEST_OUTPUTS_DIR: outputs
TEST_SIM_NAME: mini-SURFS
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install system dependencies (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt install ninja-build libhdf5-dev hdf5-tools libboost-filesystem-dev libboost-program-options-dev libboost-log-dev cxxtest libgsl-dev
- name: Install system dependencies (MacOS)
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install ninja hdf5 boost cxxtest gsl libomp
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Python dependencies
run: pip install matplotlib h5py scipy
- name: Point CMake to libomp (MacOS)
if: ${{ matrix.os == 'macos-latest' }}
run: |
# libomp is installed as keg-only, so we need to manually point to it
HOMEBREW_LIBOMP_PREFIX=`brew --prefix libomp`
OMP_FLAGS="-Xpreprocessor -fopenmp -I${HOMEBREW_LIBOMP_PREFIX}/include"
echo "{\"version\": 1, \"configurePresents\": [{\"name\": \"ci-preset\", \"cacheVariables\": {\"OpenMP_C_FLAGS\": \"$OMP_FLAGS\", \"OpenMP_CXX_FLAGS\": \"$OMP_FLAGS\", \"OpenMP_C_LIB_NAMES\": \"omp\", \"OpenMP_CXX_LIB_NAMES\": \"omp\", \"OpenMP_omp_LIBRARY\": \"$HOMEBREW_LIBOMP_PREFIX/lib/libomp.dylib\"}}]}" >> CMakeUserPresets.json

Check failure on line 48 in .github/workflows/build-and-test.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-and-test.yaml

Invalid workflow file

You have an error in your yaml syntax on line 48
echo "EXTRA_CMAKE_ARGS=--preset ci-preset" >> "$GITHUB_ENV"
#echo "EXTRA_CMAKE_ARGS=-DOpenMP_C_FLAGS=$OMP_FLAGS -DOpenMP_C_LIB_NAMES=omp -DOpenMP_CXX_FLAGS=$OMP_FLAGS -DOpenMP_CXX_LIB_NAMES=omp -DOpenMP_omp_LIBRARY=$HOMEBREW_LIBOMP_PREFIX/lib/libomp.dylib -DCMAKE_PREFIX_PATH=$HOMEBREW_LIBOMP_PREFIX" >> "$GITHUB_ENV"
#echo "DYLD_LIBRARY_PATH=$HOMEBREW_LIBOMP_PREFIX/lib:$DYLD_LIBRARY_PATH" >> "$GITHUB_ENV"
- name: Configure
run: |
cmake -B ${CI_BUILD_DIR} -G Ninja \
-DSHARK_TEST=ON -DCMAKE_CXX_FLAGS="-Wall" \
$EXTRA_CMAKE_ARGS
# Leaving -Werror out for now because there *are* errors
# and I don't know what the proper fix is.
#-Werror
- name: Build
run: cmake --build ${CI_BUILD_DIR}
- name: Run unit tests
run: |
cd ${CI_BUILD_DIR}
ctest --output-on-failure
- name: Prepare test dataset
run: |
mkdir -p ${TEST_INPUTS_DIR}
curl -L -o ${TEST_INPUTS_DIR}/redshifts.txt 'https://docs.google.com/uc?export=download&id=1xvNmJB_KmoBHuQz-QzdPnY0HFs7smkUB'
curl -L -o ${TEST_INPUTS_DIR}/tree_199.0.hdf5 'https://docs.google.com/uc?export=download&id=1JDK8ak13bEhzg9H9xt0uE8Fh_2LD3KpZ'
sed "
s|output_directory.*|output_directory = ${TEST_OUTPUTS_DIR}|
s|redshift_file.*|redshift_file = ${TEST_INPUTS_DIR}/redshifts.txt|
s|tree_files_prefix.*|tree_files_prefix = ${TEST_INPUTS_DIR}/tree_199|
s|sim_name.*|sim_name = ${TEST_SIM_NAME}|
" sample.cfg > ci-test.cfg
- name: Run shark with fixed seed
run: .ci/run_shark.sh my_model -o execution.seed=123456
- name: Check output properties' documentation
run: |
.ci/check_hdf5_docs.sh my_model/199/0/galaxies.hdf5 galaxies.rst
.ci/check_hdf5_docs.sh my_model/156/0/star_formation_histories.hdf5 star_formation_histories.rst
.ci/check_hdf5_docs.sh my_model/199/0/black_hole_histories.hdf5 black_hole_histories.rst
- name: Check fixed seed is reproducible
run: |
.ci/run_shark.sh my_model_same_seed -o execution.seed=123456
.ci/compare_galaxies.sh my_model my_model_same_seed
- name: Check fixed seed is reproducible when multithreaded
run: |
# "-t 0" lets shark use the maximum number of OpenMP threads,
# which OpenMP implementations usually constrain to the available hardware
.ci/run_shark.sh my_model_same_seed_parallel -o execution.seed=123456 -t 0
.ci/compare_galaxies.sh my_model my_model_same_seed_parallel
- name: Check random seed gives different results
run: |
.ci/run_shark.sh my_model_random_seed -t 0
.ci/compare_galaxies.sh my_model my_model_random_seed --expect-unequal
# Currently skipped because there are a few minor problems
# with some plots
- name: Generate all plots
if: false
run: |
echo "backend: Agg" >> matplotlibrc
python standard_plots/all.py -c ci-test.cfg