Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit dc28e02

Browse files
authored
bugfix: allow non-string input types for workflow_dispatch inputs (#37)
1 parent 4e336b6 commit dc28e02

File tree

3 files changed

+339
-1
lines changed

3 files changed

+339
-1
lines changed

src/common.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ pub type Env = IndexMap<String, EnvValue>;
6464
/// Environment variable values are always strings, but GitHub Actions
6565
/// allows users to configure them as various native YAML types before
6666
/// internal stringification.
67+
///
68+
/// This type also gets used for other places where GitHub Actions
69+
/// contextually reinterprets a YAML value as a string, e.g. trigger
70+
/// input values.
6771
#[derive(Serialize, Deserialize, Debug, PartialEq)]
6872
#[serde(untagged)]
6973
pub enum EnvValue {

src/workflow/event.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
use indexmap::IndexMap;
44
use serde::{Deserialize, Serialize};
55

6+
use crate::common::EnvValue;
7+
68
/// "Bare" workflow event triggers.
79
///
810
/// These appear when a workflow is triggered with an event with no context,
@@ -286,7 +288,7 @@ pub struct WorkflowDispatchInput {
286288
pub r#type: Option<String>,
287289
// Only present when `type` is `choice`.
288290
#[serde(default)]
289-
pub options: Vec<String>,
291+
pub options: Vec<EnvValue>,
290292
}
291293

292294
/// The body of a `workflow_run` event trigger.
Lines changed: 332 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,332 @@
1+
# https://github.com/intel/llvm/blob/776af8ed456bf7f10458ca171af1dd7ca27f8895/.github/workflows/sycl-linux-run-tests.yml
2+
#
3+
# Licensed under the Apache License v2.0 with LLVM Exceptions.
4+
#
5+
# Full terms: https://github.com/intel/llvm/blob/776af8ed456bf7f10458ca171af1dd7ca27f8895/LICENSE.TXT
6+
7+
name: SYCL E2E
8+
9+
on:
10+
workflow_call:
11+
inputs:
12+
name:
13+
type: string
14+
required: True
15+
16+
runner:
17+
type: string
18+
required: True
19+
image:
20+
type: string
21+
required: False
22+
image_options:
23+
type: string
24+
required: True
25+
26+
target_devices:
27+
type: string
28+
required: False
29+
extra_cmake_args:
30+
type: string
31+
required: False
32+
tests_selector:
33+
description: |
34+
Three possible options: "e2e", "cts", and "compute-benchmarks".
35+
type: string
36+
default: "e2e"
37+
38+
extra_lit_opts:
39+
description: |
40+
Extra options to be added to LIT_OPTS.
41+
type: string
42+
default: ''
43+
44+
ref:
45+
type: string
46+
required: True
47+
devops_ref:
48+
type: string
49+
required: False
50+
description: |
51+
By default we checkout the devops directory from "inputs.ref" branch.
52+
devops_ref may be specified to checkout the devops dir from different
53+
branch.
54+
Note: it doesn't affect ./devops/actions/run-tests/* as these actions
55+
call checkout again and therefore override the devops directory, so
56+
configs/dependecies from input.ref are used.
57+
58+
sycl_toolchain_artifact:
59+
type: string
60+
default: ''
61+
required: False
62+
sycl_toolchain_archive:
63+
type: string
64+
default: ''
65+
required: False
66+
sycl_toolchain_decompress_command:
67+
type: string
68+
default: ''
69+
required: False
70+
71+
e2e_binaries_artifact:
72+
description: |
73+
Must be set if `e2e_testing_mode` is equal to `run-only` and the
74+
artifact must exist. Can be set in other modes resulting in artifact
75+
upload.
76+
type: string
77+
default: ''
78+
required: False
79+
e2e_testing_mode:
80+
description: |
81+
Testing mode to run E2E tests in, can be either `full`, `build-only`
82+
or `run-only`.
83+
type: string
84+
default: 'full'
85+
retention-days:
86+
description: 'E2E/SYCL-CTS binaries artifact retention period.'
87+
type: string
88+
default: 1
89+
90+
reset_intel_gpu:
91+
type: string
92+
required: False
93+
install_igc_driver:
94+
type: string
95+
required: False
96+
install_dev_igc_driver:
97+
type: string
98+
required: False
99+
env:
100+
type: string
101+
default: '{}'
102+
required: False
103+
104+
skip_run:
105+
type: string
106+
default: 'false'
107+
required: False
108+
109+
cts_testing_mode:
110+
description: |
111+
Testing mode to run SYCL-CTS in, can be either `full`, `build-only`
112+
or `run-only`. In `build-only` mode an artifact of the CTS binaries
113+
will be uploaded.
114+
type: string
115+
default: 'full'
116+
117+
sycl_cts_artifact:
118+
type: string
119+
default: ''
120+
required: False
121+
122+
workflow_dispatch:
123+
inputs:
124+
runner:
125+
type: choice
126+
options:
127+
- '["Linux", "gen12"]'
128+
- '["amdgpu"]'
129+
- '["Linux", "arc"]'
130+
- '["Linux", "pvc"]'
131+
- '["cts-cpu"]'
132+
- '["Linux", "build"]'
133+
- '["cuda"]'
134+
image:
135+
type: choice
136+
options:
137+
- 'ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest'
138+
- 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps'
139+
image_options:
140+
description: |
141+
Use option with "--device=/dev/kfd" for AMDGPU, without it for the rest.
142+
type: choice
143+
options:
144+
- '-u 1001 --device=/dev/dri --device=/dev/kfd --privileged --cap-add SYS_ADMIN'
145+
- '-u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN'
146+
- '-u 1001 --gpus all --cap-add SYS_ADMIN'
147+
target_devices:
148+
type: choice
149+
options:
150+
- 'level_zero:gpu'
151+
- 'opencl:cpu'
152+
- 'opencl:gpu'
153+
- 'opencl:fpga'
154+
- 'hip:gpu'
155+
- 'cuda:gpu'
156+
tests_selector:
157+
type: choice
158+
options:
159+
- e2e
160+
- cts
161+
- compute-benchmarks
162+
163+
env:
164+
description: |
165+
Suggested variables: for E2E tests - LIT_FILTER, LIT_FILTER_OUT.
166+
LIT_OPTS won't work as we redefine it as part of this workflow.
167+
168+
For SYCL CTS - CTS_TESTS_TO_BUILD to specify which categories to
169+
build, e.g. {"CTS_TESTS_TO_BUILD":"test_category1 test_category2..."}.
170+
171+
Format: '{"VAR1":"VAL1","VAR2":"VAL2",...}'
172+
default: '{}'
173+
174+
extra_lit_opts:
175+
description: |
176+
Extra options to be added to LIT_OPTS.
177+
default: ''
178+
179+
install_igc_driver:
180+
type: choice
181+
options:
182+
- false
183+
- true
184+
185+
install_dev_igc_driver:
186+
type: choice
187+
options:
188+
- false
189+
- true
190+
e2e_testing_mode:
191+
type: choice
192+
options:
193+
- "full"
194+
- "build-only"
195+
196+
permissions:
197+
contents: read
198+
packages: read
199+
200+
jobs:
201+
run:
202+
if: github.event_name == 'workflow_dispatch' || inputs.skip_run == 'false'
203+
name: ${{ inputs.name }}
204+
runs-on: ${{ fromJSON(inputs.runner) }}
205+
container:
206+
image: ${{ inputs.image || 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps'}}
207+
options: ${{ inputs.image_options }}
208+
env: ${{ fromJSON(inputs.env) }}
209+
steps:
210+
- name: Reset Intel GPU
211+
if: inputs.reset_intel_gpu == 'true'
212+
run: |
213+
sudo mount -t debugfs none /sys/kernel/debug
214+
sudo bash -c 'echo 1 > /sys/kernel/debug/dri/0/i915_wedged'
215+
- uses: actions/checkout@v4
216+
with:
217+
ref: ${{ inputs.devops_ref || inputs.ref }}
218+
sparse-checkout: |
219+
devops
220+
- name: Register cleanup after job is finished
221+
uses: ./devops/actions/cleanup
222+
- name: Install drivers
223+
if: inputs.install_igc_driver == 'true' || inputs.install_dev_igc_driver == 'true'
224+
env:
225+
GITHUB_TOKEN: ${{ github.token }}
226+
run: |
227+
if [ "${{ inputs.install_dev_igc_driver }}" = "true" ]; then
228+
# If libllvm14 is already installed (dev igc docker), still return true.
229+
sudo apt-get install -yqq libllvm14 || true;
230+
fi
231+
sudo -E bash devops/scripts/install_drivers.sh devops/dependencies.json ${{ inputs.install_dev_igc_driver == 'true' && 'devops/dependencies-igc-dev.json --use-dev-igc' || '' }} --all
232+
- name: Source OneAPI TBB vars.sh
233+
shell: bash
234+
run: |
235+
# https://github.com/actions/runner/issues/1964 prevents us from using
236+
# the ENTRYPOINT in the image.
237+
env | sort > env_before
238+
if [ -e /runtimes/oneapi-tbb/env/vars.sh ]; then
239+
source /runtimes/oneapi-tbb/env/vars.sh;
240+
elif [ -e /opt/runtimes/oneapi-tbb/env/vars.sh ]; then
241+
source /opt/runtimes/oneapi-tbb/env/vars.sh;
242+
else
243+
echo "no TBB vars in /opt/runtimes or /runtimes";
244+
fi
245+
env | sort > env_after
246+
comm -13 env_before env_after >> $GITHUB_ENV
247+
rm env_before env_after
248+
- name: Download SYCL toolchain
249+
if: inputs.sycl_toolchain_artifact != '' && github.event_name != 'workflow_run'
250+
uses: actions/download-artifact@v4
251+
with:
252+
name: ${{ inputs.sycl_toolchain_artifact }}
253+
- name: Debug prints [workflow_run]
254+
if: inputs.sycl_toolchain_artifact != '' && github.event_name == 'workflow_run'
255+
run: |
256+
pwd
257+
ls
258+
- name: Download SYCL toolchain [workflow_run]
259+
if: inputs.sycl_toolchain_artifact != '' && github.event_name == 'workflow_run'
260+
uses: actions/github-script@v7
261+
with:
262+
script: |
263+
const name = '${{ inputs.sycl_toolchain_artifact }}'
264+
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
265+
owner: context.repo.owner,
266+
repo: context.repo.repo,
267+
run_id: context.payload.workflow_run.id,
268+
});
269+
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
270+
return artifact.name == name
271+
})[0];
272+
let download = await github.rest.actions.downloadArtifact({
273+
owner: context.repo.owner,
274+
repo: context.repo.repo,
275+
artifact_id: matchArtifact.id,
276+
archive_format: 'zip',
277+
});
278+
let fs = require('fs');
279+
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/` + name + '.zip', Buffer.from(download.data));
280+
- name: Unzip artifact [workflow_run]
281+
if: inputs.sycl_toolchain_artifact != '' && github.event_name == 'workflow_run'
282+
run: |
283+
pwd
284+
ls
285+
unzip ${{ inputs.sycl_toolchain_artifact }}.zip
286+
rm ${{ inputs.sycl_toolchain_artifact }}.zip
287+
- name: Extract/Setup SYCL toolchain
288+
if: inputs.sycl_toolchain_artifact != ''
289+
run: |
290+
mkdir toolchain
291+
tar -I '${{ inputs.sycl_toolchain_decompress_command }}' -xf ${{ inputs.sycl_toolchain_archive }} -C toolchain
292+
rm -f ${{ inputs.sycl_toolchain_archive }}
293+
echo PATH=$PWD/toolchain/bin/:$PATH >> $GITHUB_ENV
294+
echo LD_LIBRARY_PATH=$PWD/toolchain/lib/:$LD_LIBRARY_PATH >> $GITHUB_ENV
295+
- run: which clang++ sycl-ls
296+
- run: sycl-ls --verbose
297+
- run: SYCL_UR_TRACE=1 sycl-ls
298+
- run: |
299+
if [ -f /usr/local/lib/igc/IGCTAG.txt ]; then
300+
cat /usr/local/lib/igc/IGCTAG.txt
301+
fi
302+
303+
- name: Run E2E Tests
304+
if: inputs.tests_selector == 'e2e'
305+
uses: ./devops/actions/run-tests/e2e
306+
with:
307+
ref: ${{ inputs.ref || github.sha }}
308+
binaries_artifact: ${{ inputs.e2e_binaries_artifact }}
309+
testing_mode: ${{ inputs.e2e_testing_mode }}
310+
extra_cmake_args: ${{ inputs.extra_cmake_args }}
311+
target_devices: ${{ inputs.target_devices }}
312+
extra_lit_opts: ${{ inputs.extra_lit_opts }}
313+
retention-days: ${{ inputs.retention-days }}
314+
315+
- name: Run SYCL CTS Tests
316+
if: inputs.tests_selector == 'cts'
317+
uses: ./devops/actions/run-tests/cts
318+
with:
319+
extra_cmake_args: ${{ inputs.extra_cmake_args }}
320+
cts_testing_mode: ${{ inputs.cts_testing_mode }}
321+
sycl_cts_artifact: ${{ inputs.sycl_cts_artifact }}
322+
target_devices: ${{ inputs.target_devices }}
323+
retention-days: ${{ inputs.retention-days }}
324+
325+
- name: Run compute-benchmarks on SYCL
326+
if: inputs.tests_selector == 'compute-benchmarks'
327+
uses: ./devops/actions/run-tests/benchmark
328+
with:
329+
target_devices: ${{ inputs.target_devices }}
330+
env:
331+
RUNNER_TAG: ${{ inputs.runner }}
332+
GITHUB_TOKEN: ${{ secrets.LLVM_SYCL_BENCHMARK_TOKEN }}

0 commit comments

Comments
 (0)