Skip to content

Commit

Permalink
multi-job
Browse files Browse the repository at this point in the history
  • Loading branch information
rtobar committed Sep 14, 2023
1 parent dddb316 commit ceb7584
Showing 1 changed file with 101 additions and 23 deletions.
124 changes: 101 additions & 23 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ name: Build and test
# Build on every branch push, tag push, and pull request change:
on: [push]

env:
CI_BUILD_DIR: build
TEST_INPUTS_DIR: inputs
TEST_OUTPUTS_DIR: outputs
TEST_SIM_NAME: mini-SURFS
TEST_FIXED_SEED: 123456

jobs:
build_wheels:
build_and_test:
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
Expand All @@ -31,14 +33,6 @@ jobs:
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: |
Expand All @@ -61,6 +55,27 @@ jobs:
cd ${CI_BUILD_DIR}
ctest --output-on-failure
- name: Upload shark build for next jobs (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: shark-build
path: ${{ env.CI_BUILD_DIR }}

initial_shark_run:
name: Initial shark run (with fixed seed)
needs: build_and_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install HDF5 tools
run: sudo apt install hdf5-tools

- uses: actions/download-artifact@v3
with:
name: shark-build

- name: Prepare test dataset
run: |
mkdir -p ${TEST_INPUTS_DIR}
Expand All @@ -74,17 +89,87 @@ jobs:
" sample.cfg > ci-test.cfg
- name: Run shark with fixed seed
run: .ci/run_shark.sh my_model -o execution.seed=123456
run: .ci/run_shark.sh my_model -o execution.seed=${TEST_FIXED_SEED}

- name: Upload shark output for next jobs
uses: actions/upload-artifact@v3
with:
name: shark-output
path: ${{ env.TEST_OUTPUTS_DIR }}

check_hdf5_docs:
name: Check HDF5 properties documentation is up to date
needs: initial_shark_run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install HDF5 tools
run: sudo apt install hdf5-tools

- uses: actions/download-artifact@v3

- 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
generate_plots:
name: Generate all standard plots
needs: initial_shark_run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: shark-output

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Python dependencies
run: pip install matplotlib h5py scipy

# 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
check_reproducibility:
name: Check shark runs are reproducible
needs: build_and_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: shark-build
- uses: actions/download-artifact@v3
with:
name: shark-output

- name: Install system runtime dependencies
run: sudo apt install libhdf5-103 libboost-filesystem1.74.0 libboost-program-options1.74.0 libboost-log1.74.0 libgsl27

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Python dependencies
run: pip install h5py

- name: Check fixed seed is reproducible
run: |
.ci/run_shark.sh my_model_same_seed -o execution.seed=123456
.ci/run_shark.sh my_model_same_seed -o execution.seed=${TEST_FIXED_SEED}
.ci/compare_galaxies.sh my_model my_model_same_seed
- name: Check fixed seed is reproducible when multithreaded
Expand All @@ -99,10 +184,3 @@ jobs:
.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

0 comments on commit ceb7584

Please sign in to comment.