forked from servo/servo
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (159 loc) · 5.58 KB
/
mac.yml
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Mac
on:
workflow_call:
inputs:
production:
required: false
default: false
type: boolean
wpt-layout:
required: false
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:
production:
required: false
default: false
type: boolean
wpt-layout:
required: false
type: choice
options: ["none", "2013", "2020", "all"]
unit-tests:
required: false
default: false
type: boolean
upload:
required: false
default: false
type: boolean
push:
branches: ["try-mac", "try-wpt-mac", "try-wpt-mac-2020"]
env:
cargo_profile_option: ${{ inputs.production && '--profile production' || '--release' }}
cargo_profile_name: ${{ inputs.production && 'production' || 'release' }}
RUST_BACKTRACE: 1
SHELL: /bin/bash
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0
jobs:
build:
name: Mac Build
runs-on: macos-13
steps:
- uses: actions/checkout@v3
if: github.event_name != 'issue_comment' && github.event_name != 'pull_request_target'
with:
fetch-depth: 2
# This is necessary to checkout the pull request if this run was triggered
# via an `issue_comment` action on a pull request.
- uses: actions/checkout@v3
if: github.event_name == 'issue_comment' || github.event_name == 'pull_request_target'
with:
ref: refs/pull/${{ github.event.issue.number || github.event.number }}/head
fetch-depth: 2
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install taplo
uses: baptiste0928/cargo-install@v2
with:
crate: taplo-cli
locked: true
- name: Bootstrap
run: |
python3 -m pip install --upgrade pip virtualenv
python3 ./mach bootstrap
brew install gnu-tar
- name: Release build (${{ inputs.production && 'without' || 'with' }} debug assertions)
run: |
python3 ./mach build ${{ env.cargo_profile_option }}
- name: Smoketest
run: python3 ./mach smoketest ${{ env.cargo_profile_option }}
- name: Script tests
run: ./mach test-scripts
- name: Unit tests
if: ${{ inputs.unit-tests || github.ref_name == 'try-mac' }}
uses: nick-fields/retry@v2
with:
timeout_minutes: 20 # https://github.com/servo/servo/issues/30275
max_attempts: 3 # https://github.com/servo/servo/issues/30683
command: python3 ./mach test-unit ${{ env.cargo_profile_option }}
- name: Build mach package
run: python3 ./mach package ${{ env.cargo_profile_option }}
- name: Run smoketest for mach package
run: ./etc/ci/macos_package_smoketest.sh target/${{ env.cargo_profile_name }}/servo-tech-demo.dmg
- name: Rename build timing
run: cp -r target/cargo-timings target/cargo-timings-macos
- name: Archive build timing
uses: actions/upload-artifact@v3
with:
name: cargo-timings
# Using a wildcard here ensures that the archive includes the path.
path: target/cargo-timings-*
- name: Upload artifact for mach package
uses: actions/upload-artifact@v3
with:
name: mac
path: target/${{ env.cargo_profile_name }}/servo-tech-demo.dmg
- name: Upload nightly
if: ${{ inputs.upload }}
run: |
python3 ./mach upload-nightly mac --secret-from-environment \
--github-release-id ${{ inputs.github-release-id }}
env:
S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }}
GITHUB_HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}
NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds
- name: Build package for target
run: gtar -czf target.tar.gz target/${{ env.cargo_profile_name }}/servo target/${{ env.cargo_profile_name }}/*.dylib target/${{ env.cargo_profile_name }}/lib/*.dylib resources
- name: Upload package for target
uses: actions/upload-artifact@v3
with:
name: release-binary-macos
path: target.tar.gz
wpt-2020:
if: ${{ github.ref_name == 'try-wpt-mac-2020' || inputs.wpt-layout == '2020' || inputs.wpt-layout == 'all' }}
name: Mac WPT Tests 2020
needs: ["build"]
uses: ./.github/workflows/mac-wpt.yml
with:
production: ${{ inputs.production == 'true' }}
layout: "layout-2020"
wpt-2013:
if: ${{ github.ref_name == 'try-wpt-mac' || inputs.wpt-layout == '2013' || inputs.wpt-layout == 'all' }}
name: Mac WPT Tests 2013
needs: ["build"]
uses: ./.github/workflows/mac-wpt.yml
with:
production: ${{ inputs.production == 'true' }}
layout: "layout-2013"
result:
name: Result
runs-on: ubuntu-latest
if: always()
# needs all build to detect cancellation
needs:
- "build"
- "wpt-2020"
- "wpt-2013"
steps:
- name: Mark the job as successful
run: exit 0
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
- name: Mark the job as unsuccessful
run: exit 1
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')