Skip to content

Apache DataFusion SQL Query Engine

ARROW-5809: [CI] [Rust] Travis runs dockerized Rust build

Andy Groveddf7bc405a91
diff --git a/.dockerignore b/.dockerignore
index 64e3890e62..3df8c2ba5f 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -20,6 +20,7 @@ docker_cache
docs/_build
# IDE
+.idea
.vscode
*/.vscode
@@ -94,6 +95,9 @@ js/test/data/**/*.arrow
# Rust
rust/target
+rust/arrow/target
+rust/parquet/target
+rust/datafusion/target
# Site
site/
diff --git a/.travis.yml b/.travis.yml
index a107bcc3f4..b5285588a6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -284,30 +284,12 @@ matrix:
# -------------------------------------------------------------------------
- name: Rust
language: rust
- cache: cargo
- addons:
- apt:
- packages:
- - libcurl4-openssl-dev
- - libelf-dev
- - libdw-dev
- - binutils-dev
- - libssl-dev
- - cmake
+ os: linux
before_script:
- if [ $ARROW_CI_RUST_AFFECTED != "1" ]; then exit; fi
- - $TRAVIS_BUILD_DIR/ci/travis_install_cargo.sh
+ - docker-compose build --pull rust
script:
- - $TRAVIS_BUILD_DIR/ci/travis_script_rust.sh
- before_cache:
- cargo install cargo-tarpaulin -f
- after_success:
- - pushd ${TRAVIS_BUILD_DIR}/rust
- # Run coverage for codecov.io
- - export ARROW_TEST_DATA=$TRAVIS_BUILD_DIR/testing/data
- - export PARQUET_TEST_DATA=$TRAVIS_BUILD_DIR/cpp/submodules/parquet-testing/data
- - cargo tarpaulin --out Xml
- - bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
+ - docker-compose run rust
# -------------------------------------------------------------------------
- name: Go
diff --git a/ci/travis_script_rust.sh b/ci/docker_build_rust.sh
similarity index 92%
rename from ci/travis_script_rust.sh
rename to ci/docker_build_rust.sh
index 22059df228..7c71105f57 100755
--- a/ci/travis_script_rust.sh
+++ b/ci/docker_build_rust.sh
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -19,17 +18,18 @@
set -e
-source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh
-
-RUST_DIR=${TRAVIS_BUILD_DIR}/rust
-
-pushd $RUST_DIR
+cd /arrow/rust
# show activated toolchain
rustup show
+# clean first
+cargo clean
+
# raises on any formatting errors
+echo "Running formatting checks ..."
cargo +stable fmt --all -- --check
+echo "Formatting checks completed"
# build entire project
RUSTFLAGS="-D warnings" cargo build --all-targets
diff --git a/ci/travis_install_cargo.sh b/ci/travis_install_cargo.sh
deleted file mode 100755
index dac5522c8a..0000000000
--- a/ci/travis_install_cargo.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -e
-
-# ensure that both toolchains are installed
-rustup install stable
-rustup component add rustfmt
-rustup install nightly
-
-export PATH=$HOME/.local/bin:$PATH
-export CARGO_TARGET_DIR=$TRAVIS_BUILD_DIR/target
-export PATH=$HOME/.cargo/bin:$PATH
diff --git a/docker-compose.yml b/docker-compose.yml
index 0ce7e38bc5..c82991883b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -384,8 +384,6 @@ services:
build:
context: .
dockerfile: rust/Dockerfile
- environment:
- PARQUET_TEST_DATA: /arrow/cpp/submodules/parquet-testing/data
volumes: *ubuntu-volumes
r:
diff --git a/rust/Dockerfile b/rust/Dockerfile
index a6e0463253..b9097c08e1 100644
--- a/rust/Dockerfile
+++ b/rust/Dockerfile
@@ -15,15 +15,23 @@
# specific language governing permissions and limitations
# under the License.
-FROM rustlang/rust:nightly
+FROM rust:1.38.0-buster
+RUN rustup show
-# sadly cargo doesn't have a command to fetch and build the
-# dependencies without building the library itself
-ENV CARGO_TARGET_DIR=/build/rust
-COPY rust/Cargo.toml /arrow/rust/Cargo.toml
-WORKDIR /arrow/rust
+# Install stable rustfmt
+RUN rustup install stable
+RUN rustup component add rustfmt
+# Install the specific version of Rust nightly that we need so that we don't need to download it for every CI run
+COPY rust/rust-toolchain /tmp
+RUN rustup install "$(cat /tmp/rust-toolchain)"
+RUN rustup default "$(cat /tmp/rust-toolchain)"
+
+# Enable stable rustfmt for nightly Rust
+RUN rustup component add rustfmt --toolchain stable-x86_64-unknown-linux-gnu
+
+# Set environment variables for location of test data required by unit and integration tests
ENV ARROW_TEST_DATA=/arrow/testing/data
ENV PARQUET_TEST_DATA=/arrow/cpp/submodules/parquet-testing/data
-CMD ["cargo", "test"]
+CMD ["/bin/bash", "-c", "arrow/ci/docker_build_rust.sh"]