diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a47c1a5e9..74610fb61 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -5,7 +5,8 @@ WORKDIR /root RUN mkdir -p ./tools/scripts/lib_install COPY ./tools/scripts/lib_install ./tools/scripts/lib_install -RUN ./tools/scripts/lib_install/linux/install-dev.sh +RUN ./tools/scripts/lib_install/ubuntu/install-dev-wolf.sh +RUN ./tools/scripts/lib_install/ubuntu/install-dev-huntsman.sh # NOTE: # `task` doesn't have an apt/yum package so we use its install script. diff --git a/.github/workflows/code-linting-checks.yaml b/.github/workflows/code-linting-checks.yaml index 2890ea614..fa37293f4 100644 --- a/.github/workflows/code-linting-checks.yaml +++ b/.github/workflows/code-linting-checks.yaml @@ -47,7 +47,7 @@ jobs: - uses: "./tools/yscope-dev-utils/exports/github/actions/install-uv" - name: "Install dev dependencies" - run: "./tools/scripts/lib_install/linux/install-dev.sh" + run: "./tools/scripts/lib_install/ubuntu/install-dev-common.sh" - run: "task lint:toml-check" @@ -75,7 +75,7 @@ jobs: - uses: "./tools/yscope-dev-utils/exports/github/actions/install-uv" - name: "Install dev dependencies" - run: "./tools/scripts/lib_install/linux/install-dev.sh" + run: "./tools/scripts/lib_install/ubuntu/install-dev-wolf.sh" - uses: "./tools/yscope-dev-utils/exports/github/actions/print-tool-versions" @@ -151,7 +151,7 @@ jobs: - uses: "./tools/yscope-dev-utils/exports/github/actions/install-uv" - name: "Install dev dependencies" - run: "./tools/scripts/lib_install/linux/install-dev.sh" + run: "./tools/scripts/lib_install/ubuntu/install-dev-common.sh" - run: "task lint:py-check" @@ -174,7 +174,7 @@ jobs: - uses: "./tools/yscope-dev-utils/exports/github/actions/install-uv" - name: "Install dev dependencies" - run: "./tools/scripts/lib_install/linux/install-dev.sh" + run: "./tools/scripts/lib_install/ubuntu/install-dev-huntsman.sh" - run: "task lint:check-rust" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e8ee9c474..46870c499 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -59,7 +59,7 @@ jobs: - uses: "./tools/yscope-dev-utils/exports/github/actions/install-uv" - name: "Install dev dependencies" - run: "./tools/scripts/lib_install/linux/install-dev.sh" + run: "./tools/scripts/lib_install/ubuntu/install-dev-wolf.sh" - uses: "./tools/yscope-dev-utils/exports/github/actions/print-tool-versions" @@ -97,7 +97,7 @@ jobs: - uses: "./tools/yscope-dev-utils/exports/github/actions/install-uv" - name: "Install dev dependencies" - run: "./tools/scripts/lib_install/linux/install-dev.sh" + run: "./tools/scripts/lib_install/ubuntu/install-dev-huntsman.sh" - uses: "./tools/yscope-dev-utils/exports/github/actions/print-tool-versions" diff --git a/tools/scripts/lib_install/ubuntu/install-dev-common.sh b/tools/scripts/lib_install/ubuntu/install-dev-common.sh new file mode 100755 index 000000000..4a24c8e45 --- /dev/null +++ b/tools/scripts/lib_install/ubuntu/install-dev-common.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Installs the dev dependencies shared by all versions of Spider. + +# Exit on any error +set -e + +# Error on undefined variable +set -u + +echo "Checking for elevated privileges..." +privileged_command_prefix="" +if [ ${EUID:-$(id -u)} -ne 0 ] ; then + sudo echo "Script can elevate privileges." + privileged_command_prefix="${privileged_command_prefix} sudo" +fi + +${privileged_command_prefix} apt-get update +DEBIAN_FRONTEND=noninteractive ${privileged_command_prefix} \ +apt-get install --no-install-recommends -y \ + ca-certificates \ + curl \ + git \ + python3 \ + python3-pip \ + python3-venv + +# Install uv +curl -LsSf https://astral.sh/uv/install.sh | sh diff --git a/tools/scripts/lib_install/ubuntu/install-dev-huntsman.sh b/tools/scripts/lib_install/ubuntu/install-dev-huntsman.sh new file mode 100755 index 000000000..73b64eab0 --- /dev/null +++ b/tools/scripts/lib_install/ubuntu/install-dev-huntsman.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Installs the dev dependencies for Spider Huntsman. + +# Exit on any error +set -e + +# Error on undefined variable +set -u + +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +"$script_dir"/install-dev-common.sh + +echo "Checking for elevated privileges..." +privileged_command_prefix="" +if [ ${EUID:-$(id -u)} -ne 0 ] ; then + sudo echo "Script can elevate privileges." + privileged_command_prefix="${privileged_command_prefix} sudo" +fi + +# `gcc` and `libc6-dev` are required by `rustc`, which invokes the system C compiler driver to +# link binaries against libc. +DEBIAN_FRONTEND=noninteractive ${privileged_command_prefix} \ +apt-get install --no-install-recommends -y \ + gcc \ + libc6-dev diff --git a/tools/scripts/lib_install/linux/install-dev.sh b/tools/scripts/lib_install/ubuntu/install-dev-wolf.sh similarity index 70% rename from tools/scripts/lib_install/linux/install-dev.sh rename to tools/scripts/lib_install/ubuntu/install-dev-wolf.sh index c1f1b4f77..2c816b0aa 100755 --- a/tools/scripts/lib_install/linux/install-dev.sh +++ b/tools/scripts/lib_install/ubuntu/install-dev-wolf.sh @@ -1,25 +1,28 @@ #!/usr/bin/env bash +# Installs the dev dependencies for Spider Wolf. + # Exit on any error set -e # Error on undefined variable set -u +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +"$script_dir"/install-dev-common.sh + echo "Checking for elevated privileges..." privileged_command_prefix="" if [ ${EUID:-$(id -u)} -ne 0 ] ; then sudo echo "Script can elevate privileges." privileged_command_prefix="${privileged_command_prefix} sudo" fi -${privileged_command_prefix} apt-get update -DEBIAN_FRONTEND=noninteractive ${privileged_command_prefix} apt-get install --no-install-recommends -y \ - ca-certificates \ + +DEBIAN_FRONTEND=noninteractive ${privileged_command_prefix} \ +apt-get install --no-install-recommends -y \ checkinstall \ - curl \ g++ \ gcc \ - git \ jq \ libcurl4 \ libcurl4-openssl-dev \ @@ -27,16 +30,9 @@ DEBIAN_FRONTEND=noninteractive ${privileged_command_prefix} apt-get install --no libssl-dev \ make \ openjdk-11-jdk \ - pkg-config \ - python3 \ - python3-pip \ - python3-venv + pkg-config -script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" lib_install_scripts_dir="$script_dir/.." ${privileged_command_prefix} "$lib_install_scripts_dir"/install-cmake.sh 3.23.5 # TODO https://github.com/y-scope/spider/issues/86 "$lib_install_scripts_dir"/check-cmake-version.sh - -# Install uv -curl -LsSf https://astral.sh/uv/install.sh | sh