Skip to content

CI: Fetch amrex if there is already a clone #89

CI: Fetch amrex if there is already a clone

CI: Fetch amrex if there is already a clone #89

Workflow file for this run

name: Unit Tests
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ubuntu-22.04
strategy:
matrix:
comp: ['gnu', 'llvm']
mpi: ['FALSE', 'TRUE']
debug: ['FALSE', 'TRUE']
omp: ['FALSE', 'TRUE']
comp-version: [9, 10, 11, 12, 13, 14, 15]
exclude:
# see available compiler versions here: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
- comp-version: 9
comp: 'llvm'
- comp-version: 10
comp: 'llvm'
- comp-version: 11
comp: 'llvm'
- comp-version: 12
comp: 'llvm'
- comp-version: 14
comp: 'gnu'
- comp-version: 15
comp: 'gnu'
name: ${{ matrix.comp }} ${{ matrix.comp-version }}, DEBUG = ${{ matrix.debug }}, USE_MPI = ${{ matrix.mpi }}, USE_OMP = ${{ matrix.omp }}
env:
AMREX_HOME: ${{ github.workspace }}/amrex
OMP_NUM_THREADS: 1
TESTS_DIR: ${{ github.workspace }}/GRTeclyn/Tests
BUILD_ARGS: COMP=${{ matrix.comp }} DEBUG=${{ matrix.debug}} USE_MPI=${{ matrix.mpi }} USE_OMP=${{ matrix.omp }}
steps:
- name: Checkout AMReX
uses: actions/checkout@v4
with:
repository: AMReX-Codes/amrex
path: amrex
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
with:
path: GRTeclyn
submodules: true
- name: Update package manager database
id: update-database
continue-on-error: true
run: sudo apt-get update
# This is quite slow so only do this if the previous command fails
- name: Update package repository mirrors if necessary
if: steps.update-database.outcome == 'failure'
run: |
sudo gem install apt-spy2
sudo apt-spy2 fix --commit --launchpad --country=US
sudo apt-get update
- name: Install dependencies
run: |
if [[ "${{ matrix.mpi }}" == "TRUE" ]]; then
PACKAGES="libmpich-dev"
fi
if [[ "${{ matrix.comp }}" == "llvm" && "${{ matrix.omp }}" == "TRUE" ]]; then
PACKAGES="${PACKAGES} libomp-${{ matrix.comp-version }}-dev"
fi
if [[ "$PACKAGES" != "" ]]; then
sudo apt-get -y --no-install-recommends install $PACKAGES
fi
- name: Set Compilers
id: set-compilers
run: |
if [[ "${{ matrix.comp }}" == "gnu" ]]; then
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.comp-version }} 1000
sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-${{ matrix.comp-version }} 1000
g++ --version
cpp --version
echo "mpich_cxx=g++" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.comp }}" == "llvm" ]]; then
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ matrix.comp-version }} 1000
clang++ --version
echo "mpich_cxx=clang++" >> $GITHUB_OUTPUT
fi
- name: Build Tests
working-directory: ${{ env.TESTS_DIR }}
run: |
export MPICH_CXX=${{ steps.set-compilers.outputs.mpich_cxx }}
make -j 4 ${{ env.BUILD_ARGS }}
- name: Run tests
working-directory: ${{ env.TESTS_DIR }}
run: make run ${{ env.BUILD_ARGS }}