aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/scheduled-wpt-import.yml
blob: 73687c7d310847fd5cc9a3354d14f07371fe6f42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: WPT Import

on:
  schedule:
    # Run this job every Sunday at 00:00.
    - cron: "0 0 * * 0"

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  linux:
    # This job is only useful when run on upstream servo.
    if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch'
    name: Linux
    uses: ./.github/workflows/linux.yml
    with:
      wpt-sync-from-upstream: true
      wpt-layout: 'all'
      unit-tests: false

  sync:
    # This job is only useful when run on upstream servo.
    if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch'
    name: Synchronize WPT Nightly
    runs-on: ubuntu-latest
    needs:
      - "linux"
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - uses: actions/download-artifact@v4
        with:
          name: wpt-full-logs-linux-layout-2013
      - uses: actions/download-artifact@v4
        with:
          name: wpt-full-logs-linux-layout-2020
      - name: Prep environment
        run: |
          python3 -m pip install --upgrade pip
          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: |
          ./mach update-wpt --sync --patch
      - name: Amend commit with test results
        run: |
          export CURRENT_DATE=$(date +"%d-%m-%Y")
          echo $CURRENT_DATE
          echo "CURRENT_DATE=$CURRENT_DATE" >> $GITHUB_ENV
          ./mach update-wpt linux-layout-2013/*.log --legacy-layout
          ./mach update-wpt linux-layout-2020/*.log
          git add tests/wpt/meta tests/wpt/meta-legacy-layout
          git commit -a --amend --no-edit
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          branch: wpt_update_${{ env.CURRENT_DATE }}
      - 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]
          EOF
          )
          gh pr create \
            --title "Sync WPT with upstream (${{ env.CURRENT_DATE }})" \
            --body "$BODY" --head ${{ env.UPDATE_BRANCH }}