-
Notifications
You must be signed in to change notification settings - Fork 3
135 lines (120 loc) · 4.55 KB
/
unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Unit Tests
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ubuntu-24.04
strategy:
matrix:
comp: ['gnu', 'llvm']
mpi: ['FALSE', 'TRUE']
debug: ['FALSE', 'TRUE']
omp: ['FALSE', 'TRUE']
comp-version: [12, 13, 14, 16, 17, 18]
exclude:
# see available compiler versions here: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
- comp-version: 12
comp: 'llvm'
- comp-version: 13
comp: 'llvm'
- comp-version: 14
comp: 'llvm'
- comp-version: 16
comp: 'gnu'
- comp-version: 17
comp: 'gnu'
- comp-version: 18
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_CONFIG: >
COMP=${{ matrix.comp }}
DEBUG=${{ matrix.debug}}
USE_MPI=${{ matrix.mpi }}
USE_OMP=${{ matrix.omp }}
USE_HDF5=TRUE
USE_CCACHE=TRUE
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: Set Up Cache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ github.workflow }}-${{ github.job }}-${{ join(matrix.*, '-') }}-git-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-${{ github.job }}-${{ join(matrix.*, '-') }}-git-
- 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: |
PACKAGES="hdf5-tools ccache"
if [[ "${{ matrix.mpi }}" == "TRUE" ]]; then
PACKAGES="${PACKAGES} libopenmpi-dev libhdf5-openmpi-dev"
else
PACKAGES="${PACKAGES} libhdf5-dev"
fi
if [[ "${{ matrix.comp }}" == "llvm" && "${{ matrix.omp }}" == "TRUE" ]]; then
PACKAGES="${PACKAGES} libomp-${{ matrix.comp-version }}-dev"
fi
if [[ "${{ matrix.comp }}" == "gnu" ]]; then
PACKAGES="${PACKAGES} cpp-${{ matrix.comp-version }}"
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
# workaround for https://answers.launchpad.net/ubuntu/+question/816000
sudo update-alternatives --remove-all cpp
sudo rm -rf /etc/alternatives/cpp
sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-${{ matrix.comp-version }} 1000
g++ --version
cpp --version
echo "ompi_cxx=g++" >> $GITHUB_OUTPUT
echo "build_args=${BUILD_CONFIG}" >> $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 "ompi_cxx=clang++" >> $GITHUB_OUTPUT
# Use the LLD linker with LLVM
echo "build_args=${BUILD_CONFIG} LDFLAGS=-fuse-ld=lld" >> $GITHUB_OUTPUT
fi
- name: Build Tests
working-directory: ${{ env.TESTS_DIR }}
run: |
if [[ "${{ matrix.mpi }}" == "TRUE" ]]; then
export HDF5_HOME=/usr/lib/x86_64-linux-gnu/hdf5/openmpi
else
export HDF5_HOME=/usr/lib/x86_64-linux-gnu/hdf5/serial
fi
export OMPI_CXX=${{ steps.set-compilers.outputs.ompi_cxx }}
make -j 4 ${{ steps.set-compilers.outputs.build_args }}
- name: Run tests
working-directory: ${{ env.TESTS_DIR }}
run: make run ${{ env.BUILD_CONFIG }}