2020-02-07 15:39:31 +00:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
# Adding these commands but need confirmation of cache location
|
|
|
|
commands:
|
|
|
|
cache_restore:
|
|
|
|
description: Restore Cargo Cache
|
|
|
|
steps:
|
|
|
|
- restore_cache:
|
|
|
|
name: Restoring Cargo Cache
|
|
|
|
keys:
|
2020-02-07 17:25:32 +00:00
|
|
|
- cargo-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
|
|
|
|
- cargo-cache-{{ arch }}-{{ .Branch }}
|
|
|
|
- cargo-cache
|
2020-02-07 15:39:31 +00:00
|
|
|
cache_save:
|
|
|
|
description: Save Cargo Cache
|
|
|
|
steps:
|
|
|
|
- save_cache:
|
|
|
|
name: Save Cargo Cache
|
|
|
|
paths:
|
|
|
|
- /usr/local/cargo/registry
|
2020-02-07 17:25:32 +00:00
|
|
|
key: cargo-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
|
2020-02-07 15:39:31 +00:00
|
|
|
|
2020-06-05 21:45:44 +00:00
|
|
|
rust_nightly:
|
|
|
|
description: Install nightly tools
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
name: Install rust nightly-2020-04-22
|
|
|
|
command: rustup toolchain install nightly-2020-04-22
|
|
|
|
- run:
|
|
|
|
name: Install rustfmt and clippy for nightly-2020-04-22
|
|
|
|
command: rustup component add rustfmt clippy --toolchain nightly-2020-04-22
|
|
|
|
|
2020-02-07 15:39:31 +00:00
|
|
|
jobs:
|
|
|
|
fmt:
|
|
|
|
docker:
|
2020-05-28 01:25:57 +00:00
|
|
|
- image: quay.io/influxdb/rust:ci
|
2020-02-07 15:39:31 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2020-06-05 21:45:44 +00:00
|
|
|
- rust_nightly
|
2020-02-07 15:39:31 +00:00
|
|
|
- run:
|
|
|
|
name: Rust fmt
|
2020-02-14 13:01:39 +00:00
|
|
|
command: cargo fmt --all -- --check
|
2020-02-07 15:39:31 +00:00
|
|
|
lint:
|
|
|
|
docker:
|
2020-05-28 01:25:57 +00:00
|
|
|
- image: quay.io/influxdb/rust:ci
|
2020-02-07 15:39:31 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2020-06-05 21:45:44 +00:00
|
|
|
- rust_nightly
|
2020-02-07 15:39:31 +00:00
|
|
|
- run:
|
|
|
|
name: Clippy
|
2020-05-08 14:24:01 +00:00
|
|
|
command: cargo clippy --all-targets --workspace -- -D warnings
|
2020-02-07 15:39:31 +00:00
|
|
|
test:
|
|
|
|
docker:
|
2020-05-28 01:25:57 +00:00
|
|
|
- image: quay.io/influxdb/rust:ci
|
2020-06-08 20:25:24 +00:00
|
|
|
resource_class: medium+
|
2020-02-07 15:39:31 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- cache_restore
|
2020-06-05 21:45:44 +00:00
|
|
|
- rust_nightly
|
2020-02-07 15:39:31 +00:00
|
|
|
- run:
|
|
|
|
name: Cargo test
|
2020-05-08 14:24:01 +00:00
|
|
|
command: cargo test --workspace
|
2020-02-07 15:39:31 +00:00
|
|
|
- cache_save
|
|
|
|
build:
|
|
|
|
docker:
|
2020-05-28 01:25:57 +00:00
|
|
|
- image: quay.io/influxdb/rust:ci
|
2020-02-07 15:39:31 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- cache_restore
|
2020-06-05 21:45:44 +00:00
|
|
|
- rust_nightly
|
2020-02-07 15:39:31 +00:00
|
|
|
- run:
|
|
|
|
name: Cargo build
|
2020-05-08 14:24:01 +00:00
|
|
|
command: cargo build --workspace
|
2020-02-07 15:39:31 +00:00
|
|
|
- cache_save
|
2020-05-28 01:25:57 +00:00
|
|
|
ci_image:
|
|
|
|
machine: true
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: |
|
|
|
|
echo "$QUAY_PASS" | docker login quay.io --username $QUAY_USER --password-stdin
|
|
|
|
- run: |
|
|
|
|
COMMIT_SHA=$(git rev-parse --short HEAD)
|
|
|
|
docker build -t quay.io/influxdb/rust:$COMMIT_SHA -f Dockerfile.ci .
|
|
|
|
docker tag quay.io/influxdb/rust:$COMMIT_SHA quay.io/influxdb/rust:ci
|
|
|
|
docker push quay.io/influxdb/rust:$COMMIT_SHA
|
|
|
|
docker push quay.io/influxdb/rust:ci
|
2020-06-29 19:33:41 +00:00
|
|
|
perf_image:
|
|
|
|
docker:
|
|
|
|
- image: quay.io/influxdb/rust:ci
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- cache_restore
|
|
|
|
- rust_nightly
|
|
|
|
- run:
|
|
|
|
name: Cargo release build
|
|
|
|
command: cargo build --release
|
|
|
|
- setup_remote_docker:
|
|
|
|
docker_layer_caching: true
|
|
|
|
- run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y docker.io
|
|
|
|
- run: |
|
|
|
|
echo "$QUAY_PASS" | docker login quay.io --username $QUAY_USER --password-stdin
|
|
|
|
- run: |
|
|
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD | tr '/' '.')
|
|
|
|
docker build -t quay.io/influxdb/rust:$BRANCH -f Dockerfile.perf .
|
|
|
|
docker push quay.io/influxdb/rust:$BRANCH
|
2020-02-07 15:39:31 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build:
|
|
|
|
jobs:
|
|
|
|
- fmt
|
|
|
|
- lint
|
|
|
|
- test
|
|
|
|
- build
|
2020-06-29 19:33:41 +00:00
|
|
|
- perf_image:
|
|
|
|
requires: # Only do a release build if all tests have passed
|
|
|
|
- fmt
|
|
|
|
- lint
|
|
|
|
- test
|
|
|
|
- build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /.*\/perf$/ # Only do a release build if the branch name ends in `/perf`
|
2020-05-28 01:25:57 +00:00
|
|
|
ci_image:
|
|
|
|
triggers:
|
|
|
|
- schedule:
|
|
|
|
cron: "0 5 * * *"
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
jobs:
|
|
|
|
- ci_image
|