Combine all try workflows (#30096)

There are currently two ways to run try. One is to push to the `try` or
`try-*` branches and the other is to trigger a workflow via GitHub
comment. This change combines these methods into one workflow. In
addition, WPT results are reported together rather than separately and
filtered results for all WPT tests are bundled together in the same
artifact.
This commit is contained in:
Martin Robinson 2023-08-20 11:43:02 +02:00 committed by GitHub
parent 8d9d78ddc3
commit fed3491f23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 183 additions and 163 deletions

View file

@ -5,7 +5,7 @@ on:
# Run the entire pipeline for 'master' even though the merge queue already runs checks
# for every change. This just offers an extra layer of testing and covers the case of
# random force pushes.
branches: ["master", "try"]
branches: ["master"]
pull_request:
types: ['opened', 'synchronize']
branches: ["**"]
@ -16,7 +16,10 @@ on:
platform:
required: true
type: string
layout:
linux-wpt-layout:
required: true
type: string
mac-wpt-layout:
required: true
type: string
unit-tests:
@ -28,7 +31,11 @@ on:
required: false
type: choice
options: ["none", "linux", "windows", "macos", "all", "sync"]
layout:
linux-wpt-layout:
required: false
type: choice
options: ["none", "2013", "2020", "all"]
mac-wpt-layout:
required: false
type: choice
options: ["none", "2013", "2020", "all"]
@ -48,11 +55,17 @@ jobs:
uses: actions/github-script@v6
with:
script: |
// Never skip workflow runs for pull requests, merge groups, or manually triggered
// workfows / try jobs, which might need to actually run / retry WPT tests.
if (!['issue_comment', 'merge_group', 'pull_request', 'workflow_run', 'workflow_call'].includes(context.eventName)) {
// Skip the run if an identical run already exists. This helps to avoid running
// the workflow over and over again for the same commit hash.
// Skip this workflow if an identical run already exists. Note that we don't
// always want to skip workflows. In particular we don't skip duplicate
// workflows if:
// 1. This is a try job (triggered via an `issue_comment` event or a push to
// a non-master branch)
// 2. This is a merge queue event (`merge_queue`)
// 3. This event was triggered by a pull request update (`pull_request`)
// 4. This event was triggered manually `workflow_run` / `workflow_call`
let isPushToMaster = context.eventName == "push" && process.env.GITHUB_REF_NAME == "master";
let isTryRun = context.eventName == 'issue_comment' || (context.eventName == 'push' && !isPushToMaster);
if (!isTryRun && !['merge_group', 'pull_request', 'workflow_run', 'workflow_call'].includes(context.eventName)) {
if ((await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
@ -68,20 +81,23 @@ jobs:
// We need to pick defaults if the inputs are not provided. Unprovided inputs
// are empty strings in this template.
let platform = "${{ inputs.platform }}" || "linux";
let layout = "${{ inputs.layout }}" || "none";
let unit_tests = Boolean(${{ inputs.unit-tests }})
let linux_wpt_layout = "${{ inputs.linux-wpt-layout }}" || "none";
let mac_wpt_layout = "${{ inputs.mac-wpt-layout }}" || "none";
// Merge queue runs and pushes to master should always trigger a full build and test.
if (["push", "merge_group"].includes(context.eventName)) {
if (isPushToMaster || context.eventName == "merge_group") {
platform = "all";
layout = "all";
unit_tests = true;
linux_wpt_layout = "all";
mac_wpt_layout = "none";
}
let returnValue = {
platform,
layout,
unit_tests,
linux_wpt_layout,
mac_wpt_layout,
};
console.log("Using configuration: " + JSON.stringify(returnValue));
return returnValue;
@ -100,6 +116,7 @@ jobs:
if: ${{ contains(fromJson('["macos", "all"]'), fromJson(needs.decision.outputs.configuration).platform) }}
uses: ./.github/workflows/mac.yml
with:
wpt-layout: ${{ fromJson(needs.decision.outputs.configuration).mac_wpt_layout }}
unit-tests: ${{ fromJson(needs.decision.outputs.configuration).unit_tests }}
build-linux:
@ -109,9 +126,53 @@ jobs:
uses: ./.github/workflows/linux.yml
with:
wpt: 'test'
layout: ${{ fromJson(needs.decision.outputs.configuration).layout }}
wpt-layout: ${{ fromJson(needs.decision.outputs.configuration).linux_wpt_layout }}
unit-tests: ${{ fromJson(needs.decision.outputs.configuration).unit_tests }}
report-test-results:
name: Report WPT Results
runs-on: ubuntu-latest
needs:
- "decision"
- "build-win"
- "build-mac"
- "build-linux"
if: ${{
always() && !cancelled() &&
fromJson(needs.decision.outputs.configuration).platform != 'none' &&
(
fromJson(needs.decision.outputs.configuration).linux_wpt_layout != 'none' ||
fromJson(needs.decision.outputs.configuration).mac_wpt_layout != 'none'
)
}}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/download-artifact@v3
- name: Create aggregated unexpected results
run: |
mkdir -p wpt-filtered-results
cd wpt-filtered-results
for file in *; do \
if [ -d "$file" ]; then \
cat $file/*.log > "unexpected-test-wpt-$file.log"; \
fi \
done
- name: Archive aggregate results
uses: actions/upload-artifact@v3
with:
name: wpt-filtered-results
path: |
unexpected-test-wpt-*.log
- name: Comment on PR with results
run: |
etc/ci/report_aggregated_expected_results.py wpt-filtered-results
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RESULTS: ${{ toJson(needs.*.result) }}
build-result:
name: Result
runs-on: ubuntu-latest