-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
166 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
default: | ||
description: Executor environment for building Rust crates. | ||
docker: | ||
- image: circleci/rust:1 | ||
|
||
commands: | ||
update_toolchain: | ||
description: Update the Rust toolchain to use for building. | ||
parameters: | ||
toolchain: | ||
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`. | ||
type: string | ||
default: "" | ||
steps: | ||
- run: | ||
name: Update toolchain | ||
command: | | ||
test -z "<<parameters.toolchain>>" || echo "<<parameters.toolchain>>" >rust-toolchain | ||
rustup show active-toolchain | ||
- run: | ||
name: Version information | ||
command: | | ||
rustup --version | ||
rustc --version | ||
cargo --version | ||
build: | ||
description: Build all targets of a Rust crate. | ||
steps: | ||
- run: | ||
name: Calculate dependencies | ||
command: | | ||
rustc --version >rust-version | ||
test -e Cargo.lock || cargo generate-lockfile | ||
- restore_cache: | ||
keys: | ||
- v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-{{checksum "Cargo.lock"}} | ||
- run: | ||
name: Build all targets | ||
command: cargo build --tests | ||
- save_cache: | ||
paths: | ||
- /usr/local/cargo/registry | ||
- target | ||
key: v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-{{checksum "Cargo.lock"}} | ||
|
||
check: | ||
description: Check all targets of a Rust crate. | ||
steps: | ||
- run: | ||
name: Calculate dependencies | ||
command: test -e Cargo.lock || cargo generate-lockfile | ||
- run: | ||
name: Check all targets | ||
command: | | ||
if rustup component add clippy; then | ||
cargo clippy --all --all-targets -- -Dwarnings | ||
else | ||
echo Skipping clippy | ||
fi | ||
test: | ||
description: Run all tests of a Rust crate. Make sure to build first. | ||
parameters: | ||
release: | ||
description: By default, the crate is build in debug mode without optimizations. Set this to true to compile in release mode. | ||
type: boolean | ||
default: false | ||
steps: | ||
- run: | ||
name: Run all tests | ||
command: cargo test | ||
|
||
jobs: | ||
check: | ||
description: Check a Rust crate. | ||
parameters: | ||
toolchain: | ||
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`. | ||
type: string | ||
default: "" | ||
executor: default | ||
steps: | ||
- checkout | ||
- update_toolchain: | ||
toolchain: <<parameters.toolchain>> | ||
- check | ||
|
||
test: | ||
description: Builds a Rust crate and runs all tests. | ||
parameters: | ||
toolchain: | ||
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`. | ||
type: string | ||
default: "" | ||
executor: default | ||
steps: | ||
- checkout | ||
- update_toolchain: | ||
toolchain: <<parameters.toolchain>> | ||
- build | ||
- test | ||
|
||
workflows: | ||
Project: | ||
jobs: | ||
- test: | ||
name: cargo test (stable) | ||
toolchain: stable | ||
- test: | ||
name: cargo test (beta) | ||
toolchain: beta | ||
- test: | ||
name: cargo test (nightly) | ||
toolchain: nightly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
# file at the top-level directory of this distribution and at | ||
# http://rust-lang.org/COPYRIGHT. | ||
# | ||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
# option. This file may not be copied, modified, or distributed | ||
# except according to those terms. | ||
|
||
# A script to update the references for particular tests. The idea is | ||
# that you do a run, which will generate files in the build directory | ||
# containing the (normalized) actual output of the compiler. This | ||
# script will then copy that output and replace the "expected output" | ||
# files. You can then commit the changes. | ||
# | ||
# If you find yourself manually editing a foo.stderr file, you're | ||
# doing it wrong. | ||
|
||
if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then | ||
echo "usage: $0 <build-directory> <relative-path-to-rs-files>" | ||
echo "" | ||
echo "For example:" | ||
echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs" | ||
fi | ||
|
||
MYDIR=$(dirname $0) | ||
|
||
BUILD_DIR="$1" | ||
shift | ||
|
||
while [[ "$1" != "" ]]; do | ||
STDERR_NAME="${1/%.rs/.stderr}" | ||
STDOUT_NAME="${1/%.rs/.stdout}" | ||
shift | ||
if [ -f $BUILD_DIR/$STDOUT_NAME ] && \ | ||
! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then | ||
echo updating $MYDIR/$STDOUT_NAME | ||
cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME | ||
fi | ||
if [ -f $BUILD_DIR/$STDERR_NAME ] && \ | ||
! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then | ||
echo updating $MYDIR/$STDERR_NAME | ||
cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME | ||
fi | ||
done | ||
#!/bin/bash | ||
# | ||
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
# file at the top-level directory of this distribution and at | ||
# http://rust-lang.org/COPYRIGHT. | ||
# | ||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
# option. This file may not be copied, modified, or distributed | ||
# except according to those terms. | ||
|
||
# A script to update the references for particular tests. The idea is | ||
# that you do a run, which will generate files in the build directory | ||
# containing the (normalized) actual output of the compiler. This | ||
# script will then copy that output and replace the "expected output" | ||
# files. You can then commit the changes. | ||
# | ||
# If you find yourself manually editing a foo.stderr file, you're | ||
# doing it wrong. | ||
|
||
if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then | ||
echo "usage: $0 <build-directory> <relative-path-to-rs-files>" | ||
echo "" | ||
echo "For example:" | ||
echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs" | ||
fi | ||
|
||
MYDIR=$(dirname $0) | ||
|
||
BUILD_DIR="$1" | ||
shift | ||
|
||
while [[ "$1" != "" ]]; do | ||
STDERR_NAME="${1/%.rs/.stderr}" | ||
STDOUT_NAME="${1/%.rs/.stdout}" | ||
shift | ||
if [ -f $BUILD_DIR/$STDOUT_NAME ] && \ | ||
! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then | ||
echo updating $MYDIR/$STDOUT_NAME | ||
cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME | ||
fi | ||
if [ -f $BUILD_DIR/$STDERR_NAME ] && \ | ||
! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then | ||
echo updating $MYDIR/$STDERR_NAME | ||
cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME | ||
fi | ||
done |