Skip to content

Commit b970bc2

Browse files
committed
Enable appveyor cache, add more paranoia
1 parent 2564711 commit b970bc2

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

appveyor.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,18 @@ install:
141141
- set SCCACHE_ERROR_LOG=%CD%/sccache.log
142142

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

149150
on_failure:
150-
- cat %CD%/sccache.log
151+
- cat %CD%\sccache.log
152+
- cat C:\Users\appveyor\AppData\Local\Temp\1\build-cache-logs\*.log
151153

152154
cache:
155+
- C:\cache\rustsrc
153156
- "build/i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
154157
- "build/x86_64-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"
155158
- "i686-pc-windows-msvc/llvm -> src/rustllvm/llvm-rebuild-trigger"

src/ci/init_repo.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,20 @@ fi
3838

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

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

0 commit comments

Comments
 (0)