-
Notifications
You must be signed in to change notification settings - Fork 29
100 lines (97 loc) · 3.43 KB
/
CI.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
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/gridtools/gridtools-base:${{ matrix.compiler }}
strategy:
matrix:
compiler: [gcc-10, gcc-11, gcc-12, gcc-13, clang-10, clang-15, clang-16, clang-17, clang-18]
build_type: [Debug, Release]
exclude:
- compiler: gcc-10
build_type: Debug
- compiler: gcc-11
build_type: Debug
- compiler: gcc-12
build_type: Debug
- compiler: clang-10
build_type: Debug
- compiler: clang-14
build_type: Debug
- compiler: clang-15
build_type: Debug
- compiler: clang-16
build_type: Debug
steps:
- uses: actions/checkout@v1
- name: Enable Fortran
if: startsWith(matrix.compiler, 'gcc')
run: echo "TEST_FORTRAN=ON" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install python modules
run: python3 -m pip install nose-py3 numpy
- name: Cache pFUnit
id: cache-pfunit
uses: actions/cache@v3.2.4
with:
path: pfunit
key: ${{ matrix.compiler }}-pfunit
- name: Install pFUnit
if: startsWith(matrix.compiler, 'gcc') && steps.cache-pfunit.outputs.cache-hit != 'true'
env:
PFUNIT_VERSION: 4.6.3
run: |
apt-get update && apt-get -y install m4
git clone --branch v${PFUNIT_VERSION} --depth 1 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
cd pFUnit
mkdir -p build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/pfunit
make -j8 install
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H-%M-%S" UTC)
message("echo \"timestamp=${current_date}\" >> $GITHUB_OUTPUT")
- name: Set ccache environment
run: |
echo "CCACHE_MAXSIZE=400M" >> $GITHUB_ENV
echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "CCACHE_DIR=$GITHUB_WORKSPACE/.ccache" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
- name: ccache cache files
uses: actions/cache@v3.2.4
with:
path: .ccache
key: ${{ matrix.compiler }}-${{ matrix.build_type }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.compiler }}-${{ matrix.build_type }}-ccache-
- name: Configure
run: |
ccache -s
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DPython3_EXECUTABLE=`which python3` \
-DSERIALBOX_TESTING=ON \
-DSERIALBOX_ENABLE_FORTRAN=${TEST_FORTRAN} \
-DSERIALBOX_TESTING_FORTRAN=${TEST_FORTRAN} \
-DSERIALBOX_TESTING_PYTHON=ON \
-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/pfunit \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build build --parallel 2
- name: Execute tests
run: cd build && ctest --output-on-failure