diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/tools/ci/epochs_update.sh | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/tools/ci/epochs_update.sh')
-rwxr-xr-x | testing/web-platform/tests/tools/ci/epochs_update.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/testing/web-platform/tests/tools/ci/epochs_update.sh b/testing/web-platform/tests/tools/ci/epochs_update.sh new file mode 100755 index 0000000000..1c7edf15aa --- /dev/null +++ b/testing/web-platform/tests/tools/ci/epochs_update.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -eux -o pipefail + +SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P) +WPT_ROOT=$SCRIPT_DIR/../.. + +EPOCHS=( +epochs/three_hourly::3h +epochs/six_hourly::6h +epochs/twelve_hourly::12h +epochs/daily::1d +epochs/weekly::1w +) + +function get_epoch_branch_name () { + echo ${1} | awk -F '::' '{print $1}' +} + +function get_epoch_timeval () { + echo ${1} | awk -F '::' '{print $2}' +} + +main () { + ALL_BRANCHES_NAMES="" + for e in "${EPOCHS[@]}"; + do + EPOCH=$(get_epoch_timeval ${e}) + EPOCH_BRANCH_NAME=$(get_epoch_branch_name ${e}) + EPOCH_SHA=$(./wpt rev-list --epoch ${EPOCH}) + if [ "${EPOCH_SHA}" = "" ]; then + echo "ERROR: Empty SHA returned from ./wpt rev-list" + exit 1 + fi + git branch "${EPOCH_BRANCH_NAME}" "${EPOCH_SHA}" + + # Only set epoch tag if is not already tagged from a previous run. + if ! git tag --points-at "${EPOCH_SHA}" | grep "${EPOCH_BRANCH_NAME}"; then + EPOCH_STAMP="$(date +%Y-%m-%d_%HH)" + git tag "${EPOCH_BRANCH_NAME}/${EPOCH_STAMP}" "${EPOCH_SHA}" + fi + + ALL_BRANCHES_NAMES="${ALL_BRANCHES_NAMES} ${EPOCH_BRANCH_NAME}" + done + # This is safe because `git push` will by default fail for a non-fast-forward + # push, for example if the remote branch is ahead of the local branch. + git push --tags ${REMOTE} ${ALL_BRANCHES_NAMES} +} + +cd $WPT_ROOT + +if [ -z "$GITHUB_TOKEN" ]; then + echo "GITHUB_TOKEN must be set as an environment variable" + exit 1 +fi + +REMOTE=https://x-access-token:$GITHUB_TOKEN@github.com/web-platform-tests/wpt.git + +main |