-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add ported Rust release verification script #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| #!/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. | ||
| # | ||
|
|
||
| case $# in | ||
| 2) VERSION="$1" | ||
| RC_NUMBER="$2" | ||
| ;; | ||
| *) echo "Usage: $0 X.Y.Z RC_NUMBER" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| set -e | ||
| set -x | ||
| set -o pipefail | ||
|
|
||
| SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" | ||
| ARROW_DIR="$(dirname $(dirname ${SOURCE_DIR}))" | ||
| ARROW_DIST_URL='https://dist.apache.org/repos/dist/dev/arrow' | ||
|
|
||
| download_dist_file() { | ||
| curl \ | ||
| --silent \ | ||
| --show-error \ | ||
| --fail \ | ||
| --location \ | ||
| --remote-name $ARROW_DIST_URL/$1 | ||
| } | ||
|
|
||
| download_rc_file() { | ||
| download_dist_file apache-arrow-rs-${VERSION}-rc${RC_NUMBER}/$1 | ||
| } | ||
|
|
||
| import_gpg_keys() { | ||
| download_dist_file KEYS | ||
| gpg --import KEYS | ||
| } | ||
|
|
||
| fetch_archive() { | ||
| local dist_name=$1 | ||
| download_rc_file ${dist_name}.tar.gz | ||
| download_rc_file ${dist_name}.tar.gz.asc | ||
| download_rc_file ${dist_name}.tar.gz.sha256 | ||
| download_rc_file ${dist_name}.tar.gz.sha512 | ||
| gpg --verify ${dist_name}.tar.gz.asc ${dist_name}.tar.gz | ||
| shasum -a 256 -c ${dist_name}.tar.gz.sha256 | ||
| shasum -a 512 -c ${dist_name}.tar.gz.sha512 | ||
| } | ||
|
|
||
| verify_dir_artifact_signatures() { | ||
| # verify the signature and the checksums of each artifact | ||
| find $1 -name '*.asc' | while read sigfile; do | ||
| artifact=${sigfile/.asc/} | ||
| gpg --verify $sigfile $artifact || exit 1 | ||
|
|
||
| # go into the directory because the checksum files contain only the | ||
| # basename of the artifact | ||
| pushd $(dirname $artifact) | ||
| base_artifact=$(basename $artifact) | ||
| if [ -f $base_artifact.sha256 ]; then | ||
| shasum -a 256 -c $base_artifact.sha256 || exit 1 | ||
| fi | ||
| shasum -a 512 -c $base_artifact.sha512 || exit 1 | ||
| popd | ||
| done | ||
| } | ||
|
|
||
| setup_tempdir() { | ||
| cleanup() { | ||
| if [ "${TEST_SUCCESS}" = "yes" ]; then | ||
| rm -fr "${ARROW_TMPDIR}" | ||
| else | ||
| echo "Failed to verify release candidate. See ${ARROW_TMPDIR} for details." | ||
| fi | ||
| } | ||
|
|
||
| if [ -z "${ARROW_TMPDIR}" ]; then | ||
| # clean up automatically if ARROW_TMPDIR is not defined | ||
| ARROW_TMPDIR=$(mktemp -d -t "$1.XXXXX") | ||
| trap cleanup EXIT | ||
| else | ||
| # don't clean up automatically | ||
| mkdir -p "${ARROW_TMPDIR}" | ||
| fi | ||
| } | ||
|
|
||
| test_source_distribution() { | ||
| # install rust toolchain in a similar fashion like test-miniconda | ||
| export RUSTUP_HOME=$PWD/test-rustup | ||
| export CARGO_HOME=$PWD/test-rustup | ||
|
|
||
| curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path | ||
|
|
||
| export PATH=$RUSTUP_HOME/bin:$PATH | ||
| source $RUSTUP_HOME/env | ||
|
|
||
| # build and test rust | ||
|
|
||
| # raises on any formatting errors | ||
| rustup component add rustfmt --toolchain stable | ||
| cargo +stable fmt --all -- --check | ||
| rustup default stable | ||
|
|
||
| # Clone testing repositories if not cloned already | ||
| git clone https://github.com/apache/arrow-testing.git arrow-testing-data | ||
| git clone https://github.com/apache/parquet-testing.git parquet-testing-data | ||
| export ARROW_TEST_DATA=$PWD/arrow-testing-data/data | ||
| export PARQUET_TEST_DATA=$PWD/parquet-testing-data/data | ||
|
|
||
| # use local modules because we don't publish modules to crates.io yet | ||
| sed \ | ||
| -i.bak \ | ||
| -E \ | ||
| -e 's/^arrow = "([^"]*)"/arrow = { version = "\1", path = "..\/arrow" }/g' \ | ||
| -e 's/^parquet = "([^"]*)"/parquet = { version = "\1", path = "..\/parquet" }/g' \ | ||
| */Cargo.toml | ||
|
|
||
| # raises on any warnings | ||
| RUSTFLAGS="-D warnings" cargo build | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. imo if (I am fine adding it to the CI, just pointing out that imo the release check should be as close as possible to the CI, so that we do not get surprises after cutting an RC). So far our ground truth is the CI, not a check on the RC. |
||
| cargo test | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only builds and tests with default features. There are some Cargo subcommands that can help to build all feature combinations.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps we can some inspiration from the CI checks: https://github.com/apache/arrow-rs/blob/master/.github/workflows/rust.yml#L114 (perhaps as part of a follow on PR)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that this depends on the goal: is the goal to run all tests in different machines and configurations, to maximize architecture coverage? Or is more like a smoke test just to test that the basics work? If the latter, then I think it is good as is. If the latter, then we need to basically reproduce all the tests in the CI here. The source of truth about whether patches are ready to merge is the CI; IMO it should also be the source of truth about whether the code is releasable. In this context, I see this as a smoke test. If we want to make some assertions over whether the code passes in architecture X, imo such assertion should be made on the CI, so that we do not rely on individual persons owning such an architecture for this. |
||
| } | ||
|
|
||
| TEST_SUCCESS=no | ||
|
|
||
| setup_tempdir "arrow-${VERSION}" | ||
| echo "Working in sandbox ${ARROW_TMPDIR}" | ||
| cd ${ARROW_TMPDIR} | ||
|
|
||
| dist_name="apache-arrow-rs-${VERSION}" | ||
| import_gpg_keys | ||
| fetch_archive ${dist_name} | ||
| tar xf ${dist_name}.tar.gz | ||
| pushd ${dist_name} | ||
| test_source_distribution | ||
| popd | ||
|
|
||
| TEST_SUCCESS=yes | ||
| echo 'Release candidate looks good!' | ||
| exit 0 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed; by default rust installs the stable channel.