github.com/opencontainers/umoci@v0.4.8-0.20240508124516-656e4836fb0d/hack/ci-codecov.sh (about)

     1  #!/bin/bash
     2  # umoci: Umoci Modifies Open Containers' Images
     3  # Copyright (C) 2016-2021 SUSE LLC
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #   http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  set -Eeuxo pipefail
    18  source "$(dirname "$BASH_SOURCE")/readlinkf.sh"
    19  
    20  CODECOV_DIR="$(mktemp -dt umoci-codecov.XXXXXX)"
    21  #trap 'rm -rf $CODECOV_DIR' EXIT
    22  
    23  export ROOT="$(readlinkf_posix "$(dirname "$BASH_SOURCE")/..")"
    24  
    25  # Download the codecov-bash uploader from GitHub and check the SHA512.
    26  CODECOV_VERSION="1.0.6"
    27  CODECOV_REPOURL="https://raw.githubusercontent.com/codecov/codecov-bash/$CODECOV_VERSION"
    28  
    29  echo "WARNING: Downloading and executing codecov-bash, which will upload data." >&2
    30  sleep 1s
    31  
    32  cmd="$1"
    33  shift
    34  
    35  "$ROOT/hack/resilient-curl.sh" -sSL "$CODECOV_REPOURL/$cmd" -o "$CODECOV_DIR/$cmd"
    36  "$ROOT/hack/resilient-curl.sh" -sSL "$CODECOV_REPOURL/SHA512SUM" -o "$CODECOV_DIR/SHA512SUM"
    37  
    38  pushd "$CODECOV_DIR" >/dev/null
    39  sha512sum -c --ignore-missing --quiet ./SHA512SUM || exit 1
    40  chmod +x "$cmd"
    41  popd >/dev/null
    42  
    43  exec "$CODECOV_DIR/$cmd" "$@"