-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1608 from CARV-ICS-FORTH/ci-updates
Update build workflow
- Loading branch information
Showing
6 changed files
with
234 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/bash | ||
|
||
# There is no need to wait for this to finish, at least the rm part can be done | ||
# while the process moves forward (for apt we'll need to wait for it to finish | ||
# before we install dependencies later on, but it'll only give us a 1-3GBs so | ||
# we can skip it. | ||
WAIT=0 | ||
RMONLY=1 | ||
|
||
PACKAGES=( | ||
"firefox" | ||
"google-chrome-stable" | ||
"microsoft-edge-stable" | ||
"php-pear" | ||
"ruby-full" | ||
"^aspnetcore-.*" | ||
"^dotnet-.*" | ||
"powershell*" | ||
) | ||
|
||
PATHS=( | ||
"/opt/hostedtoolcache" | ||
"/usr/local/.ghcup/" | ||
"/usr/share/swift" | ||
"/usr/local/lib/android" | ||
"/usr/local/share/edge_driver" | ||
"/usr/local/share/gecko_driver" | ||
"/usr/local/share/chromedriver-linux64" | ||
"/usr/local/share/chromium" | ||
"/home/linuxbrew" | ||
"/usr/local/share/vcpkg" | ||
"/usr/share/kotlinc" | ||
"/usr/local/bin/minikube" | ||
) | ||
|
||
|
||
function cleanup_packages() | ||
{ | ||
if [[ ${RMONLY} == 0 ]]; then | ||
apt-get purge -y "${PACKAGES[@]}" | ||
apt-get autoremove --purge -y | ||
apt-get clean | ||
fi | ||
} | ||
|
||
function cleanup_paths() | ||
{ | ||
for i in "${PATHS[@]}"; do | ||
rm -rf "${i}" & | ||
done | ||
if [[ ${WAIT} == 1 ]]; then | ||
wait | ||
fi | ||
} | ||
|
||
if [[ ${WAIT} == 1 ]]; then | ||
echo "---=== Before ===---" | ||
df -hT | ||
cleanup_packages | ||
cleanup_paths | ||
echo "---=== After ===---" | ||
df -hT | ||
else | ||
cleanup_packages | ||
cleanup_paths | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
function deduplicate_files() { | ||
local DUPLICATES=() | ||
local DIR=${1} | ||
local IFS=$'\n' | ||
local LINK_CHECK="" | ||
|
||
readarray -t DUPLICATES < <(for i in `find ${DIR} -type f ! -empty`; do sha1sum ${i}; done | sort | uniq -w 40 --all-repeated=separate) | ||
|
||
for ((i=1; i < ${#DUPLICATES[@]}; i++ )); do | ||
if [[ ${DUPLICATES[$i]} == "" ]]; then | ||
continue | ||
elif [[ ${DUPLICATES[$i-1]} = "" ]]; then | ||
continue | ||
else | ||
LINK_CHECK=$(ls -li "${DUPLICATES[$i]:42}" "${DUPLICATES[$i-1]:42}" |awk '{print $1}' | uniq | wc -l) | ||
if [[ ${LINK_CHECK} != "1" ]]; then | ||
ln -f "${DUPLICATES[$i-1]:42}" "${DUPLICATES[$i]:42}" | ||
fi | ||
fi | ||
done | ||
|
||
return 0 | ||
} | ||
|
||
deduplicate_files ${1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.