Run WPT sync nightly on GitHub Action

This commit is contained in:
cybai 2021-08-16 22:38:44 +09:00
parent de183dfde7
commit 49d94cb08b
5 changed files with 212 additions and 4 deletions

149
.github/workflows/wpt-nightly.yml vendored Normal file
View file

@ -0,0 +1,149 @@
name: Synchronize WPT Nightly
on:
pull_request:
schedule:
# Run this job at 00:00 everyday
- cron: "0 0 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-linux:
name: Build on Linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Bootstrap
run: |
python3 -m pip install --upgrade pip virtualenv
sudo apt update
python3 ./mach bootstrap
- name: Release build
run: python3 ./mach build --release
- name: Lockfile check
run: ./etc/ci/lockfile_changed.sh
- name: Forbidden panic check
run: ./etc/ci/check_no_panic.sh
- name: Package binary
run: tar -czf target.tar.gz target/release/servo resources
- name: Archive binary
uses: actions/upload-artifact@v2
with:
name: release-binary
path: target.tar.gz
linux-wpt:
name: Linux WPT Tests
runs-on: ubuntu-20.04
needs: ["build-linux"]
env:
max_chunk_id: 20
strategy:
matrix:
chunk_id: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/download-artifact@v2
with:
name: release-binary
path: release-binary
- name: unPackage binary
run: tar -xzf release-binary/target.tar.gz
- name: Prep test environment
run: |
python3 -m pip install --upgrade pip virtualenv
sudo apt update
sudo apt install -qy --no-install-recommends libgl1 libssl1.1 libdbus-1-3 libxcb-xfixes0-dev libxcb-shape0-dev libunwind8 libegl1-mesa
wget http://mirrors.kernel.org/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
sudo apt install ./libffi6_3.2.1-8_amd64.deb
python3 ./mach bootstrap-gstreamer
- name: Fetch upstream changes before testing
run: |
./etc/ci/update-wpt-checkout fetch-upstream-changes
- name: Run tests
run: |
python3 ./mach test-wpt \
--release --processes $(nproc) --timeout-multiplier 2 \
--total-chunks ${{ env.max_chunk_id }} --this-chunk ${{ matrix.chunk_id }} \
--log-raw test-wpt.${{ matrix.chunk_id }}.log \
--log-servojson wpt-jsonsummary.${{ matrix.chunk_id }}.log \
--always-succeed
python3 ./mach filter-intermittents wpt-jsonsummary.${{ matrix.chunk_id }}.log \
--log-intermittents=intermittents.${{ matrix.chunk_id }}.log \
--log-filteredsummary=filtered-wpt-summary.${{ matrix.chunk_id }}.log \
--tracker-api=default --reporter-api=default \
--always-succeed
- name: Archive logs
uses: actions/upload-artifact@v2
with:
name: wpt${{ matrix.chunk_id }}-logs-linux
path: |
test-wpt.${{ matrix.chunk_id }}.log
wpt-jsonsummary.${{ matrix.chunk_id }}.log
filtered-wpt-summary.${{ matrix.chunk_id }}.log
intermittents.${{ matrix.chunk_id }}.log
sync:
name: Synchronize WPT Nightly
runs-on: ubuntu-latest
needs:
- "build-linux"
- "linux-wpt"
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2
# Download all artifacts
- uses: actions/download-artifact@v2
- name: Prep environment
run: |
python3 -m pip install --upgrade pip virtualenv
sudo apt update
python3 ./mach bootstrap
- name: Add upstream remote
run: |
git config --local user.email "josh+wptsync@joshmatthews.net"
git config --local user.name "WPT Sync Bot"
git remote add upstream https://github.com/servo/servo.git
git fetch --unshallow upstream
- name: Fetch upstream changes before syncing
run: |
./etc/ci/update-wpt-checkout fetch-upstream-changes
- name: Run WPT Update
env:
MAX_CHUNK_ID: 20
WPT_SYNC_TOKEN: ${{ secrets.WPT_SYNC_TOKEN }}
run: |
export CURRENT_DATE=$(date +"%d-%m-%Y")
echo $CURRENT_DATE
echo "CURRENT_DATE=$CURRENT_DATE" >> $GITHUB_ENV
./etc/ci/wpt-nightly-update.sh
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: wpt_update_${{ env.CURRENT_DATE }}
repository: servo-wpt-sync/servo
- name: Open PR
env:
GH_TOKEN: ${{ secrets.WPT_SYNC_TOKEN }}
UPDATE_BRANCH: wpt_update_${{ env.CURRENT_DATE }}
run: |
BODY=$(cat <<EOF
Automated downstream sync of changes from upstream as of ${{ env.CURRENT_DATE }}
[no-wpt-sync]
r? @servo-wpt-sync
EOF
)
git remote add sync-fork https://github.com/servo-wpt-sync/servo.git
git fetch sync-fork ${{ env.UPDATE_BRANCH }}
git checkout ${{ env.UPDATE_BRANCH }}
# TODO: comment `@bors-servo r+` from `@servo-wpt-sync`
gh pr create --title "Sync WPT with upstream (${{ env.CURRENT_DATE }})" --body "$BODY"

View file

@ -190,8 +190,12 @@ function main() {
if [[ "${code}" == "255" ]]; then
echo "No changes to sync."
return 0
elif [[ "${code}" != "" ]]; then
fi
if [[ "${code}" != "" ]]; then
return "${code}"
else
return 0
fi
fi

44
etc/ci/wpt-nightly-update.sh Executable file
View file

@ -0,0 +1,44 @@
#!/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
# 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}" || return 1
# Hope that any test result changes from layout-2013 are
# also applicable to layout-2020.
./mach update-wpt --layout-2020 "${1}" || return 2
# Ensure any new directories or ini files are included in these changes.
git add tests/wpt/metadata tests/wpt/metadata-layout-2020 \
tests/wpt/mozilla/meta || return 3
# Merge all changes with the existing commit.
git commit -a --amend --no-edit || return 3
}
function update_metadata() {
unsafe_update_metadata "${1}" || \
{ code="${?}"; cleanup; return "${code}"; }
}
function main() {
for n in $(seq 1 "${MAX_CHUNK_ID}")
do
code=""
update_metadata "wpt${n}-logs-linux/test-wpt.${n}.log" || \
code="${?}"
if [[ "${code}" != "" ]]; then
return "${code}"
fi
done
}
# Ensure we clean up after ourselves if this script is interrupted.
trap 'cleanup' SIGINT SIGTERM
main

View file

@ -192,7 +192,6 @@ def _activate_virtualenv(topdir, is_firefox):
os.path.join("python", "requirements.txt"),
wptrunner_path(is_firefox, topdir, "requirements.txt",),
wptrunner_path(is_firefox, topdir, "requirements_firefox.txt"),
wptrunner_path(is_firefox, topdir, "requirements_servo.txt"),
]
if need_pip_upgrade:

View file

@ -535,7 +535,16 @@ class MachCommands(CommandBase):
help='The API endpoint for tracking known intermittent failures.')
@CommandArgument('--reporter-api', default=None, action='store',
help='The API endpoint for reporting tracked intermittent failures.')
def filter_intermittents(self, summary, log_filteredsummary, log_intermittents, auth, tracker_api, reporter_api):
@CommandArgument('--always-succeed', default=False, action='store_true',
help='Always yield exit code of zero')
def filter_intermittents(self,
summary,
log_filteredsummary,
log_intermittents,
auth,
tracker_api,
reporter_api,
always_succeed):
encoded_auth = None
if auth:
with open(auth, "r") as file:
@ -602,7 +611,10 @@ class MachCommands(CommandBase):
if actual_failures:
format(actual_failures, description)
return bool(actual_failures)
if always_succeed:
return 0
else:
return bool(actual_failures)
@Command('test-android-startup',
description='Extremely minimal testing of Servo for Android',