aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/windows.yml
blob: ad74926715990b686f7aedd457c8d4e093bd3053 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Windows

on:
  workflow_call:
    inputs:
      profile:
        required: false
        default: "release"
        type: string
      unit-tests:
        required: false
        default: false
        type: boolean
      upload:
        required: false
        default: false
        type: boolean
      github-release-id:
        required: false
        type: string
  workflow_dispatch:
    inputs:
      profile:
        required: false
        default: "release"
        options: ["release", "debug", "production"]
        type: choice
      unit-tests:
        required: false
        default: false
        type: boolean
      upload:
        required: false
        default: false
        type: boolean

env:
  RUST_BACKTRACE: 1
  SHELL: /bin/bash
  CCACHE: "ccache"
  CARGO_TARGET_DIR: C:\\a\\servo\\servo\\target
  # clang_sys will search msys path before Program Files\LLVM
  # so we need to override this behaviour until we update clang-sys
  # https://github.com/KyleMayes/clang-sys/issues/150
  LIBCLANG_PATH: C:\\Program Files\\LLVM\\bin

jobs:
  build:
    name: Windows Build
    runs-on: windows-2022
    steps:
      - uses: actions/checkout@v4
        if: github.event_name != 'pull_request_target'
      # This is necessary to checkout the pull request if this run was triggered via a
      # `pull_request_target` event.
      - uses: actions/checkout@v4
        if: github.event_name == 'pull_request_target'
        with:
          ref: refs/pull/${{ github.event.number }}/head
          fetch-depth: 2
      - name: ccache
        uses: hendrikmuhs/ccache-action@v1.2
      - name: Install taplo
        uses: baptiste0928/cargo-install@v3
        with:
          crate: taplo-cli
          locked: true
      - name: Install wixtoolset
        run: |
          choco install wixtoolset
          echo "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
      - uses: actions/setup-python@v5
        with:
          python-version: '3.10'
      - name: Bootstrap
        run: |
          python -m pip install --upgrade pip
          python mach fetch
          python mach bootstrap-gstreamer
          cargo install --path support/crown
      # For some reason WiX isn't currently on the GitHub runner path. This is a
      # temporary workaround until that is fixed.
      - name: Add WiX to Path
        run: |
          "$env:WIX\bin" >> $env:GITHUB_PATH
      - name: Build (${{ inputs.profile }})
        run: |
          python mach build --locked --${{ inputs.profile }}
          cp C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows -Recurse
      - name: Copy resources
        run: cp D:\a\servo\servo\resources C:\a\servo\servo -Recurse
      - name: Smoketest
        run: python mach smoketest --${{ inputs.profile }}
      - name: Unit tests
        if: ${{ inputs.unit-tests }}
        uses: nick-fields/retry@v3
        with:
          timeout_minutes: 30
          max_attempts: 3 # https://github.com/servo/servo/issues/30683
          command: python mach test-unit --${{ inputs.profile }} -- -- --test-threads=1
      - name: Archive build timing
        uses: actions/upload-artifact@v4
        with:
          name: cargo-timings-windows
          # Using a wildcard here ensures that the archive includes the path.
          path: C:\\a\\servo\\servo\\target\\cargo-timings-*
      - name: Build mach package
        run: python mach package --${{ inputs.profile }}
      - name: Upload artifact for mach package
        uses: actions/upload-artifact@v4
        with:
          name: win
          # These files are available
          # MSI Installer: C:\a\servo\servo\target\${{ inputs.profile }}\msi\Installer.msi
          # Bundle: C:\a\servo\servo\target\${{ inputs.profile }}\msi\Servo.exe
          # Zip: C:\a\servo\servo\target\${{ inputs.profile }}\msi\Servo.zip
          path: C:\\a\\servo\\servo\\target\\${{ inputs.profile }}\\msi\\Servo.exe
      - name: Upload nightly
        if: ${{ inputs.upload }}
        run: |
          python mach upload-nightly windows-msvc --secret-from-environment `
            --github-release-id ${{ inputs.github-release-id }}
        env:
          S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }}
          NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
          NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds