1
1
mirror of https://github.com/nmattia/niv.git synced 2024-10-06 12:27:35 +03:00

Skip cache packing when not master

This commit is contained in:
Nicolas Mattia 2019-02-03 14:16:50 +01:00
parent 8d4c790464
commit 6e5de019e7

View File

@ -29,6 +29,8 @@ jobs:
du -h $cache_path
echo "Loading cache..."
zcat $cache_path | nix-store --import
echo "Removing cache file"
rm $cache_path
echo "done"
else
echo "Cache does not exist yet"
@ -41,20 +43,25 @@ jobs:
- run:
name: Create cache
command: |
cache_path=~/.nix-build-cache-export.gz
store_list=~/.store-list
echo "Listing paths"
nix-instantiate \
| xargs nix-store -qR --include-outputs \
> $store_list
echo "Generating cache file"
cat $store_list \
| nix-store --export `xargs` \
| gzip -c \
> $cache_path
echo "Cache size:"
du -h $cache_path
echo "done"
if [ "$CIRCLE_BRANCH" == "master" ]; then
echo "Creating cache"
cache_path=~/.nix-build-cache-export.gz
store_list=~/.store-list
echo "Listing paths"
nix-instantiate \
| xargs nix-store -qR --include-outputs \
> $store_list
echo "Generating cache file"
cat $store_list \
| nix-store --export `xargs` \
| gzip -c \
> $cache_path
echo "Cache size:"
du -h $cache_path
echo "done"
else
echo "Not creating cache"
fi
- save_cache:
key: v1-niv-{{ .Branch }}-{{ .BuildNum }}