Skip to content

Commit 0c5736b

Browse files
committed
Build script templates for go, python, ruby
1 parent 32edcec commit 0c5736b

File tree

3 files changed

+207
-0
lines changed

3 files changed

+207
-0
lines changed

templates/build_script_go.sh

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# -----------------------------------------------------------------------------
2+
#
3+
# Package : {package_name}
4+
# Version : {package_version}
5+
# Source repo : {package_url}
6+
# Tested on : {distro_name} {distro_version}
7+
# Script License: Apache License, Version 2 or later
8+
# Maintainer : BulkPackageSearch Automation {maintainer}
9+
#
10+
# Disclaimer: This script has been tested in root mode on given
11+
# ========== platform using the mentioned version of the package.
12+
# It may not work as expected with newer versions of the
13+
# package and/or distribution. In such case, please
14+
# contact "Maintainer" of this script.
15+
#
16+
# ----------------------------------------------------------------------------
17+
18+
PACKAGE_NAME={package_name}
19+
PACKAGE_VERSION={package_version}
20+
PACKAGE_URL={package_url}
21+
22+
yum -y update && yum install -y nodejs nodejs-devel nodejs-packaging npm python38 python38-devel ncurses git jq wget gcc-c++
23+
24+
wget https://golang.org/dl/go1.16.1.linux-ppc64le.tar.gz && tar -C /bin -xf go1.16.1.linux-ppc64le.tar.gz && mkdir -p /home/tester/go/src /home/tester/go/bin /home/tester/go/pkg
25+
26+
export PATH=$PATH:/bin/go/bin
27+
export GOPATH=/home/tester/go
28+
29+
OS_NAME=`python3 -c "os_file_data=open('/etc/os-release').readlines();os_info = [i.replace('PRETTY_NAME=','').strip() for i in os_file_data if i.startswith('PRETTY_NAME')];print(os_info[0])"`
30+
31+
mkdir -p /home/tester/$PACKAGE_NAME
32+
33+
cd /home/tester/$PACKAGE_NAME
34+
export PATH=$GOPATH/bin:$PATH
35+
export GO111MODULE=on
36+
37+
function test_with_master(){
38+
echo "Building $PACKAGE_PATH with master branch"
39+
export GO111MODULE=auto
40+
if ! go get -d -u -t $PACKAGE_NAME; then
41+
echo "------------------$PACKAGE_NAME:install_fails-------------------------------------"
42+
echo "$PACKAGE_VERSION $PACKAGE_NAME"
43+
echo "$PACKAGE_NAME | $PACKAGE_VERSION | master | $OS_NAME | GitHub | Fail | Install_Fails"
44+
exit 0
45+
else
46+
cd $GOPATH/src/$PACKAGE_NAME
47+
echo "Testing $PACKAGE_PATH with master branch"
48+
if ! go test; then
49+
echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------"
50+
echo "$PACKAGE_VERSION $PACKAGE_NAME"
51+
echo "$PACKAGE_NAME | $PACKAGE_VERSION | master | $OS_NAME | GitHub | Fail | Install_success_but_test_Fails"
52+
exit 0
53+
else
54+
echo "------------------$PACKAGE_NAME:install_&_test_both_success-------------------------"
55+
echo "$PACKAGE_VERSION $PACKAGE_NAME"
56+
echo "$PACKAGE_NAME | $PACKAGE_VERSION | master | $OS_NAME | GitHub | Pass | Both_Install_and_Test_Success"
57+
exit 0
58+
fi
59+
fi
60+
61+
62+
}
63+
64+
echo "Building $PACKAGE_PATH with $PACKAGE_VERSION"
65+
if ! go get -d -u -t $PACKAGE_NAME@$PACKAGE_VERSION; then
66+
test_with_master
67+
exit 0
68+
fi
69+
70+
cd $GOPATH/pkg/mod/$PACKAGE_NAME@$PACKAGE_VERSION
71+
echo "Testing $PACKAGE_PATH with $PACKAGE_VERSION"
72+
if ! go test; then
73+
test_with_master
74+
exit 0
75+
else
76+
echo "------------------$PACKAGE_NAME:install_&_test_both_success-------------------------"
77+
echo "$PACKAGE_VERSION $PACKAGE_NAME"
78+
echo "$PACKAGE_NAME | $PACKAGE_VERSION | $PACKAGE_VERSION | $OS_NAME | GitHub | Pass | Both_Install_and_Test_Success"
79+
exit 0
80+
fi

templates/build_script_php.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# -----------------------------------------------------------------------------
2+
#
3+
# Package : {package_name}
4+
# Version : {package_version}
5+
# Source repo : {package_url}
6+
# Tested on : {distro_name} {distro_version}
7+
# Script License: Apache License, Version 2 or later
8+
# Maintainer : BulkPackageSearch Automation {maintainer}
9+
#
10+
# Disclaimer: This script has been tested in root mode on given
11+
# ========== platform using the mentioned version of the package.
12+
# It may not work as expected with newer versions of the
13+
# package and/or distribution. In such case, please
14+
# contact "Maintainer" of this script.
15+
#
16+
# ----------------------------------------------------------------------------
17+
18+
PACKAGE_NAME={package_name}
19+
PACKAGE_VERSION={package_version}
20+
PACKAGE_URL={package_url}
21+
22+
yum -y update && yum install -y nodejs nodejs-devel nodejs-packaging npm python38 python38-devel ncurses git jq curl php php-curl php-dom php-mbstring php-json nodejs make gcc-c++ patch diffutils php-gd php-pecl-zip
23+
24+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php composer-setup.php --install-dir=/bin --filename=composer
25+
composer require --dev phpunit/phpunit --with-all-dependencies ^7
26+
mkdir output
27+
28+
OS_NAME=`python3 -c "os_file_data=open('/etc/os-release').readlines();os_info = [i.replace('PRETTY_NAME=','').strip() for i in os_file_data if i.startswith('PRETTY_NAME')];print(os_info[0])"`
29+
HOME_DIR=`pwd`
30+
if ! git clone $PACKAGE_URL $PACKAGE_NAME; then
31+
echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------"
32+
echo "$PACKAGE_URL $PACKAGE_NAME"
33+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Clone_Fails"
34+
exit 0
35+
fi
36+
37+
cd $HOME_DIR/$PACKAGE_NAME
38+
git checkout $PACKAGE_VERSION
39+
if ! composer install; then
40+
echo "------------------$PACKAGE_NAME:install_fails-------------------------------------"
41+
echo "$PACKAGE_URL $PACKAGE_NAME"
42+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_Fails"
43+
exit 0
44+
fi
45+
46+
cd $HOME_DIR/$PACKAGE_NAME
47+
if ! /home/tester/vendor/bin/phpunit; then
48+
echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------"
49+
echo "$PACKAGE_URL $PACKAGE_NAME"
50+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_success_but_test_Fails"
51+
exit 0
52+
else
53+
echo "------------------$PACKAGE_NAME:install_&_test_both_success-------------------------"
54+
echo "$PACKAGE_URL $PACKAGE_NAME"
55+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Pass | Both_Install_and_Test_Success"
56+
exit 0
57+
fi

templates/build_script_ruby.sh

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# -----------------------------------------------------------------------------
2+
#
3+
# Package : {package_name}
4+
# Version : {package_version}
5+
# Source repo : {package_url}
6+
# Tested on : {distro_name} {distro_version}
7+
# Script License: Apache License, Version 2 or later
8+
# Maintainer : BulkPackageSearch Automation {maintainer}
9+
#
10+
# Disclaimer: This script has been tested in root mode on given
11+
# ========== platform using the mentioned version of the package.
12+
# It may not work as expected with newer versions of the
13+
# package and/or distribution. In such case, please
14+
# contact "Maintainer" of this script.
15+
#
16+
# ----------------------------------------------------------------------------
17+
18+
PACKAGE_NAME={package_name}
19+
PACKAGE_VERSION={package_version}
20+
PACKAGE_URL={package_url}
21+
22+
yum -y update && yum install -y nodejs nodejs-devel nodejs-packaging npm python38 python38-devel ncurses git jq curl make gcc-c++ procps gnupg2
23+
yum install ruby -y && yum install -y libcurl-devel libffi-devel ruby-devel ruby-devel.ppc64le redhat-rpm-config sqlite sqlite-devel java-1.8.0-openjdk-devel
24+
gem install bundle && gem install bundler:1.17.3 && gem install rake
25+
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
26+
curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
27+
curl -L https://get.rvm.io | bash -s stable
28+
source /etc/profile.d/rvm.sh
29+
rvm install jruby
30+
export PATH=$PATH:/usr/local/rvm/rubies/jruby-9.2.9.0/bin/
31+
32+
source /etc/profile.d/rvm.sh;
33+
OS_NAME=`python3 -c "os_file_data=open('/etc/os-release').readlines();os_info = [i.replace('PRETTY_NAME=','').strip() for i in os_file_data if i.startswith('PRETTY_NAME')];print(os_info[0])"`
34+
35+
#install previous version of bundler
36+
gem install bundler:1.17.3
37+
HOME_DIR=`pwd`
38+
if ! git clone $PACKAGE_URL $PACKAGE_NAME; then
39+
echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------"
40+
echo "$PACKAGE_URL $PACKAGE_NAME"
41+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Clone_Fails"
42+
exit 0
43+
fi
44+
45+
cd $HOME_DIR/$PACKAGE_NAME
46+
git checkout $PACKAGE_VERSION
47+
48+
if ! bundle _1.17.3_ install; then
49+
if ! bundle install; then
50+
echo "------------------$PACKAGE_NAME:install_fails-------------------------------------"
51+
echo "$PACKAGE_URL $PACKAGE_NAME"
52+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_Fails"
53+
exit 0
54+
fi
55+
fi
56+
57+
cd $HOME_DIR/$PACKAGE_NAME
58+
if ! bundle _1.17.3_ exec rake; then
59+
if ! bundle exec rake; then
60+
echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------"
61+
echo "$PACKAGE_URL $PACKAGE_NAME"
62+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_success_but_test_Fails"
63+
exit 0
64+
fi
65+
else
66+
echo "------------------$PACKAGE_NAME:install_&_test_both_success-------------------------"
67+
echo "$PACKAGE_URL $PACKAGE_NAME"
68+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Pass | Both_Install_and_Test_Success"
69+
exit 0
70+
fi

0 commit comments

Comments
 (0)