04_install.sh raw
1 #!/usr/bin/env bash
2 #
3 # Copyright (c) 2018-present The Limenka developers
4 # Distributed under the MIT software license, see the accompanying
5 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
6
7 export LC_ALL=C
8
9 export CI_RETRY_EXE="/ci_retry --"
10
11 pushd "/"
12
13 ${CI_RETRY_EXE} apt-get update
14 # Lint dependencies:
15 # - curl/xz-utils (to install shellcheck)
16 # - git (used in many lint scripts)
17 # - gpg (used by verify-commits)
18 ${CI_RETRY_EXE} apt-get install -y curl xz-utils git gpg
19
20 PYTHON_PATH="/python_build"
21 if [ ! -d "${PYTHON_PATH}/bin" ]; then
22 (
23 ${CI_RETRY_EXE} git clone --depth=1 https://github.com/pyenv/pyenv.git
24 cd pyenv/plugins/python-build || exit 1
25 ./install.sh
26 )
27 # For dependencies see https://github.com/pyenv/pyenv/wiki#suggested-build-environment
28 ${CI_RETRY_EXE} apt-get install -y build-essential libssl-dev zlib1g-dev \
29 libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
30 libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
31 clang
32 env CC=clang python-build "$(cat "/.python-version")" "${PYTHON_PATH}"
33 fi
34 export PATH="${PYTHON_PATH}/bin:${PATH}"
35 command -v python3
36 python3 --version
37
38 export LINT_RUNNER_PATH="/lint_test_runner"
39 if [ ! -d "${LINT_RUNNER_PATH}" ]; then
40 ${CI_RETRY_EXE} apt-get install -y cargo
41 (
42 cd "/test/lint/test_runner" || exit 1
43 cargo build
44 mkdir -p "${LINT_RUNNER_PATH}"
45 mv target/debug/test_runner "${LINT_RUNNER_PATH}"
46 )
47 fi
48
49 ${CI_RETRY_EXE} pip3 install \
50 codespell==2.2.6 \
51 lief==0.13.2 \
52 mypy==1.4.1 \
53 pyzmq==25.1.0 \
54 ruff==0.5.5 \
55 vulture==2.6
56
57 SHELLCHECK_VERSION=v0.8.0
58 curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \
59 tar --xz -xf - --directory /tmp/
60 mv "/tmp/shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/bin/
61
62 MLC_VERSION=v0.19.0
63 MLC_BIN=mlc-x86_64-linux
64 curl -sL "https://github.com/becheran/mlc/releases/download/${MLC_VERSION}/${MLC_BIN}" -o "/usr/bin/mlc"
65 chmod +x /usr/bin/mlc
66
67 popd || exit
68