|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The ASF licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, |
| 14 | +# software distributed under the License is distributed on an |
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | +# KIND, either express or implied. See the License for the |
| 17 | +# specific language governing permissions and limitations |
| 18 | +# under the License. |
| 19 | +# |
| 20 | + |
| 21 | +# Requirements |
| 22 | +# - nodejs >= 6.0.0 (best way is to use nvm) |
| 23 | + |
| 24 | +case $# in |
| 25 | + 2) VERSION="$1" |
| 26 | + RC_NUMBER="$2" |
| 27 | + ;; |
| 28 | + |
| 29 | + *) echo "Usage: $0 X.Y.Z RC_NUMBER" |
| 30 | + exit 1 |
| 31 | + ;; |
| 32 | +esac |
| 33 | + |
| 34 | +set -ex |
| 35 | + |
| 36 | +HERE=$(cd `dirname "${BASH_SOURCE[0]:-$0}"` && pwd) |
| 37 | + |
| 38 | +ARROW_DIST_URL='https://dist.apache.org/repos/dist/dev/arrow' |
| 39 | + |
| 40 | +download_dist_file() { |
| 41 | + curl -f -O $ARROW_DIST_URL/$1 |
| 42 | +} |
| 43 | + |
| 44 | +download_rc_file() { |
| 45 | + download_dist_file apache-arrow-js-${VERSION}-rc${RC_NUMBER}/$1 |
| 46 | +} |
| 47 | + |
| 48 | +import_gpg_keys() { |
| 49 | + download_dist_file KEYS |
| 50 | + gpg --import KEYS |
| 51 | +} |
| 52 | + |
| 53 | +fetch_archive() { |
| 54 | + local dist_name=$1 |
| 55 | + download_rc_file ${dist_name}.tar.gz |
| 56 | + download_rc_file ${dist_name}.tar.gz.asc |
| 57 | + download_rc_file ${dist_name}.tar.gz.md5 |
| 58 | + download_rc_file ${dist_name}.tar.gz.sha512 |
| 59 | + gpg --verify ${dist_name}.tar.gz.asc ${dist_name}.tar.gz |
| 60 | + gpg --print-md MD5 ${dist_name}.tar.gz | diff - ${dist_name}.tar.gz.md5 |
| 61 | + if [ "$(uname)" == "Darwin" ]; then |
| 62 | + shasum -a 512 ${dist_name}.tar.gz | diff - ${dist_name}.tar.gz.sha512 |
| 63 | + else |
| 64 | + sha512sum ${dist_name}.tar.gz | diff - ${dist_name}.tar.gz.sha512 |
| 65 | + fi |
| 66 | +} |
| 67 | + |
| 68 | +setup_tempdir() { |
| 69 | + cleanup() { |
| 70 | + rm -fr "$TMPDIR" |
| 71 | + } |
| 72 | + trap cleanup EXIT |
| 73 | + TMPDIR=$(mktemp -d -t "$1.XXXXX") |
| 74 | +} |
| 75 | + |
| 76 | +setup_tempdir "arrow-js-$VERSION" |
| 77 | +echo "Working in sandbox $TMPDIR" |
| 78 | +cd $TMPDIR |
| 79 | + |
| 80 | +VERSION=$1 |
| 81 | +RC_NUMBER=$2 |
| 82 | + |
| 83 | +TARBALL=apache-arrow-js-$1.tar.gz |
| 84 | + |
| 85 | +import_gpg_keys |
| 86 | + |
| 87 | +DIST_NAME="apache-arrow-js-${VERSION}" |
| 88 | +fetch_archive $DIST_NAME |
| 89 | +tar xvzf ${DIST_NAME}.tar.gz |
| 90 | +cd ${DIST_NAME} |
| 91 | + |
| 92 | +npm install |
| 93 | +# clean, lint, and build JS source |
| 94 | +npm run clean:all |
| 95 | +npm run lint |
| 96 | +npm run build |
| 97 | +# create initial integration test data |
| 98 | +npm run create:testdata |
| 99 | +# run once to write the snapshots |
| 100 | +npm test -- -t ts -u --integration |
| 101 | +# run again to test all builds against the snapshots |
| 102 | +npm test -- --integration |
| 103 | + |
| 104 | +echo 'Release candidate looks good!' |
| 105 | +exit 0 |
0 commit comments