restore_registry: &RESTORE_REGISTRY
  restore_cache:
    key: registry
save_registry: &SAVE_REGISTRY
  save_cache:
    key: registry-{{ .BuildNum }}
    paths:
    - /usr/local/cargo/registry/index
deps_key: &DEPS_KEY
  key: deps-{{ checksum "~/rust-version" }}-{{ checksum "Cargo.lock" }}
restore_deps: &RESTORE_DEPS
  restore_cache:
    <<: *DEPS_KEY
save_deps: &SAVE_DEPS
  save_cache:
    <<: *DEPS_KEY
    paths:
    - target
    - /usr/local/cargo/registry/cache

version: 2
jobs:
  stable:
    docker:
      - image: rust:1.25.0-slim
    environment:
      RUSTFLAGS: -D warnings
    steps:
      - checkout
      - *RESTORE_REGISTRY
      - run: cargo generate-lockfile
      - *SAVE_REGISTRY
      - run: rustc --version > ~/rust-version
      - *RESTORE_DEPS
      - run: cargo test -p phf_codegen_test
      - *SAVE_DEPS
  nightly:
    docker:
      - image: rustlang/rust:nightly-slim
    environment:
      RUSTFLAGS: -D warnings
    steps:
      - checkout
      - *RESTORE_REGISTRY
      - run: cargo generate-lockfile
      - *SAVE_REGISTRY
      - run: rustc --version > ~/rust-version
      - *RESTORE_DEPS
      - run: cargo test -p phf_macros
      - run: cargo test -p phf_codegen_test
      - *SAVE_DEPS

workflows:
  version: 2
  test:
    jobs:
      - stable
      - nightly

restore_registry: &RESTORE_REGISTRY
  restore_cache:
    key: registry
save_registry: &SAVE_REGISTRY
  save_cache:
    key: registry-{{ .BuildNum }}
    paths:
    - /usr/local/cargo/registry/index
deps_key: &DEPS_KEY
  key: deps-{{ checksum "~/rust-version" }}-{{ checksum "Cargo.lock" }}
restore_deps: &RESTORE_DEPS
  restore_cache:
    <<: *DEPS_KEY
save_deps: &SAVE_DEPS
  save_cache:
    <<: *DEPS_KEY
    paths:
    - target
    - /usr/local/cargo/registry/cache

version: 2
jobs:
  stable:
    docker:
      - image: rust:1.25.0-slim
    environment:
      RUSTFLAGS: -D warnings
    steps:
      - checkout
      - *RESTORE_REGISTRY
      - run: cargo generate-lockfile
      - *SAVE_REGISTRY
      - run: rustc --version > ~/rust-version
      - *RESTORE_DEPS
      - run: cargo test -p phf_codegen_test
      - *SAVE_DEPS
  nightly:
    docker:
      - image: rustlang/rust:nightly-slim
    environment:
      RUSTFLAGS: -D warnings
    steps:
      - checkout
      - *RESTORE_REGISTRY
      - run: cargo generate-lockfile
      - *SAVE_REGISTRY
      - run: rustc --version > ~/rust-version
      - run: cargo test -p phf_macros
      - run: cargo test -p phf_codegen_test

workflows:
  version: 2
  test:
    jobs:
      - stable
      - nightly

Stop caching deps for nightly build
Stop caching deps for nightly build

It makes compiletest unhappy
