Skip to content

CI: consolidate the CI jobs #239

CI: consolidate the CI jobs

CI: consolidate the CI jobs #239

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
MACOSX_DEPLOYMENT_TARGET: 14.0
jobs:
Run_Tests:
name: "Run tests with ${{ matrix.compiler }} and ${{ matrix.mpi }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest"]
compiler: ["gfortran", "lfortran"]
mpi: ["openmpi", "mpich"]
steps:
- uses: actions/checkout@v4
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v2.0.2
with:
micromamba-version: '2.0.4-0'
environment-file: ci/environment_${{ matrix.compiler }}_${{ matrix.mpi }}.yml
- name: Run standalone tests without custom MPI wrappers
if: matrix.compiler == 'gfortran'
shell: bash -e -x -l {0}
run: |
cd tests
./run_tests.sh --without-wrappers
- name: Run standalone tests with ${{ matrix.compiler }}
shell: bash -e -x -l {0}
run: |
cd tests
if [ "${{ matrix.compiler }}" = "gfortran" ]; then
FC_without_opt="gfortran -cpp"
FC_with_opt="gfortran -O3 -march=native -cpp"
else
FC_without_opt="lfortran --cpp"
FC_with_opt="lfortran --fast --cpp"
fi
# when it's OpenMPI we add "-DOPEN_MPI=yes" flag
if [ "${{ matrix.mpi }}" = "openmpi" ]; then
FC_without_opt="$FC_without_opt -DOPEN_MPI=yes"
FC_with_opt="$FC_with_opt -DOPEN_MPI=yes"
fi
# Run tests with and without optimization
FC="$FC_without_opt" ./run_tests.sh
FC="$FC_with_opt" ./run_tests.sh
- name: Build and validate POT3D with ${{ matrix.compiler }}
shell: bash -e -x -l {0}
run: |
cd tests/pot3d
if [ "${{ matrix.compiler }}" = "gfortran" ]; then
FC_without_opt="gfortran -cpp"
FC_with_opt="gfortran -O3 -march=native -cpp"
build_script="./build_and_run_gfortran.sh"
else
FC_without_opt="lfortran --cpp"
FC_with_opt="lfortran --fast --cpp"
build_script="./build_and_run_lfortran.sh"
fi
# when it's OpenMPI we add "-DOPEN_MPI=yes" flag
if [ "${{ matrix.mpi }}" = "openmpi" ]; then
FC_without_opt="$FC_without_opt -DOPEN_MPI=yes"
FC_with_opt="$FC_with_opt -DOPEN_MPI=yes"
fi
FC="$FC_without_opt" $build_script
FC="$FC_with_opt" $build_script