This is an automated email from the ASF dual-hosted git repository.

syfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new bc8742b4c9 [Misc] Add script for testing release package (#16956)
bc8742b4c9 is described below

commit bc8742b4c9eb2af29416b852083e30ef732db8a9
Author: ysh329 <[email protected]>
AuthorDate: Tue Apr 30 13:37:02 2024 +0800

    [Misc] Add script for testing release package (#16956)
    
    * [COMMUNITY] Add new key for release signing
    
    * Create test_release_package.sh
    
    * Update test_release_package.sh
    
    * Update README.md
    
    * Update README.md
---
 tests/scripts/release/README.md               |  12 ++-
 tests/scripts/release/test_release_package.sh | 101 ++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 1 deletion(-)

diff --git a/tests/scripts/release/README.md b/tests/scripts/release/README.md
index ad823c70b3..de00d937c8 100644
--- a/tests/scripts/release/README.md
+++ b/tests/scripts/release/README.md
@@ -15,7 +15,9 @@
 <!--- specific language governing permissions and limitations -->
 <!--- under the License. -->
 
-These scripts can be helpful when creating release notes.
+These scripts can be helpful when creating release notes and testing release 
packages.
+
+# Create release notes
 
 ```bash
 # example: create a csv file of all PRs since the v0.8 and v0.9.0 releases
@@ -52,3 +54,11 @@ python list_rfcs.py --since-commit <hash> --rfcs-repo 
./tvm-rfcs > rfc.md
 ```
 
 Finally, combine `rfc.md` and `out.md` along with some prose to create the 
final release notes.
+
+# Test release packages
+
+After uploading release (candidate) packages to apache.org or github release 
page, you can validate packages step-by-step from downloading, verification and 
compiling use script below, but don't forget edit the `version` and `rc` number 
in script.
+
+```bash
+test_release_package.sh
+```
diff --git a/tests/scripts/release/test_release_package.sh 
b/tests/scripts/release/test_release_package.sh
new file mode 100644
index 0000000000..186ed9dda3
--- /dev/null
+++ b/tests/scripts/release/test_release_package.sh
@@ -0,0 +1,101 @@
+#!/usr/bin/env 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 -exu
+
+######################################################
+# Write current test version and rc number here
+######################################################
+# NOTE about "rc":
+# 1. Required for test candidate, such as "rc0"
+# 2. Not required for release, leave blank ""
+######################################################
+version="v0.16.0"
+rc="rc0"
+
+######################################################
+# This script is used test release (cancdidate)
+# packages uploading to apache.org, github.com
+# before release vote starts or release.
+#
+# The release (candidate) package contains files
+# below:
+#    1. apache-tvm-src-${version_rc}.tar.gz.asc
+#    2. apache-tvm-src-${version_rc}.tar.gz.sha512
+#    3. apache-tvm-src-${version_rc}.tar.gz
+######################################################
+version_rc="${version}"
+apache_prefix="${version}"
+if [ "$rc" != "" ]; then
+    apache_prefix="${version_rc}-${rc}"
+    version_rc="${version_rc}.${rc}"
+fi
+mkdir test_tvm_${version_rc}
+cd test_tvm_${version_rc}
+
+echo "[1/9] Downloading from apache.org ..."
+mkdir apache
+cd apache
+wget -c 
https://dist.apache.org/repos/dist/dev/tvm/tvm-${apache_prefix}/apache-tvm-src-${version_rc}.tar.gz.sha512
+wget -c 
https://dist.apache.org/repos/dist/dev/tvm/tvm-${apache_prefix}/apache-tvm-src-${version_rc}.tar.gz.asc
+wget -c 
https://dist.apache.org/repos/dist/dev/tvm/tvm-${apache_prefix}/apache-tvm-src-${version_rc}.tar.gz
+md5sum ./* > ./md5sum.txt
+cd -
+
+echo "[2/9] Downloading from github.com ..."
+mkdir github
+cd github
+wget -c 
https://github.com/apache/tvm/releases/download/${version_rc}/apache-tvm-src-${version_rc}.tar.gz.sha512
+wget -c 
https://github.com/apache/tvm/releases/download/${version_rc}/apache-tvm-src-${version_rc}.tar.gz.asc
+wget -c 
https://github.com/apache/tvm/releases/download/${version_rc}/apache-tvm-src-${version_rc}.tar.gz
+md5sum ./* > ./md5sum.txt
+cd -
+
+echo "[3/9] Check difference between github.com and apache.org ..."
+diff github/md5sum.txt ./apache/md5sum.txt
+
+echo "[4/9] Checking asc ..."
+cd github
+gpg --verify ./apache-tvm-src-${version_rc}.tar.gz.asc 
./apache-tvm-src-${version_rc}.tar.gz
+
+echo "[5/9] Checking sha512 ..."
+sha512sum -c ./apache-tvm-src-${version_rc}.tar.gz.sha512
+
+echo "[6/9] Unzip ..."
+tar -zxf apache-tvm-src-${version_rc}.tar.gz
+
+echo "[7/9] Checking whether binary in source code ..."
+output=`find apache-tvm-src-${version_rc} -type f -exec file {} + | grep -w 
"ELF\|shared object"`
+if [[ -n "$output" ]]; then
+    echo "Error: ELF or shared object files found:"
+    echo "$output"
+    exit 1
+fi
+
+echo "[8/9] Compile and Python Import on Linux ..."
+cd apache-tvm-src-${version_rc}
+mkdir build
+cd build
+cp ../cmake/config.cmake .
+cmake ..
+make -j4
+cd ..
+
+echo "[9/9] Import TVM and print path ..."
+export TVM_HOME=$(pwd)
+export PYTHONPATH=$TVM_HOME/python:${PYTHONPATH}
+python3 -c "import tvm; print(tvm.__path__)"

Reply via email to