# 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: # 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", ]