tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

safari-wptrunner.yml (6102B)


      1 name: Run Safari Tests
      2 
      3 on:
      4  workflow_call:
      5    inputs:
      6      artifact-name:
      7        description: Prefix for the artifact uploaded
      8        required: true
      9        type: string
     10      merged-artifact-name:
     11        description: Merge the uploaded artifacts into a singular artifact
     12        required: false
     13        type: string
     14      safari-technology-preview:
     15        description: Run Safari Technology Preview rather than the system Safari
     16        required: true
     17        type: boolean
     18      safaridriver-diagnose:
     19        description: Run safaridriver capturing diagnostics
     20        required: true
     21        type: boolean
     22      fetch-ref:
     23        description: The ref to fetch and initially checkout
     24        required: false
     25        type: string
     26      fetch-depth:
     27        description: The fetch-depth to checkout
     28        required: false
     29        type: number
     30      test-rev:
     31        description: The rev to checkout before running the tests
     32        required: false
     33        type: string
     34      matrix:
     35        description: Test matrix, to override test-type/current-chunk/total-chunks
     36        required: false
     37        type: string
     38      extra-options:
     39        description: Extra options to pass to wpt run
     40        required: false
     41        type: string
     42 
     43 # We never interact with the GitHub API, thus we can simply disable all
     44 # permissions the GitHub token would have.
     45 permissions: {}
     46 
     47 jobs:
     48  results:
     49    name: ${{ matrix.current-chunk || 1 }} (of ${{ matrix.total-chunks || 1 }})
     50    env:
     51      CURRENT_CHUNK: ${{ matrix.current-chunk || 1 }}
     52      TOTAL_CHUNKS: ${{ matrix.total-chunks || 1 }}
     53    runs-on:
     54      - self-hosted
     55      - webkit-ews
     56    timeout-minutes: 180
     57    strategy:
     58      matrix: "${{ fromJSON(inputs.matrix || '{\"pointless-matrix-item\": [0]}') }}"
     59    steps:
     60      - name: checkout
     61        uses: actions/checkout@v4.1.0
     62        with:
     63          fetch-depth: ${{ inputs.fetch-depth || 1 }}
     64          ref: ${{ inputs.fetch-ref }}
     65      - name: test-checkout
     66        if: inputs.test-rev
     67        env:
     68          REV: ${{ inputs.test-rev }}
     69        run: |-
     70          git switch --force --progress -d "$REV"
     71      - name: Reconfigure the display(s)
     72        run: |-
     73          ./wpt macos-display-configuration
     74      - name: Set system caption style to ""
     75        run: |-
     76          defaults write com.apple.mediaaccessibility MACaptionActiveProfile -string ""
     77      - name: Enable safaridriver diagnostics
     78        if: inputs.safaridriver-diagnose
     79        run: |-
     80          rm -rf ~/Library/Logs/com.apple.WebDriver/
     81          defaults write com.apple.WebDriver DiagnosticsEnabled 1
     82      - name: Enable safaridriver (Safari)
     83        if: ${{ !inputs.safari-technology-preview }}
     84        run: |-
     85          set -eux -o pipefail
     86          sudo safaridriver --enable
     87      - name: Enable safaridriver (Safari Technology Preview)
     88        if: ${{ inputs.safari-technology-preview }}
     89        run: |-
     90          set -eux -o pipefail
     91          export SYSTEM_VERSION_COMPAT=0
     92          ./wpt install --channel preview --download-only -d . --rename STP safari browser
     93          sudo installer -pkg STP.pkg -target LocalSystem
     94          sudo /Applications/Safari\ Technology\ Preview.app/Contents/MacOS/safaridriver --enable
     95      - name: Update hosts
     96        run: |-
     97          set -eux -o pipefail
     98          ./wpt make-hosts-file | sudo tee -a /etc/hosts
     99      - name: Update manifest
    100        run: ./wpt manifest
    101      - name: Run tests
    102        run: |-
    103          set -eux -o pipefail
    104          export SYSTEM_VERSION_COMPAT=0
    105          ./wpt run \
    106            --no-manifest-update \
    107            --no-restart-on-unexpected \
    108            --no-pause \
    109            --this-chunk "$CURRENT_CHUNK" \
    110            --total-chunks "$TOTAL_CHUNKS" \
    111            --chunk-type hash \
    112            --log-wptreport ${{ runner.temp }}/wpt_report_"$CURRENT_CHUNK".json \
    113            --log-wptscreenshot ${{ runner.temp }}/wpt_screenshot_"$CURRENT_CHUNK".txt \
    114            --log-mach - \
    115            --log-mach-level info \
    116            --channel ${{ inputs.safari-technology-preview && 'preview' || 'stable' }} \
    117            --kill-safari \
    118            --max-restarts 100 \
    119            ${{ inputs.extra-options }} \
    120            -- \
    121            safari
    122      - name: Publish results
    123        if: "!cancelled()"
    124        uses: actions/upload-artifact@v4.1.0
    125        with:
    126          name: ${{ inputs.artifact-name }}-${{ env.CURRENT_CHUNK }}
    127          path: |
    128            ${{ runner.temp }}/wpt_report_*.json
    129            ${{ runner.temp }}/wpt_screenshot_*.txt
    130          if-no-files-found: error
    131      - name: Publish safaridriver logs
    132        if: inputs.safaridriver-diagnose && !cancelled()
    133        uses: actions/upload-artifact@v4.1.0
    134        with:
    135          name: ${{ inputs.artifact-name }}-safaridriver-logs-${{ env.CURRENT_CHUNK }}
    136          path: ~/Library/Logs/com.apple.WebDriver/
    137          if-no-files-found: warn
    138      - name: Disable safaridriver diagnostics
    139        if: inputs.safaridriver-diagnose && always()
    140        run: |-
    141          defaults write com.apple.WebDriver DiagnosticsEnabled 0
    142          rm -rf ~/Library/Logs/com.apple.WebDriver/
    143      - name: Cleanup
    144        if: always()
    145        run: |-
    146          set -ux
    147          sudo sed -i '' '/^# Start web-platform-tests hosts$/,/^# End web-platform-tests hosts$/d' /etc/hosts
    148 
    149  notify-unmerged:
    150    name: Notify (unmerged results)
    151    needs: results
    152    if: "! inputs.merged-artifact-name"
    153    uses: ./.github/workflows/wpt_fyi_notify.yml
    154    with:
    155      artifact-name: ${{ inputs.artifact-name }}-*
    156 
    157  merge-results:
    158    name: Merge results artifacts
    159    runs-on: ubuntu-24.04
    160    needs: results
    161    if: inputs.merged-artifact-name
    162    steps:
    163      - name: Merge Artifacts
    164        uses: actions/upload-artifact/merge@v4
    165        with:
    166          name: ${{ inputs.merged-artifact-name }}
    167          pattern: ${{ inputs.artifact-name }}-*
    168 
    169  notify-merged:
    170    name: Notify (merged results)
    171    needs: merge-results
    172    if: inputs.merged-artifact-name
    173    uses: ./.github/workflows/wpt_fyi_notify.yml
    174    with:
    175      artifact-name: ${{ inputs.merged-artifact-name }}