aboutsummaryrefslogtreecommitdiffstats
path: root/etc/ci
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2023-07-17 15:55:57 +0200
committerGitHub <noreply@github.com>2023-07-17 13:55:57 +0000
commitda5b861b3c7357948bba1b6417525322d46684cb (patch)
treea101a9faa03954a9f442ff7c416ba2ed5bcae19f /etc/ci
parent4c8b47adbbee6752809701b67018dc47e2b1548c (diff)
downloadservo-da5b861b3c7357948bba1b6417525322d46684cb.tar.gz
servo-da5b861b3c7357948bba1b6417525322d46684cb.zip
Fix WPT sync and simplify the update scripts (#29999)
Much of the code used to import WPT tests from upstream has been moved to the WPT repository itself, so this can be reused. In addition, simplify the workflows by merging the entire process into mach and also directly into the GitHub workflow. This should fix WPT imports after combining compilation of layout and legacy layout. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'etc/ci')
-rwxr-xr-xetc/ci/update-wpt-checkout160
-rwxr-xr-xetc/ci/wpt-scheduled-update.sh45
2 files changed, 0 insertions, 205 deletions
diff --git a/etc/ci/update-wpt-checkout b/etc/ci/update-wpt-checkout
deleted file mode 100755
index c8d229546a4..00000000000
--- a/etc/ci/update-wpt-checkout
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/env bash
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at https://mozilla.org/MPL/2.0/.
-
-set -o errexit
-set -o nounset
-set -o pipefail
-
-REMOTE_NAME=sync-fork
-LOG_FILE=test-wpt.log
-BLUETOOTH_LOG_FILE=test-wpt-bluetooth.log
-WDSPEC_LOG_FILE=test-wpt-wdspec.log
-CURRENT_DATE=$(date +"%d-%m-%Y")
-BRANCH_NAME="wpt_update"
-REMOTE_BRANCH_NAME="wpt_update_${CURRENT_DATE}"
-
-export GIT_AUTHOR_NAME="WPT Sync Bot"
-export GIT_AUTHOR_EMAIL="josh+wptsync@joshmatthews.net"
-export GIT_COMMITTER_NAME="${GIT_AUTHOR_NAME}"
-export GIT_COMMITTER_EMAIL="${GIT_AUTHOR_EMAIL}"
-
-# Retrieve the HEAD commit and extract its hash
-function latest_git_commit() {
- git log -1 --oneline | cut -f 1 -d ' '
-}
-
-# Create a new branch for this sync, pull down all changes from the upstream
-# web-platform-tests repository, and commit the changes.
-function unsafe_pull_from_upstream() {
- git checkout -b "${1}" || return 1
-
- OLD_COMMIT=$(latest_git_commit)
-
- # Fetch all changes from upstream WPT and automatically transpose them
- # into a single servo commit.
- ./mach update-wpt --sync --patch || return 2
-
- # If there was no new commit created, there are no changes that need syncing.
- # Skip the remaining steps.
- if [[ "$(latest_git_commit)" == "${OLD_COMMIT}" ]]; then
- return 255
- fi
-
- # Update the manifest to include the new changes.
- ./mach update-manifest || return 3
- # Update the manifest again to reach a fixed state (https://github.com/servo/servo/issues/22275).
- ./mach update-manifest || return 4
-
- # Clean up any now-unused test results.
- (python3 etc/unused_wpt_results.py | xargs rm -rfv) || return 5
-
- # Amend the existing commit with the new changes from updating the manifest.
- git commit -a --amend --no-edit || return 6
-}
-
-# Remove all local traces of this sync operation.
-function cleanup() {
- git remote rm "${REMOTE_NAME}" || true
- git reset --hard || true
- git checkout master || true
- git branch -D "${BRANCH_NAME}" || true
- ./mach update-wpt --abort || true
-}
-
-# Build Servo and run the full WPT testsuite, saving the results to a log file.
-function unsafe_run_tests() {
- # Run the full testsuite and record the new test results.
- ./mach test-wpt --release --processes 12 --log-raw "${1}" \
- --always-succeed || return 1
-
- # Run the bluetooth testsuite, which uses the webdriver test harness.
- ./mach test-wpt --release --product=servodriver --headless \
- --log-raw "${2}" /bluetooth --always-succeed || return 2
-
- # Run the wdspec testsuite
- ./mach test-wpt --release --timeout-multiplier=4 --log-raw "${3}" /webdriver \
- --always-succeed || return 3
-}
-
-# Using an existing log file, update the expected test results and amend the
-# last commit with the new results.
-function unsafe_update_metadata() {
- ./mach update-wpt "${1}" "${2}" "${3}" || return 1
- # Hope that any test result changes from layout-2013 are also applicable to layout-2020.
- ./mach update-wpt --layout-2020 "${1}" "${2}" "${3}" || return 2
- # Ensure any new directories or ini files are included in these changes.
- git add tests/wpt/meta tests/wpt/metadata-legacy-layout tests/wpt/mozilla/meta tests/wpt/mozilla/meta-legacy-layout || return 3
- # Merge all changes with the existing commit.
- git commit -a --amend --no-edit || return 3
-}
-
-function pull_from_upstream() {
- unsafe_pull_from_upstream "${1}" || { code="${?}"; cleanup; return "${code}"; }
-}
-
-function run_tests() {
- unsafe_run_tests "${1}" "${2}" "${3}" || { code="${?}"; cleanup; return "${code}"; }
-}
-
-function update_metadata() {
- unsafe_update_metadata "${1}" "${2}" "${3}" || { code="${?}"; cleanup; return "${code}"; }
-}
-
-SCRIPT_NAME="${0}"
-
-function update_test_results() {
- run_tests "${LOG_FILE}" "${BLUETOOTH_LOG_FILE}" "${WDSPEC_LOG_FILE}"
- update_metadata "${LOG_FILE}" "${BLUETOOTH_LOG_FILE}" "${WDSPEC_LOG_FILE}"
-}
-
-function fetch_upstream_changes() {
- pull_from_upstream "${BRANCH_NAME}"
-}
-
-function usage() {
- echo "usage: ${SCRIPT_NAME} [cmd]"
- echo " commands:"
- echo " - fetch-upstream-changes: create a branch with the latest changes from upstream"
- echo " - update-test-results: run the tests, update the expected test results, and commit the changes"
- echo " - fetch-and-update-expectations: combines fetch-upstream-changes and update-test-results"
- echo " - cleanup: cleanup all traces of an in-progress sync and checkout the master branch"
- exit 1
-}
-
-function main() {
- if [[ "${1}" == "fetch-upstream-changes" ]] || [[ "${1}" == "fetch-and-update-expectations" ]]; then
- code=""
- fetch_upstream_changes || code="${?}"
- if [[ "${code}" == "255" ]]; then
- echo "No changes to sync."
- return 0
- fi
-
- if [[ "${code}" != "" ]]; then
- return "${code}"
- else
- return 0
- fi
- fi
-
- if [[ "${1}" == "update-test-results" ]] || [[ "${1}" == "fetch-and-update-expectations" ]]; then
- update_test_results
-
- elif [[ "${1}" == "cleanup" ]]; then
- cleanup
-
- else
- usage
- fi
-}
-
-if [[ "$#" != 1 ]]; then
- usage
-fi
-
-# Ensure we clean up after ourselves if this script is interrupted.
-trap 'cleanup' SIGINT SIGTERM
-main "${1}"
diff --git a/etc/ci/wpt-scheduled-update.sh b/etc/ci/wpt-scheduled-update.sh
deleted file mode 100755
index 90687d234ba..00000000000
--- a/etc/ci/wpt-scheduled-update.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env bash
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at https://mozilla.org/MPL/2.0/.
-
-set -o errexit
-set -o nounset
-set -o pipefail
-
-# For a given chunk, use the existing log files to update the expected test
-# results and amend the last commit with the new results.
-function unsafe_update_metadata_chunk() {
- ./mach update-wpt \
- "wpt-logs-linux-layout-2013/test-wpt.${1}.log" || return 1
- ./mach update-wpt --layout-2020 \
- "wpt-logs-linux-layout-2020/test-wpt.${1}.log" || return 2
-
- # Ensure any new directories or ini files are included in these changes.
- git add tests/wpt/meta \
- tests/wpt/meta-legacy-layout \
- tests/wpt/mozilla/meta \
- tests/wpt/mozilla/meta-legacy-layout || return 3
-
- # Merge all changes with the existing commit.
- git commit -a --amend --no-edit || return 3
-}
-
-function update_metadata_chunk() {
- unsafe_update_metadata_chunk "${1}" || \
- { code="${?}"; return "${code}"; }
-}
-
-function main() {
- for n in $(seq 1 "${MAX_CHUNK_ID}")
- do
- code=""
- update_metadata_chunk "${n}" || code="${?}"
- if [[ "${code}" != "" ]]; then
- return "${code}"
- fi
- done
-}
-
-main