ci: workaround for problem with i686 builds
[fio.git] / ci / actions-install.sh
1 #!/bin/bash
2 # This script expects to be invoked from the base fio directory.
3 set -eu
4
5 SCRIPT_DIR=$(dirname "$0")
6 # shellcheck disable=SC1091
7 . "${SCRIPT_DIR}/common.sh"
8
9 install_ubuntu() {
10     local pkgs
11
12     cat <<DPKGCFG | sudo tee /etc/dpkg/dpkg.cfg.d/dpkg-speedup > /dev/null
13 # Skip fsync
14 force-unsafe-io
15 # Don't install documentation
16 path-exclude=/usr/share/man/*
17 path-exclude=/usr/share/locale/*/LC_MESSAGES/*.mo
18 path-exclude=/usr/share/doc/*
19 DPKGCFG
20     # Packages available on i686 and x86_64
21     pkgs=(
22         libaio-dev
23         libcunit1-dev
24         libcurl4-openssl-dev
25         libfl-dev
26         libibverbs-dev
27         libnuma-dev
28         librdmacm-dev
29         valgrind
30     )
31     case "${CI_TARGET_ARCH}" in
32         "i686")
33             sudo dpkg --add-architecture i386
34             opts="--allow-downgrades"
35             pkgs=("${pkgs[@]/%/:i386}")
36             pkgs+=(
37                 gcc-multilib
38                 pkg-config:i386
39                 zlib1g-dev:i386
40                 libpcre2-8-0=10.34-7
41             )
42             ;;
43         "x86_64")
44             opts=""
45             pkgs+=(
46                 libglusterfs-dev
47                 libgoogle-perftools-dev
48                 libiscsi-dev
49                 libnbd-dev
50                 libpmem-dev
51                 libpmemblk-dev
52                 librbd-dev
53                 libtcmalloc-minimal4
54                 nvidia-cuda-dev
55             )
56             ;;
57     esac
58
59     # Architecture-independent packages and packages for which we don't
60     # care about the architecture.
61     pkgs+=(
62         python3-scipy
63     )
64
65     echo "Updating APT..."
66     sudo apt-get -qq update
67     echo "Installing packages..."
68     sudo apt-get install "$opts" -o APT::Immediate-Configure=false --no-install-recommends -qq -y "${pkgs[@]}"
69 }
70
71 install_linux() {
72     install_ubuntu
73 }
74
75 install_macos() {
76     # Assumes homebrew and python3 are already installed
77     #echo "Updating homebrew..."
78     #brew update >/dev/null 2>&1
79     echo "Installing packages..."
80     HOMEBREW_NO_AUTO_UPDATE=1 brew install cunit
81     pip3 install scipy six
82 }
83
84 main() {
85     set_ci_target_os
86
87     install_function="install_${CI_TARGET_OS}"
88     ${install_function}
89
90     echo "Python3 path: $(type -p python3 2>&1)"
91     echo "Python3 version: $(python3 -V 2>&1)"
92 }
93
94 main