forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
222 lines (202 loc) · 9.96 KB
/
action.yml
File metadata and controls
222 lines (202 loc) · 9.96 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: 'OpenVINO provider'
description: 'Provides OpenVINO build artifacts from a requested source'
inputs:
revision:
description: 'Version of OpenVINO to provide - latest_available_commit | HEAD | specific commit hash |
latest_nightly | specific package version (e.g. 2024.4.0rc2)'
required: true
branch_name:
description: 'Branch of OpenVINO to take the revision from if no specific hash was provided.
Taken from github context by default'
required: false
event_name:
description: 'Even name from which artifacts were generated. "push" by default; overwrite it with "pull_request"
if revision/branch is from PR'
default: "push"
required: false
ov_artifact_name:
description: "Name under which to upload provided OpenVINO build artifacts, set automatically by default"
required: false
platform:
description: "Platform for which to get artifacts: centos7 | debian10 | rhel8 | ubuntu20 |
ubuntu20 | ubuntu22 | ubuntu24 | macos | macos_12_6 | windows"
required: false
arch:
description: "Architecture for which to get artifacts: x86_64 | armhf | arm64"
default: "x86_64"
required: false
install_dir:
description: 'Local path to install OpenVINO package to. If not specified, package is installed to GitHub workspace
and uploaded to GitHub'
required: false
commit_packages_to_provide:
description: "Comma-separated list of OpenVINO packages from post-commit to provide ('all' to get everything)"
required: false
commit_share_path:
description: 'Path to share holding OpenVINO post-commit artifacts'
required: false
default: '/mount/build-artifacts'
nightly_package_source:
description: 'Source URL hosting OpenVINO nightly archives'
required: false
default: 'https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/latest.json'
pip_extra_url:
description: 'Source URL hosting OpenVINO wheels, for passing to pip as --extra-index-url'
required: false
default: 'https://storage.openvinotoolkit.org/simple/wheels'
outputs:
ov_artifact_name:
description: "Name of the artifact to upload OpenVINO build artifacts under"
value: ${{ steps.openvino_s3_download.outputs.ov_artifact_name || steps.openvino_commit_output.outputs.ov_artifact_name }}
ov_wheel_source:
description: "Pip option for custom OV wheel location (--find-links or --extra-index-url)"
value: ${{ steps.openvino_s3_wheel.outputs.ov_wheel_source || steps.openvino_commit_wheel.outputs.ov_wheel_source }}
ov_version:
description: "OpenVINO product version"
value: ${{ steps.openvino_s3_wheel.outputs.ov_version || steps.openvino_commit_wheel.outputs.ov_version }}
runs:
using: "composite"
steps:
- name: Identify artifacts source
id: get_source
shell: bash
run: |
artifacts_source="postcommit"
if [[ "${{ inputs.revision }}" == "latest_nightly" || "${{ inputs.revision }}" =~ ^[0-9]{4}\.[0-9]+\.*[0-9]* ]]; then
artifacts_source="s3"
fi
echo "artifacts_source=$artifacts_source" >> $GITHUB_OUTPUT
- name: Get action revision
id: get_action_revision
run: echo "action_ref=${{ env.ACTION_REF }}" >> $GITHUB_OUTPUT
shell: bash
env:
ACTION_REF: ${{ github.action_ref || github.base_ref || github.event.merge_group.base_ref || github.ref }}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: 'openvinotoolkit/openvino'
ref: ${{ steps.get_action_revision.outputs.action_ref }}
sparse-checkout: .github/actions
- name: Clone OpenVINO to get HEAD commit
if: inputs.revision == 'HEAD'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: 'openvinotoolkit/openvino'
path: 'openvino'
ref: ${{ inputs.branch_name || github.base_ref || github.event.merge_group.base_ref || github.ref }}
- name: Get OpenVINO HEAD commit
id: get_openvino_head_commit
if: inputs.revision == 'HEAD'
shell: bash
run: |
head=$(git -C openvino rev-parse HEAD)
echo "head=$head" >> $GITHUB_OUTPUT
- name: Create install dir
if: inputs.install_dir
shell: bash
run: |
mkdir -p ${{ inputs.install_dir }}
# --- Post-commit case ---
- name: Download post-commit OpenVINO archives
id: openvino_commit_download
if: steps.get_source.outputs.artifacts_source == 'postcommit'
uses: ./.github/actions/restore_artifacts
with:
platform: ${{ inputs.platform }}_${{ inputs.arch }}
storage_root: ${{ inputs.commit_share_path }}
event_name: ${{ inputs.event_name }}
trigger_repo_sha: ${{ env.OV_REVISION }}
branch_name: ${{ inputs.branch_name }}
to_restore: ${{ inputs.commit_packages_to_provide }}
target_dir: ${{ inputs.install_dir }}
env:
OV_REVISION: ${{ inputs.revision == 'HEAD' && steps.get_openvino_head_commit.outputs.head || inputs.revision }}
- name: Set action outputs
id: openvino_commit_output
if: steps.openvino_commit_download.outcome == 'success'
shell: bash
run: |
ov_artifact_name=${{ inputs.ov_artifact_name || inputs.platform }}
workspace_path=${{ steps.openvino_commit_download.outputs.artifacts_path }}
cd $workspace_path
ov_package_path=$(find . -name 'openvino_package*' -printf "%P\n" -quit)
[ -z "$ov_package_path" ] && echo "No openvino_package found in restored artifacts" && exit 1
mv $ov_package_path/* . && rm -rf $ov_package_path
echo "ov_artifact_name=$ov_artifact_name" >> $GITHUB_OUTPUT
echo "ov_package_path=$workspace_path" >> $GITHUB_OUTPUT
- name: Get commit wheel
id: openvino_commit_wheel
if: steps.openvino_commit_download.outcome == 'success'
shell: bash
run: |
artifacts_path=${{ steps.openvino_commit_download.outputs.artifacts_path }}
cd $artifacts_path
version=$(yq eval '.components.openvino.custom_params.wheel_product_version // .components.dldt.custom_params.wheel_product_version' manifest.yml)
wheel_path=${{ inputs.install_dir && '$artifacts_path/wheels' || './wheels' }}
default_find_links_cmd="--find-links=$wheel_path"
find_links_cmd=$([[ -n "$PIP_FIND_LINKS" ]] && echo "" || echo "$default_find_links_cmd")
echo "ov_version=$version" >> $GITHUB_OUTPUT
echo "ov_wheel_source=$default_find_links_cmd" >> $GITHUB_OUTPUT
- name: Upload commit OpenVINO archives
if: steps.openvino_commit_download.outcome == 'success' && !inputs.install_dir
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: ${{ steps.openvino_commit_output.outputs.ov_artifact_name }}
path: ${{ steps.openvino_commit_output.outputs.ov_package_path }}
if-no-files-found: 'error'
# --- S3 case ---
- name: Get a specific S3 package URL
id: get_s3_package
if: steps.get_source.outputs.artifacts_source == 's3' && inputs.revision != 'latest_nightly'
shell: bash
run: >-
python3 -m venv venv && . venv/bin/activate &&
pip install -r $GITHUB_ACTION_PATH/requirements.txt &&
python $GITHUB_ACTION_PATH/get_s3_package.py --product openvino --platform ${{ inputs.platform }} --arch ${{ inputs.arch }}
--version ${{ inputs.revision }}
- name: Download nightly OpenVINO archives
id: openvino_s3_download
if: steps.get_source.outputs.artifacts_source == 's3'
shell: bash
run: |
if [ ${{ steps.get_s3_package.outcome }} != 'skipped' ]; then
ov_package_url=${{ steps.get_s3_package.outputs.package_url }}
else
ov_package_url=$(curl -s ${{ inputs.nightly_package_source }} | jq -r '.${{ inputs.platform }}_${{ inputs.arch }}')
fi
cd ${{ inputs.install_dir || github.workspace }}
package_basename=$(basename $ov_package_url)
wget $ov_package_url --progress=bar:force:noscroll -O $package_basename
package_folder=${package_basename%.*}
[[ "$package_basename" == *.zip ]] && unzip "$package_basename" || tar -xvf "$package_basename"
rm $package_basename
if [ ${{ inputs.install_dir }} ]; then
mv $package_folder/* . && rm -rf $package_folder
fi
ov_artifact_name=$([ ${{ inputs.ov_artifact_name }} ] && echo ${{ inputs.ov_artifact_name }} || echo $package_folder)
echo "ov_package_url=$ov_package_url" >> $GITHUB_OUTPUT
echo "ov_artifact_name=$ov_artifact_name" >> $GITHUB_OUTPUT
echo "ov_package_path=$package_folder" >> $GITHUB_OUTPUT
- name: Upload OpenVINO archives
if: steps.openvino_s3_download.outcome == 'success' && !inputs.install_dir
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: ${{ steps.openvino_s3_download.outputs.ov_artifact_name }}
path: ${{ github.workspace }}/${{ steps.openvino_s3_download.outputs.ov_package_path }}
if-no-files-found: 'error'
- name: Get wheel
id: openvino_s3_wheel
if: steps.openvino_s3_download.outcome == 'success'
shell: bash
run: |
rc_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_url }} |
grep -oP '(?<=pre-release\/)\d{4}\.\d+\.\d+rc\d+' || true)
release_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_path }} |
grep -oP '_\K\d{4}\.\d+\.\d+')
dev_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_path }} |
grep -oP "${release_version//./\\.}\.dev\d{8}" || true)
version=${rc_version:-${dev_version:-$release_version}}
extra_index="--pre --extra-index-url ${{ inputs.pip_extra_url }}/nightly \
--extra-index-url ${{ inputs.pip_extra_url }}/pre-release"
echo "ov_version=$version" >> $GITHUB_OUTPUT
echo "ov_wheel_source=$extra_index" >> $GITHUB_OUTPUT