influxdb/.circleci/config.yml

105 lines
2.6 KiB
YAML
Raw Normal View History

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:
- cargo-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
- cargo-cache-{{ arch }}-{{ .Branch }}
- cargo-cache
cache_save:
description: Save Cargo Cache
steps:
- save_cache:
name: Save Cargo Cache
paths:
- /usr/local/cargo/registry
key: cargo-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Cargo.lock" }}
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
jobs:
fmt:
docker:
- image: quay.io/influxdb/rust:ci
steps:
- checkout
2020-06-05 21:45:44 +00:00
- rust_nightly
- run:
name: Rust fmt
2020-02-14 13:01:39 +00:00
command: cargo fmt --all -- --check
lint:
docker:
- image: quay.io/influxdb/rust:ci
steps:
- checkout
2020-06-05 21:45:44 +00:00
- rust_nightly
- run:
name: Clippy
command: cargo clippy --all-targets --workspace -- -D warnings
test:
docker:
- image: quay.io/influxdb/rust:ci
steps:
- checkout
- cache_restore
2020-06-05 21:45:44 +00:00
- rust_nightly
- run:
name: Cargo test
command: cargo test --workspace
- cache_save
build:
docker:
- image: quay.io/influxdb/rust:ci
steps:
- checkout
- cache_restore
2020-06-05 21:45:44 +00:00
- rust_nightly
- run:
name: Cargo build
command: cargo build --workspace
- cache_save
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
workflows:
version: 2
build:
jobs:
- fmt
- lint
- test
- build
ci_image:
triggers:
- schedule:
cron: "0 5 * * *"
filters:
branches:
only:
- master
jobs:
- ci_image