aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/windows.yml
blob: 2175ead5f580f82f48ab4cac2d3a25d448b8f655 (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
name: Windows workflow

on:
  workflow_call:
    inputs:
      layout:
        required: true
        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:
      layout:
        required: true
        type: choice
        options: ["2013", "2020"]
      unit-tests:
        required: false
        default: false
        type: boolean
      upload:
        required: false
        default: false
        type: boolean
  push:
    branches: ["try-windows"]

env:
  RUST_BACKTRACE: 1
  SHELL: /bin/bash
  LAYOUT: "${{ contains(inputs.layout, '2020') && 'layout-2020' || 'layout-2013' }}"
  PACKAGE: "${{ contains(inputs.layout, '2020') && 'windows-msvc-layout2020' || 'windows-msvc' }}"
  CCACHE: "ccache"
  CARGO_TARGET_DIR: C:\\a\\servo\\servo\\target

jobs:
  build-win:
    name: Build
    runs-on: windows-2019
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 2
      - name: wix311-binaries
        shell: powershell
        run: |
          Start-BitsTransfer -Source https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311-binaries.zip -Destination C:\\wix311-binaries.zip
          Expand-Archive C:\\wix311-binaries.zip -DestinationPath C:\\wix
          echo "C:\\wix" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
      - name: ccache
        uses: hendrikmuhs/ccache-action@v1.2
      - name: Bootstrap
        run: |
          python -m pip install --upgrade pip virtualenv
          python mach fetch
          python mach bootstrap-gstreamer
      - name: Release build
        run: python mach build --release --with-${{ env.LAYOUT }}
      - name: Copy resources
        run: cp D:\a\servo\servo\resources C:\a\servo\servo -Recurse
      - name: Smoketest
        run: python mach smoketest --angle
      - name: Unit tests
        if: ${{ inputs.unit-tests }}
        run: python mach test-unit --release --with-${{ env.LAYOUT }}
      - name: Package
        run: python mach package --release
      - name: Upload Package
        uses: actions/upload-artifact@v3
        with:
          name: ${{ env.PACKAGE }}
          # These files are available
          # MSI Installer: C:\a\servo\servo\target\release\msi\Installer.msi
          # Bundle: C:\a\servo\servo\target\release\msi\Servo.exe
          # Zip: C:\a\servo\servo\target\release\msi\Servo.zip
          path: C:\\a\\servo\\servo\\target/release/msi/Servo.exe
      - name: Upload
        if: ${{ inputs.upload }}
        run: |
          python mach upload-nightly ${{ env.PACKAGE }} --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

  build_result:
    name: homu build finished
    runs-on: ubuntu-latest
    if: always()
    # needs all build to detect cancellation
    needs:
      - "build-win"

    steps:
      - name: Mark the job as successful
        run: exit 0
        if: ${{ !contains(join(needs.*.result, ','), 'failure') && !contains(join(needs.*.result, ','), 'cancelled') }}
      - name: Mark the job as unsuccessful
        run: exit 1
        if: contains(join(needs.*.result, ','), 'failure') || contains(join(needs.*.result, ','), 'cancelled')