forked from Haydar011/cirrus-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_ccache
60 lines (45 loc) · 1.72 KB
/
upload_ccache
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
56
57
58
59
60
#!/bin/bash
cd /tmp
. /tmp/ci/function
# Abort if already executed
if [ ! -e /tmp/abort.txt ]; then
# compress in with pigz in a single zip.
com ccache 0
echo "• Uploading Cache On Gdrive •"
upload_ccache ccache.tar.gz
tg "$rom_name ccache was uploaded successfully!
Total Size: $(ls -sh ${PWD}/ccache.tar.gz | cut -d - -f 1 | cut -d / -f 1)
Time Took: $(($SECONDS / 60)) minute(s) and $(($SECONDS % 60)) second(s).
Status: $progress"
rom_zip=`ls /tmp/rom/out/target/product/*/*.zip`
# abort auto trigger if build was failed instead of being completed or killed by us.
if [ -e /tmp/abort_loop.txt ]; then
rm -rf /tmp/rom
rm -rf /tmp/cache
exit 1
fi
if [ -z $rom_zip ]; then
# update build type for next build
build_type="`cat /tmp/build_type.txt`"
# lets compile again as rom isn't ready yet
git clone -b $CIRRUS_BRANCH $github_repo $rom_name && cd $rom_name
if [ -e "/tmp/rom/build.log" ] && [ $(tail -n 50 /tmp/rom/build.log | grep -o -e ' 99% ' -e ' 98% ' -e ' 97% ' -e ' 96% ' -e ' 95% ' -e ' 94% ' -e ' 93% ' -e ' 92% ' -e ' 91% ' -e ' 90% ' | head -n 1) ]; then
git commit -sm "SH*T, HERE WE GO AGAIN | R" --allow-empty
else
git commit -sm "SH*T, HERE WE GO AGAIN | $build_type" --allow-empty
fi
git push -f
else
# drop empty commits
git clone -b $CIRRUS_BRANCH $github_repo $rom_name && cd $rom_name
git filter-branch --commit-filter 'git_commit_non_empty_tree "$@"' -f HEAD
git commit -sm "ci: $rom_name compiled successfully [skip ci]" -m "* now you can have successfull build on just one commit
* make sure to put R letter at the end of commit messages
* lik git commit -m your_msg R" --allow-empty
git push -f
fi
echo "dont upload cache again" > /tmp/abort.txt
fi
# clean storage except ci files
rm -rf /tmp/rom
rm -rf /tmp/cache