forked from youtube/cobalt
-
Notifications
You must be signed in to change notification settings - Fork 0
187 lines (181 loc) · 6.94 KB
/
main_win.yaml
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Reusable Cobalt CI workflow.
name: main
on:
workflow_call:
inputs:
platform:
description: 'Cobalt platform.'
required: true
type: string
nightly:
description: 'Nightly workflow.'
required: true
type: string
default: 'false'
modular:
description: 'Whether this is a modular build.'
required: false
type: boolean
default: false
# Global env vars.
env:
REGISTRY: ghcr.io
IPV6_AVAILABLE: 0
LANG: en_US.UTF-8
IS_BUILDBOT_DOCKER: 1
#BUILD_ID_SERVER_URL:
IS_CI: 1
IS_DOCKER: 1
NINJA_STATUS: '[%e sec | %f/%t %u remaining | %c/sec | j%r]'
SCCACHE: 1
SCCACHE_GCS_BUCKET: cobalt-actions-sccache-windows
SCCACHE_GCS_OAUTH_URL: http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token
SCCACHE_GCS_RW_MODE: READ_WRITE
SCCACHE_IDLE_TIMEOUT: 0 # prevent sccache server from shutting down after long idle.
STARBOARD_TOOLCHAINS_DIR: /root/starboard-toolchains
concurrency:
group: '${{ github.workflow }}-${{ github.event_name }}-${{ inputs.platform }} @ ${{ github.event.pull_request.number || github.sha }}'
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Generates build matrix based on json configuration file.
initialize:
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_REPO_URL: ${{ github.event.pull_request.base.repo.url }}
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
# All triggers except draft PRs, unless PR is labeled with runtest
if: |
github.event.action != 'labeled' ||
(
github.event.action == 'labeled' &&
github.event.label.name == 'runtest'
)
steps:
- id: Checkout
uses: kaidokert/[email protected] # Temporary version
with:
fetch-depth: 1
persist-credentials: false
- name: Remove runtest if exists
if: github.event_name == 'pull_request'
continue-on-error: true # Ignore this step if we cannot remove the label.
run: |
set +e
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
${GITHUB_PR_REPO_URL}/issues/${GITHUB_EVENT_NUMBER}/labels/runtest
shell: bash
- id: set-platforms
run: echo "platforms=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -c '.platforms')" >> $GITHUB_ENV
- id: set-includes
run: echo "includes=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -c '.includes')" >> $GITHUB_ENV
- id: set-on-device-test
run: echo "on_device_test=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.on_device_test.enabled')" >> $GITHUB_ENV
- id: set-on-host-test
run: echo "on_host_test=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.on_host_test')" >> $GITHUB_ENV
- id: set-on-host-test-shards
run: echo "on_host_test_shards=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -c '.on_host_test_shards')" >> $GITHUB_ENV
- id: set-docker-service
run: echo "docker_service=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.docker_service')" >> $GITHUB_ENV
- id: set-docker-runner-service
run: echo "docker_runner_service=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.docker_runner_service')" >> $GITHUB_ENV
outputs:
platforms: ${{ env.platforms }}
includes: ${{ env.includes }}
on_device_test: ${{ env.on_device_test }}
on_host_test: ${{ env.on_host_test }}
on_host_test_shards: ${{ env.on_host_test_shards }}
docker_service: ${{ env.docker_service }}
docker_runner_service: ${{ env.docker_runner_service }}
# Build windows docker images.
build-docker-image:
needs: [initialize]
permissions:
packages: write
runs-on: windows-2019
steps:
- name: Checkout files
uses: kaidokert/[email protected]
with:
fetch-depth: 2
persist-credentials: false
- name: Login to Docker Registry ${{env.REGISTRY}}
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
id: build-docker-image
uses: ./.github/actions/docker_win
with:
service: ${{ needs.initialize.outputs.docker_service }}
- name: Build runner docker image
id: build-runner-docker-image
uses: ./.github/actions/docker_win
with:
service: ${{ needs.initialize.outputs.docker_runner_service }}
# Runs builds.
build:
needs: [initialize]
permissions: {}
runs-on: [self-hosted, win32]
name: ${{matrix.name}}_${{matrix.config}}
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
include: ${{ fromJson(needs.initialize.outputs.includes) }}
config: [devel, debug, qa, gold]
steps:
- name: Checkout
uses: kaidokert/[email protected]
with:
# Use fetch depth of 0 to get full history for a valid build id.
fetch-depth: 0
persist-credentials: false
- name: GN
uses: ./.github/actions/gn
- name: Build Cobalt
uses: ./.github/actions/build
- name: Upload Nightly Artifacts
if: ${{ ( inputs.nightly == 'true' || github.event_name == 'schedule' ) && matrix.config != 'debug' }}
uses: ./.github/actions/upload_nightly_artifacts
- name: Upload On Host Test Artifacts
if: ${{ matrix.config == 'devel' && needs.initialize.outputs.on_host_test == 'true' }}
uses: ./.github/actions/upload_test_artifacts
with:
type: onhost
os: windows
# Runs on the host unit and integration tests.
on-host-test:
needs: [initialize, build]
permissions: {}
if: needs.initialize.outputs.on_host_test == 'true'
runs-on: [self-hosted, win32]
name: ${{matrix.name}}_${{matrix.shard}}_test
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
shard: ${{ fromJson(needs.initialize.outputs.on_host_test_shards) }}
config: [devel]
include: ${{ fromJson(needs.initialize.outputs.includes) }}
env:
MODULAR_BUILD: ${{ inputs.modular && 1 || 0 }}
steps:
- name: Checkout
uses: kaidokert/[email protected]
with:
fetch-depth: 1
persist-credentials: false
- name: Run Tests
uses: ./.github/actions/on_host_test
with:
os: windows