2025-08-07 15:35:07 +01:00
#!/bin/bash
2025-08-19 20:13:24 +01:00
# run slicer
2025-08-22 23:39:09 +01:00
IGNORE_REPOS = ( "source-map-support" "jsdom" "eslint-utils" "polished" "webpack-bundle-analyzer" "jscodeshift" "chromium-bidi" "react-popper" "react-dropzone" "babel-plugin-styled-components" "unicode-trie" "relay-runtime" "react-element-to-jsx-string" "inline-style-prefixer" "karma" "cfb" "serve-handler" "rxjs" "d3-array" "lie" "@cspotcode/source-map-support" "d3-shape" "pac-resolver" "ts-loader" "pgpass" "less" "d3-geo" "rollup-plugin-terser" "seek-bzip" "brotli" "d3-contour" "nearley" "zig" "liftoff" "tslint" "react-syntax-highlighter" "xml-js" "web3-utils" "react-focus-lock" "clipboard" "css-vendor" "fontkit" "append-buffer" "react-color" "aws-cdk-lib" "jest-serializer-html" "fontkit" "@aws-cdk/core" "svg2ttf" "ttf2woff" "eslint-plugin-sort-keys-fix" "react-places-autocomplete" "moddle" "docsify" "moddle-xml" "openapi-to-postmanv2" "bpmn-moddle" ) # Add the list of repositories to ignore
2025-08-07 15:35:07 +01:00
# set -e
2025-08-14 21:28:51 +01:00
function fail {
printf '%s\n' " $1 " >& 2 ## Send message to stderr.
exit " ${ 2 -1 } " ## Return a code specified by $2, or 1 by default.
}
# rm -rf candidates
2025-08-07 15:35:07 +01:00
mkdir -p candidates
2025-08-14 21:28:51 +01:00
rm -iv processed.log current.log success.txt
2025-08-07 15:35:07 +01:00
# Read the minableRepositories2.csv file (rows of repo,test script). Read the repo and copy it from the `cache` folder`
while IFS = , read -r repo test_script; do
# Check if the repo is not empty
if [ [ -n " $repo " ] ] ; then
# If the repo belongs to a given list, ignore it
2025-08-19 20:13:24 +01:00
if [ [ " ${ IGNORE_REPOS [@] } " = ~ " ${ repo } " ] ] ; then
2025-08-07 15:35:07 +01:00
echo " Ignoring repository: $repo "
continue
2025-08-19 20:13:24 +01:00
else
echo " Processing repository: $repo "
2025-08-07 15:35:07 +01:00
fi
# Extract the repo name from the URL
repo_name = $( basename " $repo " .git)
# Check if the repo directory exists in the cache folder
if [ [ -d " ../cache-repos/repos/ $repo_name " ] ] ; then
echo " Processing repository: $repo_name "
2025-08-14 21:28:51 +01:00
echo " Processing repository: $repo_name " >> current.log
2025-08-07 15:35:07 +01:00
# Change to the repository directory
2025-08-14 21:28:51 +01:00
if [ [ -d " candidates/ $repo_name " ] ] ; then
echo " Repository $repo_name already exists in candidates, skipping... "
if [ [ -f " candidates/ $repo_name /.done " ] ] ; then
echo " Skipping $repo_name as it has already been processed. "
continue
else
echo " Processing $repo_name again as .done file is missing. Run it again. "
rm -rf " candidates/ $repo_name "
fi
# Uncomment the next line if you want to remove the existing directory
# rm -rf "candidates/$repo_name"
else
cp -r " ../cache-repos/repos/ $repo_name " " candidates/ $repo_name " || exit
pushd " candidates/ $repo_name " > /dev/null || fail "Failed to pushd"
2025-08-19 20:13:24 +01:00
npm install --silent
NPMI_RESULT = $?
2025-08-14 21:28:51 +01:00
popd > /dev/null || fail "Failed to popd"
2025-08-19 20:13:24 +01:00
if [ [ $NPMI_RESULT -ne 0 ] ] ; then
echo " npm install failed for $repo_name , skipping... "
2025-08-22 23:39:09 +01:00
touch " candidates/ $repo_name /.done "
2025-08-19 20:13:24 +01:00
echo " $repo_name " >> "failed-install.txt"
continue
fi
2025-08-07 15:35:07 +01:00
2025-08-14 21:28:51 +01:00
node src/index.mjs " candidates/ $repo_name " >> processed.log 2>& 1
RESULT = $?
echo " --Separator-- $repo_name " >> processed.log
touch " candidates/ $repo_name /.done "
if [ [ $RESULT -ne 0 ] ] ; then
echo " Error processing repository: $repo_name "
# exit $RESULT
else
echo " $repo_name " >> "success.txt"
fi
2025-08-07 15:35:07 +01:00
fi
# Change back to the original directory
else
echo " Repository $repo_name not found in cache " || exit 1
fi
2025-08-14 21:28:51 +01:00
else
echo " Skipping empty repository entry $repo " ;
2025-08-07 15:35:07 +01:00
fi
done < minableRepositories2.csv