forked from iree-org/iree
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (138 loc) · 6.77 KB
/
build_e2e_test_artifacts.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
# Copyright 2022 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# Workflow for building E2E test artifacts.
# It is designed to be called from a parent workflow.
# The concurrency of this workflow is controlled by the caller's job.
name: Build E2E Test Artifacts
on:
workflow_call:
inputs:
runner-group:
required: true
type: string
runner-env:
required: true
type: string
build-dir:
required: true
type: string
build-dir-archive:
required: true
type: string
build-dir-gcs-artifact:
required: true
type: string
benchmark-presets:
description: |
A comma-separated string of benchmark presets to build.
required: true
type: string
build-default-benchmark-suites:
description: |
Build default benchmark suites for sanity check and e2e model testing
if set to 1.
default: 1
type: number
shard-count:
description: |
A device-name to integer mapping as a comma separated list.
Allows to assign a distinct shard count for each target device.
The reserved keyword `default` assigns a shard count to all target devices
that are not explicitly listed.
default: default=1
type: string
outputs:
e2e-test-artifacts-dir:
description: |
Local path that stores compiled test artifacts.
value: ${{ jobs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-dir }}
e2e-test-artifacts-gcs-artifact-dir:
description: |
GCS path to the uploaded test artifacts.
value: ${{ jobs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-gcs-artifact-dir }}
e2e-test-artifacts-build-log:
description: |
Local path that contains the build log.
value: ${{ jobs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-build-log }}
e2e-test-artifacts-build-log-gcs-artifact:
description: |
GCS path to the uploaded build log.
value: ${{ jobs.build_e2e_test_artifacts.outputs.e2e-test-artifacts-build-log-gcs-artifact }}
env:
# This duplicates the variable from ci.yml. The variable needs to be in env
# instead of the outputs of setup because it contains the run attempt and we
# want that to be the current attempt, not whatever attempt the setup step
# last ran in. It therefore can't be passed in via inputs because the env
# context isn't available there.
GCS_DIR: gs://iree-github-actions-${{ github.event_name == 'pull_request' && 'presubmit' || 'postsubmit' }}-artifacts/${{ github.run_id }}/${{ github.run_attempt }}
jobs:
build_e2e_test_artifacts:
runs-on:
- self-hosted # must come first
- runner-group=${{ inputs.runner-group }}
- environment=${{ inputs.runner-env }}
- cpu
- os-family=Linux
env:
HOST_BUILD_DIR: ${{ inputs.build-dir }}
HOST_BUILD_DIR_ARCHIVE: ${{ inputs.build-dir-archive }}
HOST_BUILD_DIR_GCS_ARTIFACT: ${{ inputs.build-dir-gcs-artifact }}
outputs:
e2e-test-artifacts-dir: ${{ steps.build.outputs.e2e-test-artifacts-dir }}
e2e-test-artifacts-gcs-artifact-dir: ${{ steps.upload.outputs.e2e-test-artifacts-gcs-artifact-dir }}
e2e-test-artifacts-build-log: ${{ steps.build.outputs.e2e-test-artifacts-build-log }}
e2e-test-artifacts-build-log-gcs-artifact: ${{ steps.upload.outputs.e2e-test-artifacts-build-log-gcs-artifact }}
steps:
- name: "Checking out repository"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: "Checking out runtime submodules"
run: ./build_tools/scripts/git/update_runtime_submodules.sh
- name: "Downloading build dir archive"
run: gcloud storage cp "${HOST_BUILD_DIR_GCS_ARTIFACT}" "${HOST_BUILD_DIR_ARCHIVE}"
- name: "Extracting install from build dir archive"
run: tar -xf "${HOST_BUILD_DIR_ARCHIVE}" "${HOST_BUILD_DIR}/install"
- name: "Building e2e test artifacts"
id: build
env:
IREE_BENCHMARK_PRESETS: ${{ inputs.benchmark-presets }}
IREE_BUILD_DEFAULT_BENCHMARK_SUITES: ${{ inputs.build-default-benchmark-suites }}
BUILD_E2E_TEST_ARTIFACTS_DIR: build-e2e-test-artifacts
IREE_SHARD_COUNT: ${{ inputs.shard-count }}
run: |
build_tools/github_actions/docker_run.sh \
--env "IREE_HOST_BIN_DIR=${HOST_BUILD_DIR}/install/bin" \
--env "IREE_BENCHMARK_PRESETS=${IREE_BENCHMARK_PRESETS}" \
--env "IREE_BUILD_DEFAULT_BENCHMARK_SUITES=${IREE_BUILD_DEFAULT_BENCHMARK_SUITES}" \
gcr.io/iree-oss/frontends@sha256:b654dffe5b69d35f3182ffe1a41be98e3f32bc7843b6f10829a8eb2aa6a345ee \
build_tools/cmake/build_e2e_test_artifacts.sh \
"${BUILD_E2E_TEST_ARTIFACTS_DIR}"
echo "e2e-test-artifacts-dir=${BUILD_E2E_TEST_ARTIFACTS_DIR}/e2e_test_artifacts" >> "${GITHUB_OUTPUT}"
echo "e2e-test-artifacts-build-log=${BUILD_E2E_TEST_ARTIFACTS_DIR}/.ninja_log" >> "${GITHUB_OUTPUT}"
- name: "Uploading e2e test artifacts"
id: upload
env:
E2E_TEST_ARTIFACTS_DIR: ${{ steps.build.outputs.e2e-test-artifacts-dir }}
E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR: ${{ env.GCS_DIR }}/e2e-test-artifacts
E2E_TEST_ARTIFACTS_BUILD_LOG: ${{ steps.build.outputs.e2e-test-artifacts-build-log }}
E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT: ${{ env.GCS_DIR }}/e2e-test-artifacts/ninja_log
run: |
# TODO(#13677): MLIRs of the versioned MLIR source models are fetched
# from GCS and they won't change. We can upload links instead of files
# to save space.
# Uploads all artifacts except for the `*.tflite`, which are the
# source models we imported into MLIR.
# Not archiving the directory to allow fetching each file as needed
# separately. `find` depth is limited at 1 to exclude the directory
# itself and list all files and subdirectories at the first level. Let
# gcloud cli handle the recursive file traversal.
find "${E2E_TEST_ARTIFACTS_DIR}" -mindepth 1 -maxdepth 1 ! -name "*.tflite" \
| gcloud storage cp --read-paths-from-stdin -r \
"${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}"
gcloud storage cp "${E2E_TEST_ARTIFACTS_BUILD_LOG}" \
"${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}"
echo "e2e-test-artifacts-gcs-artifact-dir=${E2E_TEST_ARTIFACTS_GCS_ARTIFACT_DIR}" >> "${GITHUB_OUTPUT}"
echo "e2e-test-artifacts-build-log-gcs-artifact=${E2E_TEST_ARTIFACTS_BUILD_LOG_GCS_ARTIFACT}" >> "${GITHUB_OUTPUT}"