aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/main.yml
blob: 83e09cd3977e4791bf349206310ce302832db653 (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
78
name: Main

on:
  push:
    # Run the entire pipeline for 'main' 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: ["main"]
  pull_request:
    types: ['opened', 'synchronize']
    branches: ["**"]
  merge_group:
    types: [checks_requested]
  workflow_dispatch:

jobs:
  decision:
    name: Generate Try Configuration
    runs-on: ubuntu-20.04
    outputs:
      configuration: ${{ steps.configuration.outputs.result }}
    steps:
      - uses: actions/setup-python@v5
        with:
          python-version: '3.10'
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1
          sparse-checkout: |
            python/servo/try_parser.py
          sparse-checkout-cone-mode: false
      - name: Get Configuration
        id: configuration
        run: |
          {
            echo 'result<<EOF'
            python ./python/servo/try_parser.py ${{ github.event_name == 'pull_request' && 'linux lint' || 'fail-fast full' }}
            echo EOF
           } >> $GITHUB_OUTPUT

  build:
    needs: ["decision"]
    name: ${{ matrix.name }}
    strategy:
      fail-fast: ${{ fromJson(needs.decision.outputs.configuration).fail_fast }}
      matrix:
        include: ${{ fromJson(needs.decision.outputs.configuration).matrix }}
    # We need to use `dipatch-workflow.yml` because workflows do not support using: ${}
    uses: ./.github/workflows/dispatch-workflow.yml
    secrets: inherit
    with:
      workflow: ${{ matrix.workflow }}
      wpt-layout: ${{ matrix.wpt_layout }}
      profile: ${{ matrix.profile }}
      unit-tests: ${{ matrix.unit_tests }}
      wpt-args: ${{ matrix.wpt_args }}
      bencher: ${{ matrix.bencher }}

  build-result:
    name: Result
    runs-on: ubuntu-latest
    if: always()
    # needs all build to detect cancellation
    needs:
      - build
    steps:
      - name: Merge build timings
        uses: actions/upload-artifact/merge@v4
        with:
          name: cargo-timings
          pattern: cargo-timings-*
          delete-merged: true
      - name: Success
        if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
        run: exit 0
      - name: Failure
        if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
        run: exit 1