-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·55 lines (45 loc) · 1.5 KB
/
build.sh
File metadata and controls
executable file
·55 lines (45 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# Discern whether this is a release build.
releasing=
if [ -f release.properties ]; then
releasing=1
fi
# Run the SciJava CI build script.
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-build.sh &&
sh ci-build.sh || { echo "Maven build failed. Skipping melting pot tests."; exit 1; }
# Skip melting pot if cutting a release.
if [ "$releasing" ]; then
exit 0
fi
# Helper method to get the last cache modified date as seconds since epoch
last_cache_modified() {
find "$HOME/.cache/scijava/melting-pot" -type f | while read f
do
stat -c '%Y' "$f"
done | sort -nr 2>/dev/null | head -n1
}
# Record the last time of cache modification before running melting-pot
cache_modified_pre=0
cache_modified_post=0
if [ -d "$HOME/.cache/scijava/melting-pot" ]; then
cache_modified_pre=$(last_cache_modified)
fi
# run melting-pot
tests/run.sh
meltResult=$?
# Record the last time of cache modification after running melting-pot
if [ -d "$HOME/.cache/scijava/melting-pot" ]; then
cache_modified_post=$(last_cache_modified)
fi
# Determine if cache needs to be re-generated
echo "cache_modified_pre=$cache_modified_pre"
echo "cache_modified_post=$cache_modified_post"
if [ "$cache_modified_post" -gt "$cache_modified_pre" ]; then
echo "cacheChanged=true"
echo "cacheChanged=true" >> $GITHUB_ENV
else
echo "cacheChanged=false"
echo "cacheChanged=false" >> $GITHUB_ENV
fi
# NB: This script exits 0, but saves the exit code for a later build step.
echo $meltResult > exit-code