Skip to content

Commit

Permalink
Merge pull request #13 from mizo0203/ci_cache
Browse files Browse the repository at this point in the history
perf(.circleci): change cache key.
  • Loading branch information
みぞ@CrazyBeatCoder committed Aug 11, 2018
2 parents 2570cd3 + 523611c commit 77d925c
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
- run: sudo chown -R circleci:circleci /usr/local/lib/python2.7/site-packages
- restore_cache:
keys:
- v2-dependencies-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-
- v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}-
- run:
name: install cache deb file
command: |
Expand All @@ -31,8 +29,10 @@ jobs:
- run:
name: install lsb-release and set CLOUD_SDK_REPO
command: |
sudo apt-get -d install lsb-release
sudo apt -d install lsb-release
if [[ $(find /var/cache/apt/archives -name "*.deb") == *".deb"* ]];then
mkdir -p /home/circleci/apt/archives/
cp -r /var/cache/apt/archives/*.deb /home/circleci/apt/archives/
sudo dpkg -i /var/cache/apt/archives/*.deb
fi
echo 'export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"' >> $BASH_ENV
Expand All @@ -41,25 +41,20 @@ jobs:
command: |
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get -d install google-cloud-sdk google-cloud-sdk-app-engine-python google-cloud-sdk-app-engine-python-extras
sudo apt update
sudo apt -d install google-cloud-sdk google-cloud-sdk-app-engine-python google-cloud-sdk-app-engine-python-extras
if [[ $(find /var/cache/apt/archives -name "*.deb") == *".deb"* ]];then
mkdir -p /home/circleci/apt/archives/
cp -r /var/cache/apt/archives/*.deb /home/circleci/apt/archives/
sudo dpkg -i /var/cache/apt/archives/*.deb
fi
echo 'export PATH=$PATH:/usr/lib/google-cloud-sdk/platform/google_appengine/bin/' >> $BASH_ENV
echo 'export PYTHONPATH=$PYTHONPATH:/usr/lib/google-cloud-sdk/platform/google_appengine/' >> $BASH_ENV
- run:
name: vendor our dependencies
command: pip install -r requirements.txt
- run:
name: copy deb file to cache directory
command: |
if [[ $(find /var/cache/apt/archives -name "*.deb") == *".deb"* ]];then
mkdir -p /home/circleci/apt/archives/
cp -r /var/cache/apt/archives/*.deb /home/circleci/apt/archives/
fi
- save_cache:
key: v2-dependencies-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}-{{ epoch }}
paths:
- "/usr/local/bin"
- "/usr/local/lib/python2.7/site-packages"
Expand Down Expand Up @@ -93,9 +88,7 @@ jobs:
- checkout
- restore_cache:
keys:
- v2-dependencies-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-
- v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}-
- run:
name: Retrieve our secrets from the CircleCI environment
command: echo $CLIENT_SECRET | base64 --decode > ${HOME}/client-secret.json
Expand Down

0 comments on commit 77d925c

Please sign in to comment.