Skip to content

Commit

Permalink
Simplify guide for XTable
Browse files Browse the repository at this point in the history
  • Loading branch information
vinishjail97 committed Aug 1, 2024
1 parent 072a1f8 commit 793d7de
Show file tree
Hide file tree
Showing 10 changed files with 1,069 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@
<groupId>org.apache.xtable</groupId>
<artifactId>xtable</artifactId>
<name>xtable</name>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>31</version>
</parent>

<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
<module>xtable-api</module>
<module>xtable-core</module>
Expand Down
502 changes: 502 additions & 0 deletions release/release_guide.md

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions release/scripts/create_source_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
## Variables with defaults (if not overwritten by environment)
##
MVN=${MVN:-mvn}

# fail immediately
set -o errexit
set -o nounset
# print command before executing
set -o xtrace

CURR_DIR=`pwd`
if [[ `basename $CURR_DIR` != "release" ]] ; then
echo "You have to call the script from the release/ dir"
exit 1
fi

RELEASE_VERSION=`grep -A 5 "<artifactId>incubator-xtable</artifactId>" ../pom.xml | grep '<version>' | sed -e 's/<version>//' -e 's/<\/version>//' -e 's/ //g'`

if [ -z "${RELEASE_VERSION}" ]; then
echo "RELEASE_VERSION was not set."
exit 1
fi

echo "RELEASE_VERSION=${RELEASE_VERSION}"

###########################

cd ..

XTABLE_DIR=`pwd`
RELEASE_DIR=${XTABLE_DIR}/src_release
CLONE_DIR=${RELEASE_DIR}/incubator-xtable-tmp-clone

echo "Creating source package"

rm -rf ${RELEASE_DIR}
mkdir -p ${RELEASE_DIR}

# create a temporary git clone to ensure that we have a pristine source release
git clone ${XTABLE_DIR} ${CLONE_DIR}
cd ${CLONE_DIR}

rsync -a \
--exclude ".git" --exclude ".gitignore" --exclude ".gitattributes" --exclude ".travis.yml" \
--exclude ".github" --exclude "target" --exclude ".idea" --exclude "*.iml" --exclude ".DS_Store" \
--exclude "build-target" --exclude ".rubydeps" --exclude "rfc" --exclude "docker/images" \
--exclude "assets" --exclude "demo" --exclude "website" . incubator-xtable-$RELEASE_VERSION

tar czf ${RELEASE_DIR}/incubator-xtable-${RELEASE_VERSION}.src.tgz incubator-xtable-$RELEASE_VERSION
gpg --armor --local-user E391B3E8179C4FD9BB8BF72002AB8E945EFD1E91 --detach-sig ${RELEASE_DIR}/incubator-xtable-${RELEASE_VERSION}.src.tgz
cd ${RELEASE_DIR}
shasum -a 512 incubator-xtable-${RELEASE_VERSION}.src.tgz > incubator-xtable-${RELEASE_VERSION}.src.tgz.sha512

cd ${CURR_DIR}
rm -rf ${CLONE_DIR}
139 changes: 139 additions & 0 deletions release/scripts/cut_release_branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -e

function clean_up(){
echo "Do you want to clean local clone repo? [y|N]"
read confirmation
if [[ $confirmation = "y" ]]; then
cd ~
rm -rf ${LOCAL_CLONE_DIR}
echo "Clean up local repo."
fi
}

if [[ $# -eq 1 && $1 = "-h" ]]; then
echo "This script will update apache incubator-xtable main branch with next release version and cut release branch for current development version."
echo "There are 3 params required:"
echo "--release=\${CURRENT_RELEASE_VERSION}"
echo "--next_release=\${NEXT_RELEASE_VERSION}"
echo "--rc_num=\${RC_NUM}"
exit
else
for param in "$@"
do
if [[ $param =~ --release\=([0-9]\.[0-9]*\.[0-9]) ]]; then
RELEASE=${BASH_REMATCH[1]}
fi
if [[ $param =~ --next_release\=([0-9]\.[0-9]*\.[0-9]) ]]; then
NEXT_VERSION_IN_BASE_BRANCH=${BASH_REMATCH[1]}
fi
if [[ $param =~ --rc_num\=([0-9]*) ]]; then
RC_NUM=${BASH_REMATCH[1]}
fi
done
fi

if [[ -z "$RELEASE" || -z "$NEXT_VERSION_IN_BASE_BRANCH" || -z "$RC_NUM" ]]; then
echo "This script needs to be ran with params, please run with -h to get more instructions."
exit
fi


MAIN_BRANCH=main
NEXT_VERSION_BRANCH=MINOR-move-to-${NEXT_VERSION_IN_BASE_BRANCH}
RELEASE_BRANCH=release-${RELEASE}
[email protected]:apache/incubator-xtable.git
XTABLE_REPO_DIR=incubator-xtable
LOCAL_CLONE_DIR=incubator-xtable_release_${RELEASE}

echo "=====================Environment Variables====================="
echo "version: ${RELEASE}"
echo "next_release: ${NEXT_VERSION_IN_BASE_BRANCH}"
echo "working main branch: ${MAIN_BRANCH}"
echo "working next-version branch: ${NEXT_VERSION_BRANCH}"
echo "working release branch: ${RELEASE_BRANCH}"
echo "local repo dir: ~/${LOCAL_CLONE_DIR}/${XTABLE_REPO_DIR}"
echo "RC_NUM: $RC_NUM"
echo "==============================================================="

cd ~
if [[ -d ${LOCAL_CLONE_DIR} ]]; then
rm -rf ${LOCAL_CLONE_DIR}
fi

mkdir ${LOCAL_CLONE_DIR}
cd ${LOCAL_CLONE_DIR}
git clone ${GITHUB_REPO_URL}
cd ${XTABLE_REPO_DIR}

# Now, create local release branch
git branch ${RELEASE_BRANCH}

git checkout ${MAIN_BRANCH}
git checkout -b ${NEXT_VERSION_BRANCH}

echo "====================Current working branch====================="
echo ${NEXT_VERSION_BRANCH}
echo "==============================================================="

# Update main branch
mvn versions:set -DnewVersion=${NEXT_VERSION_IN_BASE_BRANCH}-SNAPSHOT

echo "===========Update next-version branch as following============="
git diff
echo "==============================================================="

echo "Please make sure all changes above are expected. Do you confirm to commit?: [y|N]"
read confirmation
if [[ $confirmation != "y" ]]; then
echo "Exit without committing any changes on main branch."
clean_up
exit
fi

git commit -am "[MINOR] Moving to ${NEXT_VERSION_IN_BASE_BRANCH}-SNAPSHOT on main branch."

echo "==============================================================="
echo "!!Please open a PR based on ${NEXT_VERSION_BRANCH} branch for approval!! [Press ENTER to continue]"
read confirmation

# Checkout and update release branch
git checkout ${RELEASE_BRANCH}
mvn versions:set -DnewVersion=${RELEASE}-rc${RC_NUM}

echo "==================Current working branch======================="
echo ${RELEASE_BRANCH}
echo "==============================================================="

echo "===============Update release branch as following=============="
git diff
echo "==============================================================="

echo "Please make sure all changes above are expected. Do you confirm to commit?: [y|N]"
read confirmation
if [[ $confirmation != "y" ]]; then
echo "Exit without committing any changes on release branch."
clean_up
exit
fi

git commit -am "Create release branch for version ${RELEASE}."
git push --set-upstream origin ${RELEASE_BRANCH}

clean_up
57 changes: 57 additions & 0 deletions release/scripts/deploy_staging_jars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
## Variables with defaults (if not overwritten by environment)
##
MVN=${MVN:-mvn}
# fail immediately
set -o errexit
set -o nounset

CURR_DIR=$(pwd)
if [ ! -d "$CURR_DIR/packaging" ] ; then
echo "You have to call the script from the repository root dir that contains 'packaging/'"
exit 1
fi

if [ "$#" -gt "1" ]; then
echo "Only accept 0 or 1 argument. Use -h to see examples."
exit 1
fi


if [ "${1:-}" == "-h" ]; then
echo "
Usage: $(basename "$0") [OPTIONS]
Options:
<version option> One of the version options below
${joined}
-h, --help
"
exit 0
fi


COMMON_OPTIONS="-DdeployArtifacts=true -DskipTests -DretryFailedDeploymentCount=10"
echo "Cleaning everything before any deployment"
$MVN clean $COMMON_OPTIONS
echo "Building with options
$MVN install $COMMON_OPTIONS
echo "Deploying to repository.apache.org with version options"
$MVN deploy $COMMON_OPTIONS
34 changes: 34 additions & 0 deletions release/scripts/validate_source_binary_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

# fail immediately
set -o errexit
set -o nounset

echo "Checking for binary files in the source files"
numBinaryFiles=`find . -iname '*' | xargs -I {} file -I {} | grep -va directory | grep -v "release/" | grep -v "/src/test/" | grep -va 'application/json' | grep -va 'text/' | grep -va 'application/xml' | grep -va 'application/json' | wc -l | sed -e s'/ //g'`

if [ "$numBinaryFiles" -gt "0" ]; then
echo -e "There were non-text files in source release. [ERROR]\n Please check below\n"
find . -iname '*' | xargs -I {} file -I {} | grep -va directory | grep -v "release/release_guide" | grep -v "/src/test/" | grep -va 'application/json' | grep -va 'text/' | grep -va 'application/xml'
exit 1
fi
echo -e "\t\tNo Binary Files in the source files? - [OK]\n"
55 changes: 55 additions & 0 deletions release/scripts/validate_source_copyright.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

### Checking for DISCLAIMER-WIP
echo "Checking for DISCLAIMER-WIP"
disclaimerFile="./DISCLAIMER-WIP"
if [ -f "$disclaimerFile" ]; then
echo "DISCLAIMER-WIP file should not be present [ERROR]"
exit 1
fi
echo -e "\t\tDISCLAIMER-WIP file exists ? [OK]\n"

### Checking for LICENSE and NOTICE
echo "Checking for LICENSE and NOTICE"
licenseFile="./LICENSE"
noticeFile="./NOTICE"
if [ ! -f "$licenseFile" ]; then
echo "License file missing [ERROR]"
exit 1
fi
echo -e "\t\tLicense file exists ? [OK]"

if [ ! -f "$noticeFile" ]; then
echo "Notice file missing [ERROR]"
exit 1
fi
echo -e "\t\tNotice file exists ? [OK]\n"

### Licensing Check
echo "Performing custom Licensing Check "
numfilesWithNoLicense=`find . -iname '*' -type f | grep -v NOTICE | grep -v LICENSE | grep -v '.jpg' | grep -v '.json' | grep -v '.hfile' | grep -v '.data' | grep -v '.commit' | grep -v emptyFile | grep -v DISCLAIMER | grep -v KEYS | grep -v '.mailmap' | grep -v '.sqltemplate' | grep -v 'banner.txt' | grep -v "fixtures" | xargs grep -L "Licensed to the Apache Software Foundation (ASF)" | wc -l`
if [ "$numfilesWithNoLicense" -gt "0" ]; then
echo "There were some source files that did not have Apache License [ERROR]"
find . -iname '*' -type f | grep -v NOTICE | grep -v LICENSE | grep -v '.jpg' | grep -v '.json' | grep -v '.hfile' | grep -v '.data' | grep -v '.commit' | grep -v emptyFile | grep -v DISCLAIMER | grep -v '.sqltemplate' | grep -v KEYS | grep -v '.mailmap' | grep -v 'banner.txt' | grep -v "fixtures" | xargs grep -L "Licensed to the Apache Software Foundation (ASF)"
exit 1
fi
echo -e "\t\tLicensing Check Passed [OK]\n"
Loading

0 comments on commit 793d7de

Please sign in to comment.