Skip to content

Commit

Permalink
Add a Rust Installer (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Sep 20, 2024
1 parent 4327b26 commit 8e4f0db
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,34 @@ functions:
cd ${PROJECT_DIRECTORY}
make test
"run install binaries test":
- command: shell.exec
type: test
params:
shell: bash
script: |-
set -o errexit
cd ${DRIVERS_TOOLS}
if [ -z "${SKIP_NODE}" ]; then
.evergreen/install-node.sh
fi
.evergreen/install-rust.sh
PATH=.bin:$PATH
if [ $OS == "Windows_NT" ]; then
exit 0
fi
case $(uname -m) in
aarch64 | x86_64 | arm64)
. ./.evergreen/ensure-binary.sh gcloud
gcloud --version
. ./.evergreen/ensure-binary.sh kubectl
which kubectl
;;
esac
# Generate a test results file
cd ${PROJECT_DIRECTORY}
make test
"teardown assets":
- command: subprocess.exec
params:
Expand Down Expand Up @@ -938,6 +966,11 @@ tasks:
# vars:
# VARIANT: aks

- name: "test-install-binaries"
tags: ["pr"]
commands:
- func: "run install binaries test"

# }}}

task_groups:
Expand Down Expand Up @@ -1243,6 +1276,8 @@ axes:
- id: rhel7
display_name: "RHEL 7"
run_on: rhel70-small
variables:
SKIP_NODE: 1

- id: rhel8-power8
display_name: "RHEL 8 (POWER8)"
Expand Down Expand Up @@ -1367,6 +1402,13 @@ buildvariants:
- name: "test-3.6-replica_set"
- name: "test-3.6-sharded_cluster"
- name: "test-3.6-standalone"
rules:
- if:
auth: "auth"
ssl: "ssl"
os-fully-featured: "*"
then:
add_tasks: ["test-install-binaries"]

- matrix_name: "tests-os-requires-50"
matrix_spec: {"os-requires-50": "*", auth: "*", ssl: "*" }
Expand All @@ -1384,6 +1426,13 @@ buildvariants:
- name: "test-5.0-replica_set"
- name: "test-5.0-sharded_cluster"
- name: "test-5.0-standalone"
rules:
- if:
auth: "auth"
ssl: "ssl"
os-requires-50: "*"
then:
add_tasks: ["test-install-binaries"]

- matrix_name: "tests-os-requires-70"
matrix_spec: {"os-requires-70": "*", auth: "*", ssl: "*" }
Expand All @@ -1398,6 +1447,13 @@ buildvariants:
- name: "test-7.0-replica_set"
- name: "test-7.0-sharded_cluster"
- name: "test-7.0-standalone"
rules:
- if:
auth: "auth"
ssl: "ssl"
os-requires-70: "*"
then:
add_tasks: ["test-install-binaries"]

# Storage Engine Tests on Ubuntu 20.04
- matrix_name: "tests-storage-engines"
Expand Down
1 change: 1 addition & 0 deletions .evergreen/ensure-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ else
"$SCRIPT_DIR/retry-with-backoff.sh" curl -L -s $URL -o $FNAME
tar xfz $FNAME
popd
mkdir -p ${DRIVERS_TOOLS}/.bin
ln -s /tmp/google-cloud-sdk/bin/gcloud $DRIVERS_TOOLS/.bin/gcloud
fi

Expand Down
33 changes: 33 additions & 0 deletions .evergreen/install-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -eu

SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
. $SCRIPT_DIR/handle-paths.sh
pushd $SCRIPT_DIR

export RUSTUP_HOME="${RUSTUP_HOME:-"${DRIVERS_TOOLS}/.rustup"}"
export CARGO_HOME="${CARGO_HOME:-"${DRIVERS_TOOLS}/.cargo"}"
export PATH="${RUSTUP_HOME}/bin:${CARGO_HOME}/bin:$PATH"

# Make sure to use msvc toolchain rather than gnu, which is the default for cygwin
if [ "Windows_NT" == "${OS:-}" ]; then
export DEFAULT_HOST_OPTIONS='--default-host x86_64-pc-windows-msvc'
# rustup/cargo need the native Windows paths
RUSTUP_HOME=$(cygpath ${RUSTUP_HOME} --windows)
CARGO_HOME=$(cygpath ${CARGO_HOME} --windows)
fi

curl --retry 8 https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path ${DEFAULT_HOST_OPTIONS:-}

if [ "Windows_NT" == "${OS:-}" ]; then
# This file is not created by default on Windows
echo 'export PATH="$PATH:${CARGO_HOME}/bin"' >>${CARGO_HOME}/env
echo "export CARGO_NET_GIT_FETCH_WITH_CLI=true" >>${CARGO_HOME}/env
fi

echo "cargo location: $(which cargo)"
echo "cargo version: $(cargo --version)"
echo "rustc location: $(which rustc)"
echo "rustc version: $(rustc --version)"

popd
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ mo-expansion.sh
.env
.bin
.kube
.cargo
.rustup

# Azure functions.
.python_packages/
Expand Down

0 comments on commit 8e4f0db

Please sign in to comment.