From aaa58eb669e90a28e5e0077441677d50e76fcf69 Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Wed, 5 Feb 2020 23:17:21 +0800 Subject: [PATCH] Cache includes version and Cargo.lock --- .circleci/config.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 483ef737..a9d17351 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - win: circleci/windows@2.4.0 + windows: circleci/windows@2.4.0 jobs: build-linux: @@ -12,28 +12,30 @@ jobs: OPENSSL_STATIC: "1" OPENSSL_LIB_DIR: "/usr/lib/x86_64-linux-gnu/" OPENSSL_INCLUDE_DIR: "/usr/include/x86_64-linux-gnu/" - SODIUM_LIB_DIR: "/usr/lib/x86_64-linux-gnu/" RUSTFLAGS: "-Ctarget-feature=+aes,+ssse3" steps: - checkout - run: | sudo apt-get update - sudo apt-get install -y build-essential libssl-dev libsodium-dev + sudo apt-get install -y build-essential libssl-dev + - run: | + rustc --version >rust-version + test -e Cargo.lock || cargo generate-lockfile - restore_cache: - key: cargo-cache-{{ arch }} + key: cargo-cache-{{ arch }}-{{ checksum "rust-version" }}-{{ checksum "Cargo.lock" }} - run: ./build-host-release - save_cache: paths: - /usr/local/cargo/registry - ./target - key: cargo-cache-{{ arch }} + key: cargo-cache-{{ arch }}-{{ checksum "rust-version" }}-{{ checksum "Cargo.lock" }} - store_artifacts: path: ./build/release destination: releases build-windows: - executor: win/default + executor: windows/default environment: OPENSSL_STATIC: "1" @@ -46,14 +48,19 @@ jobs: $ProgressPreference = "SilentlyContinue" Invoke-WebRequest -Uri "http://slproweb.com/download/Win64OpenSSL-1_1_1d.exe" -OutFile "C:\Win64OpenSSL-1_1_1d.exe" & C:\Win64OpenSSL-1_1_1d.exe /SILENT /VERYSILENT /SP- /DIR="C:\OpenSSL" + - run: | + rustc --version | Out-File -FilePath "rust-version" + if (Test-Path "Cargo.lock" -PathType Leaf) { + cargo generate-lockfile + } - restore_cache: - key: cargo-cache-{{ arch }} + key: cargo-cache-{{ arch }}-{{ checksum "rust-version" }}-{{ checksum "Cargo.lock" }} - run: ./build-host-release - save_cache: paths: - /usr/local/cargo/registry - ./target - key: cargo-cache-{{ arch }} + key: cargo-cache-{{ arch }}-{{ checksum "rust-version" }}-{{ checksum "Cargo.lock" }} - store_artifacts: path: ./build/release destination: releases