-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.toml
233 lines (202 loc) · 5.29 KB
/
Makefile.toml
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# to test in a docker container:
# - 18.04 => bionic (LTS)
# - 18.10 => cosmic
# - 19.04 => disco
# - 19.10 => eoan
# - 20.04 => focal (LTS)
# - 20.10 => groovy
# - 21.04 => hirsuite
# - 21.10 => impish
# - 22.04 => jammy (LTS)
# - 22.10 => kinetic
# docker run -it -v $PWD:/app ubuntu:<VERSION>
# cd /app
# apt-get update
# apt-get install curl build-essential -y
# curl https://sh.rustup.rs -sSf | sh -s -- -y
# source $HOME/.cargo/env
# cargo install cargo-make
# cargo make install_deps_no_flag
# cargo make install_deps
[tasks.linux_apt_get_update]
script = """
[ $(id -u) != 0 ] && export SUDO="sudo" || export SUDO=""
$SUDO apt-get update
"""
[tasks.linux_install_essentials]
script = """
[ $(id -u) != 0 ] && export SUDO="sudo" || export SUDO=""
$SUDO apt-get install -y \
autoconf \
build-essential \
cmake \
git \
libtool \
pkg-config \
unzip \
wget \
zip
"""
dependencies = ["linux_apt_get_update"]
[tasks.linux_install_cfitsio]
script = """
#!/bin/bash -x
# don't do anything if it's already installed
$(command -v pkg-config &> /dev/null) && pkg-config --atleast-version=3.49 cfitsio && exit 0
# otherwise we might need sudo
[ $(id -u) != 0 ] && export SUDO="sudo" || export SUDO=""
# if ubuntu > 20.10, install through apt
$(source /etc/os-release && dpkg --compare-versions "$VERSION_ID" gt "21.04" &> /dev/null) \
&& $SUDO apt-get install -y libcfitsio-dev \
&& exit 0
# otherwise build from source
cd /tmp
wget http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.49.tar.gz
tar -zxvf cfitsio-3.49.tar.gz
cd cfitsio-3.49/
CFLAGS="-O3" ./configure --prefix=/usr/local --enable-reentrant --enable-ssse3 --enable-sse2
make -j $(nproc)
$SUDO make install
"""
dependencies = ["linux_install_essentials"]
[tasks.linux_install_aoflagger]
script = """
#!/bin/bash -x
# don't do anything if it's already installed
$(command -v aoflagger &> /dev/null) && dpkg --compare-versions "$(aoflagger -version | cut -d' ' -f 2)" ge "3.0" && exit 0
# otherwise we might need sudo
[ $(id -u) != 0 ] && export SUDO="sudo" || export SUDO=""
# if ubuntu > 21.04, install through apt
$(source /etc/os-release && dpkg --compare-versions "$VERSION_ID" gt "21.04" &> /dev/null) \
&& $SUDO apt-get install -y aoflagger-dev \
&& exit 0
# otherwise build from source
$SUDO apt-get install -y \
casacore-data \
casacore-dev \
libblas-dev \
libboost-date-time-dev \
libboost-filesystem-dev \
libboost-system-dev \
libboost-test-dev \
libfftw3-dev \
libgsl-dev \
libgtkmm-3.0-dev \
libhdf5-dev \
liblapack-dev \
liblua5.3-dev \
libpng-dev \
libpython3-dev \
libssl-dev \
libxml2-dev \
python3
cd /tmp
[ -d "aoflagger" ] && rm -rf aoflagger
git clone --recurse-submodules https://gitlab.com/aroffringa/aoflagger.git --branch v3.4.0
cd aoflagger
chmod a+rwx .
mkdir build
cd build
cmake ..
make -j $(nproc)
$SUDO make install
"""
dependencies = ["linux_install_cfitsio"]
[tasks.install_cfitsio]
linux_alias = "linux_install_cfitsio"
[tasks.install_deps_no_flag]
dependencies = ["install_cfitsio"]
[tasks.linux_install_deps]
dependencies = ["linux_install_aoflagger"]
[tasks.mac_install_deps]
script = """
INSTALL="brew install"
# in github actions runners:
# - macos-13: uname -m => x86_64, arch => i386
# - macos-14: uname -m => x86_64, arch => i386
# but macos-14 should be arm64 ?
# in that case, we want INSTALL="arch -arm64 $INSTALL" apparently?
$INSTALL mwatelescope/tap/aoflagger
"""
[tasks.install_deps]
linux_alias = "linux_install_deps"
mac_alias = "mac_install_deps"
[tasks.linux_check_deps]
script = """
#!/bin/bash
unset mod_versions
declare -A mod_versions
mod_versions[cfitsio]=3.49
for mod_name in "${!mod_versions[@]}"
do
min_version=${mod_versions[$mod_name]}
pkg-config --atleast-version=${min_version} ${mod_name} \
|| echo "${mod_name} out of date. Needs ${min_version}, has " $(pkg-config --modversion ${mod_name})
done
"""
[tasks.check]
command = "cargo"
args = ["check"]
[tasks.format_fix]
command = "cargo"
args = ["fmt", "--", "--emit=files"]
install_crate = "rustfmt"
[tasks.format_check]
command = "cargo"
args = ["fmt", "--all", "--", "--check"]
install_crate = "rustfmt"
[tasks.clippy]
command = "cargo"
args = ["clippy", "--all-targets", "--all-features", "--", "-D", "warnings"]
install_crate = "clippy"
[tasks.clean]
command = "cargo"
args = ["clean"]
[tasks.rustdoc]
command = "cargo"
args = ["rustdoc", "--lib", "--all-features", "--", "--document-private-items"]
[tasks.update]
script = """
set +e
# hopefully this won't be needed again any time soon.
exit 0
"""
[tasks.build_clean]
command = "cargo"
args = ["build"]
dependencies = ["clean"]
[tasks.test]
command = "cargo"
args = ["test", "--release"]
[tasks.test_ignored]
command = "cargo"
args = ["test", "--release", "--", "--ignored"]
[tasks.test_no_default]
command = "cargo"
args = ["test", "--no-default-features", "--release"]
[tasks.test_no_flag]
command = "cargo"
args = ["test", "--no-default-features", "--release", "--features=cli"]
[tasks.test_package]
command = "cargo"
args = ["package", "--allow-dirty"]
[tasks.ci]
dependencies = [
"clean",
"update",
"check",
"format_check",
"clippy",
"test_no_default",
"test",
]
[tasks.pre_commit]
dependencies = [
"format_fix",
"check",
"clippy",
"test_no_default",
"test",
"rustdoc",
"test_package",
]