-
Notifications
You must be signed in to change notification settings - Fork 68
148 lines (136 loc) · 4.64 KB
/
Copy pathcmake.yml
File metadata and controls
148 lines (136 loc) · 4.64 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
name: CMake test matrix
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
paths:
- .github/workflows/cmake.yml
- .gitmodules
- '**/CMakeLists.txt'
- '**/*.cmake'
- '**/*.in'
- '**/*.h'
- '**/*.c'
- '**/*.cc'
- '**/*.cpp'
- '**/*.f'
jobs:
build:
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
compiler:
- { name: GNU, CC: gcc-10, CXX: g++-10 }
- { name: LLVM, CC: clang, CXX: clang++ }
build_type: [Debug, Release]
no_mpi: [OFF, ON]
cxx_standard: [11, 20]
metis: [OFF, ON]
exclude:
- compiler: { name: LLVM }
build_type: Release
- cxx_standard: 20
build_type: Release
env:
CCACHE_DIR: ${{github.workspace}}/.ccache
CCACHE_BASEDIR: ${{github.workspace}}
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 100M
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: install mpich and gcc
run: |
sudo apt update
sudo apt install gcc-10 g++-10 mpich
- name: install metis
if: matrix.metis == 'ON'
run: sudo apt install libmetis-dev
- name: setup ccache
id: setup-ccache
run: |
sudo apt-get install ccache
ccache -p # Print ccache config
echo timestamp=$(date -u '+%Y-%m-%dT%T') >> "$GITHUB_OUTPUT"
- name: ccache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/.ccache
key: "${{matrix.compiler.name}}-\
cxx:${{matrix.cxx_standard}}-\
${{matrix.build_type}}-\
nompi:${{matrix.no_mpi}}-\
ccache-${{steps.setup-ccache.outputs.timestamp}}"
restore-keys: "${{matrix.compiler.name}}-\
cxx:${{matrix.cxx_standard}}-\
${{matrix.build_type}}-\
nompi:${{matrix.no_mpi}}-\
ccache-"
- name: Clear ccache statistics
run: ccache -z
- name: Configure CMake
env:
MPICH_CXX: ${{matrix.compiler.CXX}}
MPICH_CC: ${{matrix.compiler.CC}}
run: >
cmake -S ${{github.workspace}} -B ${{github.workspace}}/build
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install
-GNinja -DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
-DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc
-DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}}
-DSCOREC_CXX_WARNINGS=ON
-DIS_TESTING=ON
-DMESHES=${{github.workspace}}/pumi-meshes
-DSCOREC_NO_MPI=${{matrix.no_mpi}}
-DENABLE_METIS=${{matrix.metis}}
- name: Build
env:
MPICH_CXX: ${{matrix.compiler.CXX}}
MPICH_CC: ${{matrix.compiler.CC}}
run: cmake --build ${{github.workspace}}/build --target install
- name: Test
env:
MPICH_CXX: ${{matrix.compiler.CXX}}
MPICH_CC: ${{matrix.compiler.CC}}
working-directory: ${{github.workspace}}/build
run: ctest --output-on-failure
- name: Build User Project
# only need to test with a single build config if the installed cmake config files work
if: matrix.compiler.name == 'GNU' && matrix.build_type == 'Release'
env:
MPICH_CXX: ${{matrix.compiler.CXX}}
MPICH_CC: ${{matrix.compiler.CC}}
run: >
cmake
-S ${{github.workspace}}/doc -B ${{github.workspace}}/buildExample
-DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx
-DSCOREC_PREFIX=${{github.workspace}}/build/install ;
cmake --build ${{github.workspace}}/buildExample
- name: Build MPI-NoMPI Example
# Test if a SCOREC_NO_MPI build works with MPI applications.
if: >-
matrix.compiler.name == 'GNU' && matrix.build_type == 'Release' &&
matrix.no_mpi == 'ON'
env:
MPICH_CXX: ${{matrix.compiler.CXX}}
MPICH_CC: ${{matrix.compiler.CC}}
run: >
cmake
-S ${{github.workspace}}/example/mpi-nompi
-B ${{github.workspace}}/example/mpi-nompi/build
-DCMAKE_C_COMPILER=mpicxx -DCMAKE_CXX_COMPILER=mpicxx
-DSCOREC_PREFIX=${{github.workspace}}/build/install ;
cmake --build ${{github.workspace}}/example/mpi-nompi/build ;
ctest --test-dir ${{github.workspace}}/example/mpi-nompi/build
--output-on-failure
- name: CCache statistics and recompression
run: |
ccache -sv
ccache -X 5