CI: cache the Nim compiler binaries between builds

This commit is contained in:
Ștefan Talpalaru 2019-06-09 16:48:29 +02:00
parent 7298393166
commit a0066abf95
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
3 changed files with 15 additions and 5 deletions

View File

@ -3,6 +3,9 @@ version: '{build}'
# use an image with recent Mingw-w64 versions available on both architectures: https://www.appveyor.com/docs/windows-images-software/#mingw-msys-cygwin
image: Visual Studio 2015
cache:
- NimBinaries
matrix:
# We always want 32-bit and 64-bit compilation
fast_finish: false
@ -22,6 +25,7 @@ install:
build_script:
- cd C:\projects\%APPVEYOR_PROJECT_SLUG%
# the 32-bit build is done on a 64-bit image, so we need to override the architecture
- mingw32-make -j2 ARCH_OVERRIDE=%PLATFORM% CI_CACHE=NimBinaries update
- mingw32-make -j2 ARCH_OVERRIDE=%PLATFORM% fetch-dlls
- dir C:\mingw-w64

View File

@ -1,9 +1,10 @@
language: c # or other C/C++ variants
language: c
# https://docs.travis-ci.com/user/caching/
cache:
directories:
- rocksdb
- vendor/Nim/bin
git:
# when multiple CI builds are queued, the tested commit needs to be in the last X commits cloned with "--depth X"
@ -23,7 +24,7 @@ matrix:
install:
# build our own rocksdb to test with a fixed version that we think works
- "export ROCKSDBVER=5.14.2"
- export ROCKSDBVER=5.14.2
- "[ -f rocksdb/rocksdb-$ROCKSDBVER/Makefile ] || { rm -rf rocksdb ; mkdir -p rocksdb; cd rocksdb; wget https://github.com/facebook/rocksdb/archive/v$ROCKSDBVER.tar.gz && tar xvf v$ROCKSDBVER.tar.gz; cd ..; }"
- cd rocksdb/rocksdb-$ROCKSDBVER
- "[ -f util/build_version.cc ] || { make util/build_version.cc ; }" # use cached version if possible

View File

@ -71,7 +71,7 @@ BUILD_NIM := echo -e $(BUILD_MSG) "Nim compiler" && \
sed 's/koch tools/koch --stable tools/' build_all.sh > build_all_custom.sh; \
sh build_all_custom.sh $(HANDLE_OUTPUT); \
rm build_all_custom.sh; \
}
} && cd ../..
NIM_BINARY := $(NIM_DIR)/bin/nim$(EXE_SUFFIX)
# md5sum - macOS is a special case
ifeq ($(shell uname), Darwin)
@ -79,6 +79,8 @@ ifeq ($(shell uname), Darwin)
else
MD5SUM := md5sum
endif
# AppVeyor cache of $(NIM_DIR)/bin that doesn't get unpacked after all submodules have been checked out, like on Travis
CI_CACHE :=
# debugging tools + testing tools
TOOLS := premix persist debug dumper hunter regress tracerTestGen persistBlockTestGen
@ -188,14 +190,17 @@ build-nim: | deps
+ $(BUILD_NIM)
#- initialises and updates the Git submodules
#- manages the AppVeyor cache of Nim compiler binaries
#- deletes the ".nimble" dir to force the execution of the "deps" target
#- deletes and recreates "nimbus.nims" which on Windows is a copy instead of a proper symlink
#- allows parallel building with the '+' prefix
#- rebuilds the Nim compiler after the corresponding submodule is updated
#- rebuilds the Nim compiler after the corresponding submodule is updated (keep in mind that Git doesn't preserve file timestamps)
$(NIM_BINARY) update: | sanity-checks
git submodule update --init --recursive
[[ -n "$(CI_CACHE)" && -d "$(CI_CACHE)" ]] && cp -a "$(CI_CACHE)"/* $(NIM_DIR)/bin/ || true
rm -rf $(NIMBLE_DIR) nimbus.nims && $(MAKE) nimbus.nims
+ [[ -e $(NIM_BINARY) && $(NIM_BINARY) -nt $(NIM_DIR)/lib/system.nim ]] || { $(BUILD_NIM); }
+ [[ -e $(NIM_BINARY) && $$(stat -c%Z $(NIM_BINARY)) -gt $$(git log --pretty=format:%cd -n 1 --date=unix -- vendor/Nim) ]] || \
{ $(BUILD_NIM); [[ -n "$(CI_CACHE)" ]] && rm -rf "$(CI_CACHE)" && mkdir $(CI_CACHE) && cp -a $(NIM_DIR)/bin/* "$(CI_CACHE)"/ || true; }
# don't use this target, or you risk updating dependency repos that are not ready to be used in Nimbus
update-remote: