Skip to content

Commit

Permalink
Enable appveyor cache, add more paranoia
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanhs committed Apr 4, 2017
1 parent 2564711 commit b970bc2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 5 additions & 2 deletions appveyor.yml
Expand Up @@ -141,15 +141,18 @@ install:
- set SCCACHE_ERROR_LOG=%CD%/sccache.log

test_script:
- appveyor-retry sh -c 'git submodule deinit -f . && git submodule update --init'
- if not exist C:\cache\rustsrc\NUL mkdir C:\cache\rustsrc
- sh src/ci/init_repo.sh . /c/cache/rustsrc
- set SRC=.
- set NO_CCACHE=1
- sh src/ci/run.sh

on_failure:
- cat %CD%/sccache.log
- cat %CD%\sccache.log
- cat C:\Users\appveyor\AppData\Local\Temp\1\build-cache-logs\*.log

cache:
- C:\cache\rustsrc
- "build/i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
- "build/x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
- "i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
Expand Down
15 changes: 13 additions & 2 deletions src/ci/init_repo.sh
Expand Up @@ -38,9 +38,20 @@ fi

# Wipe the cache if it's not valid, or mark it as invalid while we update it
if [ ! -f "$cache_valid_file" ]; then
rm -rf "$CACHE_DIR" && mkdir "$CACHE_DIR"
rm -rf "$CACHE_DIR"
mkdir "$CACHE_DIR"
else
rm "$cache_valid_file"
stat_lines=$(cd "$cache_src_dir" && git status --porcelain | wc -l)
stat_ec=$(cd "$cache_src_dir" && git status >/dev/null 2>&1 && echo $?)
if [ ! -d "$cache_src_dir/.git" -o $stat_lines != 0 -o $stat_ec != 0 ]; then
# Something is badly wrong - the cache valid file is here, but something
# about the git repo is fishy. Nuke it all, just in case
echo "WARNING: $cache_valid_file exists but bad repo: l:$stat_lines, ec:$stat_ec"
rm -rf "$CACHE_DIR"
mkdir "$CACHE_DIR"
else
rm "$cache_valid_file"
fi
fi

# Update the cache (a pristine copy of the rust source master)
Expand Down

0 comments on commit b970bc2

Please sign in to comment.