Skip to content

Improving simulation class #64

Improving simulation class

Improving simulation class #64

Workflow file for this run

name: Build And Test
on:
workflow_dispatch:
push:
branches:
- "main"
pull_request:
jobs:
generate_matrix:
name: Generate test matrix
runs-on: ubuntu-latest
outputs:
matrix_includes: ${{steps.set-matrix.outputs.matrix_includes}}
steps:
- uses: actions/checkout@v3
- id: set-matrix
shell: bash
run: |
echo "Seed for random selection is = ${{github.run_number}}"
includes=$(python3 -u .github/workflows/combination_selection.py ${{github.run_number}} 3)
echo "matrix_includes=${includes}" >> $GITHUB_OUTPUT
check-matrix:
runs-on: ubuntu-latest
needs: generate_matrix
steps:
- name: Check matrix definition
run: |
includes='${{ needs.generate_matrix.outputs.matrix_includes }}'
echo "Json received is = $includes"
echo "Check that the json can be converted using GitHubs fromJSON() without error"
matrix_json='${{fromJson(needs.generate_matrix.outputs.matrix_includes)}}'
build_and_test:
needs: [generate_matrix, check-matrix]
strategy:
fail-fast: false
matrix:
BUILD_TYPE: [Release]
OS: [ubuntu-22.04]
ARMA_VERSION: [11.2.3]
include: ${{fromJSON(needs.generate_matrix.outputs.matrix_includes)}}
# The CMake configure and build commands are platform-agnostic and should
# work equally well on Windows or Mac. You can convert this to a matrix
# build if you need cross-platform coverage. See:
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
name: "${{matrix.BUILD_TYPE}}, ${{matrix.OS}}, Armadillo v${{matrix.ARMA_VERSION}}."
runs-on: ${{matrix.OS}}
# Skip this action if the commit is just for docs.
if: ${{ !contains(github.event.head_commit.message, '#docs') }}
steps:
- uses: actions/checkout@v3
- name: Install Linux dependencies
if: startsWith(matrix.OS,'ubuntu')
run: |
sudo apt-get update -y
sudo apt-get install -y \
cmake \
libopenblas-dev \
liblapack-dev \
libarpack2-dev \
libsuperlu-dev \
wget \
libgsl-dev \
doxygen \
graphviz \
libhdf5-serial-dev
- name: Install macOS dependencies
if: startsWith(matrix.OS,'macos')
run: |
brew update
brew install cmake doxygen graphviz wget
brew install arpack hdf5 libaec openblas superlu pkg-config gsl
- name: Download Armadillo from SourceForge
run: |
mkdir armadillo
cd armadillo
wget -O armadillo.tar.xz https://sourceforge.net/projects/arma/files/armadillo-${{matrix.ARMA_VERSION}}.tar.xz/download
- name: Unzip Armadillo tarball and create build directory
working-directory: armadillo
run: |
tar -xf ./armadillo.tar.xz
cd armadillo-${{matrix.ARMA_VERSION}}
mkdir build
cd build
- name: Configure CMake for Armadillo macOS
if: startsWith(matrix.OS,'macos')
working-directory: armadillo/armadillo-${{matrix.ARMA_VERSION}}/build
run: cmake -DALLOW_OPENBLAS_MACOS=ON ..
- name: Configure CMake for Armadillo Linux
working-directory: armadillo/armadillo-${{matrix.ARMA_VERSION}}/build
if: startsWith(matrix.OS,'ubuntu')
run: cmake ..
- name: Build and Install Armadillo
working-directory: armadillo/armadillo-${{matrix.ARMA_VERSION}}/build
run: |
cmake --build . --target all -j 2
sudo cmake --install .
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only
# required if you are using a single-configuration generator such as
# make. See:
# https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}}
- name: Build the entire project
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{matrix.BUILD_TYPE}} --target all -j 2
- name: Run CTest
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -j2 -C ${{matrix.BUILD_TYPE}} --output-on-failure