CircleCI config.
This commit is contained in:
parent
eb1174ae97
commit
d2583f6d75
|
@ -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
|
Loading…
Reference in New Issue