Skip to content

Commit d2583f6

Browse files
committed
CircleCI config.
1 parent eb1174a commit d2583f6

File tree

2 files changed

+166
-48
lines changed

2 files changed

+166
-48
lines changed

.circleci/config.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
version: 2.1
2+
3+
executors:
4+
default:
5+
description: Executor environment for building Rust crates.
6+
docker:
7+
- image: circleci/rust:1
8+
9+
commands:
10+
update_toolchain:
11+
description: Update the Rust toolchain to use for building.
12+
parameters:
13+
toolchain:
14+
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`.
15+
type: string
16+
default: ""
17+
steps:
18+
- run:
19+
name: Update toolchain
20+
command: |
21+
test -z "<<parameters.toolchain>>" || echo "<<parameters.toolchain>>" >rust-toolchain
22+
rustup show active-toolchain
23+
- run:
24+
name: Version information
25+
command: |
26+
rustup --version
27+
rustc --version
28+
cargo --version
29+
30+
build:
31+
description: Build all targets of a Rust crate.
32+
steps:
33+
- run:
34+
name: Calculate dependencies
35+
command: |
36+
rustc --version >rust-version
37+
test -e Cargo.lock || cargo generate-lockfile
38+
- restore_cache:
39+
keys:
40+
- v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-{{checksum "Cargo.lock"}}
41+
- run:
42+
name: Build all targets
43+
command: cargo build --tests
44+
- save_cache:
45+
paths:
46+
- /usr/local/cargo/registry
47+
- target
48+
key: v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-{{checksum "Cargo.lock"}}
49+
50+
check:
51+
description: Check all targets of a Rust crate.
52+
steps:
53+
- run:
54+
name: Calculate dependencies
55+
command: test -e Cargo.lock || cargo generate-lockfile
56+
- run:
57+
name: Check all targets
58+
command: |
59+
if rustup component add clippy; then
60+
cargo clippy --all --all-targets -- -Dwarnings
61+
else
62+
echo Skipping clippy
63+
fi
64+
65+
test:
66+
description: Run all tests of a Rust crate. Make sure to build first.
67+
parameters:
68+
release:
69+
description: By default, the crate is build in debug mode without optimizations. Set this to true to compile in release mode.
70+
type: boolean
71+
default: false
72+
steps:
73+
- run:
74+
name: Run all tests
75+
command: cargo test
76+
77+
jobs:
78+
check:
79+
description: Check a Rust crate.
80+
parameters:
81+
toolchain:
82+
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`.
83+
type: string
84+
default: ""
85+
executor: default
86+
steps:
87+
- checkout
88+
- update_toolchain:
89+
toolchain: <<parameters.toolchain>>
90+
- check
91+
92+
test:
93+
description: Builds a Rust crate and runs all tests.
94+
parameters:
95+
toolchain:
96+
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`.
97+
type: string
98+
default: ""
99+
executor: default
100+
steps:
101+
- checkout
102+
- update_toolchain:
103+
toolchain: <<parameters.toolchain>>
104+
- build
105+
- test
106+
107+
workflows:
108+
Project:
109+
jobs:
110+
# - test:
111+
# name: cargo test (stable)
112+
# toolchain: stable
113+
# - test:
114+
# name: cargo test (beta)
115+
# toolchain: beta
116+
- test:
117+
name: cargo test (nightly)
118+
toolchain: nightly

ui/cases/update-references.sh

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
#!/bin/bash
2-
#
3-
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
4-
# file at the top-level directory of this distribution and at
5-
# http://rust-lang.org/COPYRIGHT.
6-
#
7-
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8-
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9-
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10-
# option. This file may not be copied, modified, or distributed
11-
# except according to those terms.
12-
13-
# A script to update the references for particular tests. The idea is
14-
# that you do a run, which will generate files in the build directory
15-
# containing the (normalized) actual output of the compiler. This
16-
# script will then copy that output and replace the "expected output"
17-
# files. You can then commit the changes.
18-
#
19-
# If you find yourself manually editing a foo.stderr file, you're
20-
# doing it wrong.
21-
22-
if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then
23-
echo "usage: $0 <build-directory> <relative-path-to-rs-files>"
24-
echo ""
25-
echo "For example:"
26-
echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs"
27-
fi
28-
29-
MYDIR=$(dirname $0)
30-
31-
BUILD_DIR="$1"
32-
shift
33-
34-
while [[ "$1" != "" ]]; do
35-
STDERR_NAME="${1/%.rs/.stderr}"
36-
STDOUT_NAME="${1/%.rs/.stdout}"
37-
shift
38-
if [ -f $BUILD_DIR/$STDOUT_NAME ] && \
39-
! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then
40-
echo updating $MYDIR/$STDOUT_NAME
41-
cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME
42-
fi
43-
if [ -f $BUILD_DIR/$STDERR_NAME ] && \
44-
! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then
45-
echo updating $MYDIR/$STDERR_NAME
46-
cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME
47-
fi
48-
done
1+
#!/bin/bash
2+
#
3+
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
4+
# file at the top-level directory of this distribution and at
5+
# http://rust-lang.org/COPYRIGHT.
6+
#
7+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
# option. This file may not be copied, modified, or distributed
11+
# except according to those terms.
12+
13+
# A script to update the references for particular tests. The idea is
14+
# that you do a run, which will generate files in the build directory
15+
# containing the (normalized) actual output of the compiler. This
16+
# script will then copy that output and replace the "expected output"
17+
# files. You can then commit the changes.
18+
#
19+
# If you find yourself manually editing a foo.stderr file, you're
20+
# doing it wrong.
21+
22+
if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then
23+
echo "usage: $0 <build-directory> <relative-path-to-rs-files>"
24+
echo ""
25+
echo "For example:"
26+
echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs"
27+
fi
28+
29+
MYDIR=$(dirname $0)
30+
31+
BUILD_DIR="$1"
32+
shift
33+
34+
while [[ "$1" != "" ]]; do
35+
STDERR_NAME="${1/%.rs/.stderr}"
36+
STDOUT_NAME="${1/%.rs/.stdout}"
37+
shift
38+
if [ -f $BUILD_DIR/$STDOUT_NAME ] && \
39+
! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then
40+
echo updating $MYDIR/$STDOUT_NAME
41+
cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME
42+
fi
43+
if [ -f $BUILD_DIR/$STDERR_NAME ] && \
44+
! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then
45+
echo updating $MYDIR/$STDERR_NAME
46+
cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME
47+
fi
48+
done

0 commit comments

Comments
 (0)