1#!/bin/bash 2# Copyright 2020 Google LLC 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15################################################################################ 16 17 18set -euo pipefail 19 20# If we are running on Kokoro cd into the repository. 21if [[ -n "${KOKORO_ROOT:-}" ]]; then 22 cd "${KOKORO_ARTIFACTS_DIR}/git/tink" 23 use_bazel.sh "$(cat python/.bazelversion)" 24fi 25 26./kokoro/testutils/copy_credentials.sh "python/testdata" "all" 27./kokoro/testutils/upgrade_gcc.sh 28# Sourcing required to update callers environment. 29source ./kokoro/testutils/install_python3.sh 30source ./kokoro/testutils/install_protoc.sh 31./kokoro/testutils/install_tink_via_pip.sh "${PWD}/python" "${PWD}" 32 33cd python 34 35# Set path to the Tink Python folder 36export TINK_PYTHON_ROOT_PATH="${PWD}" 37 38# Run Python tests directly so the package is used. 39# We exclude tests in tink/cc/pybind: they are implementation details and may 40# depend on a testonly shared object. 41find tink/ -not -path "*cc/pybind*" -type f -name "*_test.py" -print0 \ 42 | xargs -0 -n1 python3 43 44# Generate release of the pip package and test it 45./tools/distribution/create_release.sh 46