-
Notifications
You must be signed in to change notification settings - Fork 39
165 lines (149 loc) · 5.3 KB
/
cmake.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# This workflow configures, builds, and tests MAD-X on several platforms
# and configurations using CMake.
# TODO:
# - add more configuration settings, these are quick!
# - fix test failures: test-track-9 test-thick-quad-2
name: cmake
on:
push:
pull_request:
jobs:
configure:
# Configure on several platforms using many different settings. This
# doesn't build or test, so can give only basic protection against syntax
# errors in the CMake config.
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- windows
- macos
cmake:
- v2.8 2.8.12.2 Linux-i386 win32-x86 Darwin64-universal
- v3.0 3.0.2 Linux-i386 win32-x86 Darwin64-universal
- v3.10 3.10.3 Linux-x86_64 win64-x64 Darwin-x86_64
- v3.18 3.18.2 Linux-x86_64 win64-x64 Darwin-x86_64
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Download cmake for Linux
if: matrix.os == 'ubuntu'
run: |
set -ex
tags=(${{ matrix.cmake }})
filename="cmake-${tags[1]}-${tags[2]}.tar.gz"
curl -Lo "$filename" "https://cmake.org/files/${tags[0]}/$filename"
tar -xzf "$filename" --one-top-level=cmake-dist --strip-components 1
- name: Download cmake for Windows
if: matrix.os == 'windows'
run: |
set -ex
tags=(${{ matrix.cmake }})
filename="cmake-${tags[1]}-${tags[3]}.zip"
curl -Lo "$filename" "https://cmake.org/files/${tags[0]}/$filename"
7z x "$filename"
mv "${filename%.zip}" cmake-dist
- name: Download cmake for MacOS
if: matrix.os == 'macos'
run: |
set -ex
tags=(${{ matrix.cmake }})
filename="cmake-${tags[1]}-${tags[4]}.tar.gz"
curl -Lo "$filename" "https://cmake.org/files/${tags[0]}/$filename"
tar -xzf "$filename"
mv "${filename%.tar.gz}"/*.app/Contents cmake-dist
- name: Setup cmake
run: |
cat >configure <<EOF
#!/usr/bin/env bash
rm -rf build
mkdir build
cd build
if [[ ${{ matrix.os }} == windows ]]; then
$(pwd)/cmake-dist/bin/cmake .. "\$@" -G "MSYS Makefiles"
elif [[ ${{ matrix.os }} == macos ]]; then
$(pwd)/cmake-dist/bin/cmake .. "\$@" \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_C_COMPILER=gcc-12 \
-DCMAKE_CXX_COMPILER=g++-12 \
-DCMAKE_Fortran_COMPILER=gfortran-12
else
$(pwd)/cmake-dist/bin/cmake .. "\$@"
fi
EOF
chmod +x configure
- run: ./configure
- run: ./configure -DBUILD_SHARED_LIBS=OFF
- run: ./configure -DBUILD_SHARED_LIBS=ON
- run: ./configure -DCMAKE_BUILD_TYPE=Debug
- run: ./configure -DCMAKE_BUILD_TYPE=Release
- run: ./configure -DMADX_STATIC=OFF
- run: ./configure -DMADX_STATIC=ON
- run: ./configure -DMADX_DEBUG=OFF
- run: ./configure -DMADX_DEBUG=ON
- run: ./configure -DMADX_NTPSA=OFF
- run: ./configure -DMADX_NTPSA=ON
- run: ./configure -DUSE_GC=OFF
- run: ./configure -DUSE_GC=ON
- run: ./configure -DMADX_FORCE_32=OFF
- run: ./configure -DMADX_FORCE_32=ON
- run: ./configure -DMADX_ONLINE=OFF
- run: ./configure -DMADX_ONLINE=ON
if: matrix.os == 'linux'
- run: ./configure -DMADX_X11=OFF
- run: ./configure -DMADX_X11=ON
- run: ./configure -DMADX_LAPACK=OFF
- run: ./configure -DMADX_LAPACK=ON
build:
# Configure, build, and test with few settings. This is slow, so shouldn't
# add too many combinations here.
runs-on: ubuntu-20.04
env:
MADXDIR: ${{ github.workspace }}/dist
strategy:
fail-fast: false
matrix:
include:
- {name: defaults, flags: ''}
- {name: lapack, flags: -DMADX_LAPACK=OFF}
- {name: x11, flags: -DMADX_X11=ON}
- {name: static, flags: -DMADX_STATIC=ON}
- {name: shared, flags: -DBUILD_SHARED_LIBS=ON}
- {name: release, flags: -DCMAKE_BUILD_TYPE=Release}
steps:
- uses: actions/checkout@v3
- name: Install MAD-X build dependencies
run: |
sudo apt-get update
sudo apt-get install -qy \
libblas-dev \
liblapack-dev \
gfortran \
gnuplot
- name: Build MAD-X as library
run: |
set -ex
mkdir build && cd build
cmake ${{ matrix.flags }} ..
cmake --build .
- name: Run tests
id: tests
# exclude LONG tests:
# sequence-2 is throwing error on purpose
run: cd build && ../.github/utils/ctest -E 'LONG|sequence-2'
env:
GFORTRAN_UNBUFFERED_PRECONNECTED: y
- name: Upload test outputs for inspection
# Keep the redundant condition (see main.yml)!
if: failure() && steps.tests.outcome == 'failure'
uses: actions/upload-artifact@v3
with:
name: failures-cmake-${{ matrix.name }}
path: |
build/tests/tests-log.txt
build/tests/tests-summary.txt
${{ steps.tests.outputs.failed-tests }}