forked from homalg-project/PackageJanitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to create PRs for packages with precompiled code
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 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,72 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -u | ||
|
||
SCRIPT=$(realpath $0) | ||
SCRIPTPATH=$(dirname $SCRIPT) | ||
|
||
PACKAGE="$1" | ||
|
||
TOKEN=$(git config --get github.token || echo) | ||
if [ "x$TOKEN" = x ] && [ -r ~/.github_shell_token ] ; then | ||
TOKEN=$(cat ~/.github_shell_token) | ||
fi | ||
if [ "x$TOKEN" = x ] ; then | ||
error "could not determine GitHub access token" | ||
fi | ||
|
||
API_URL=https://api.github.com/repos/homalg-project/$PACKAGE/pulls | ||
|
||
DATE=$(date +%s) | ||
|
||
VERSION=`gap --banner --quiet -A <( echo 'LoadPackage( "CompilerForCAP" ); Print( Last( GAPInfo.PackagesInfo.compilerforcap ).Version, "\n" ); QUIT_GAP();') | tr -d '\r'` | ||
|
||
mkdir -p "/tmp/$DATE/pkg" | ||
|
||
echo '(function() | ||
local name, package_info, pos; | ||
for name in RecNames( GAPInfo.PackagesInfo ) do | ||
if name = "io" then | ||
continue; | ||
fi; | ||
package_info := GAPInfo.PackagesInfo.(name); | ||
pos := PositionProperty( package_info, info -> StartsWith( info.InstallationPath, "../../" ) ); | ||
if pos <> fail then | ||
SetPackagePath( name, package_info[pos].InstallationPath ); | ||
fi; | ||
od; | ||
end)();' > "/tmp/$DATE/gaprc" | ||
|
||
cd "/tmp/$DATE/pkg" | ||
git clone git@github.com:homalg-project/$PACKAGE.git | ||
cd $PACKAGE | ||
|
||
make doc | ||
/usr/bin/gap -l "../../;~/.gap/;" -r tst/testall.g || echo "Changes found" | ||
|
||
read -p "Please review all changes in \"file:///tmp/$DATE/pkg/$PACKAGE/\" and enter y to proceed. " -n 1 | ||
if [[ ! $REPLY =~ ^[Yy]$ ]] | ||
then | ||
exit 1 | ||
fi | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "Create PR" | ||
git add -A | ||
git commit -m "Adjust to CompilerForCAP $VERSION" | ||
git push origin master:"CompilerForCAP-$VERSION" | ||
|
||
DATA=$(cat <<EOF | ||
{ | ||
"title": "Adjust to CompilerForCAP $VERSION", | ||
"head": "CompilerForCAP-$VERSION", | ||
"base": "master", | ||
"body": "" | ||
} | ||
EOF | ||
) | ||
response=$(curl -s -S -H "Content-Type: application/json" -X POST --data "$DATA" "$API_URL" -H "Authorization: token $TOKEN") | ||
else | ||
echo "No changes" | ||
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,4 @@ | ||
Algebroids | ||
Locales | ||
SubcategoriesForCAP | ||
WrapperCategories |