version: 2
jobs:
stable:
docker:
- image: circleci/rust:latest
steps:
- checkout
- run:
name: Change Permissions for Cargo Cache
command: |
if [ -d "/usr/local/cargo" ]; then
sudo chown -R circleci:circleci /usr/local/cargo
fi
- restore_cache:
key: stable-cache-v1-{{ checksum "Cargo.toml" }}
- run:
name: Use a Stable Build
command: rustup override set stable
- run:
name: Show Version
command: |
rustc --version --verbose
rustup --version
cargo --version --verbose
- run:
name: Create _tests_ branch and switch to master
command: |
git checkout -b _tests_
if [ $(git branch --list master | cat | cut -c 3-) ]; then
git checkout master
else
git checkout -b master
fi
- run:
name: Run Tests
command: cargo test
- save_cache:
key: stable-cache-v1-{{ checksum "Cargo.toml" }}
paths:
- "~/.cargo/"
- "~/.rustup/"
- "./target"
- "/usr/local/cargo"
nightly:
docker:
- image: circleci/rust:latest
steps:
- checkout
- run:
name: Change Permissions for Cargo Cache
command: |
if [ -d "/usr/local/cargo" ]; then
sudo chown -R circleci:circleci /usr/local/cargo
fi
- restore_cache:
key: nightly-cache-v1-{{ checksum "Cargo.toml" }}
- run:
name: Use a Nightly Build
command: rustup override set nightly
- run:
name: Show Version
command: |
rustc --version --verbose
rustup --version
cargo --version --verbose
- run:
name: Create _tests_ branch and switch to master
command: |
git checkout -b _tests_
if [ $(git branch --list master | cat | cut -c 3-) ]; then
git checkout master
else
git checkout -b master
fi
- run:
name: Run Tests
command: cargo test
- save_cache:
key: nightly-cache-v1-{{ checksum "Cargo.toml" }}
paths:
- "~/.cargo/"
- "~/.rustup/"
- "./target"
- "/usr/local/cargo"
workflows:
version: 2
test:
jobs:
- stable
- nightly
nightly_cron:
jobs:
- nightly
triggers:
- schedule:
cron: "0 2 * * *"
filters:
branches:
only:
- master