Skip to content

Commit 457ef60

Browse files
[CI] Workflow to create docker with pre-built E2E tests (#19715)
To be used for compatibility testing, i.e. running tests built with the latest released toolchain using trunk SYCL RT.
1 parent a5606c3 commit 457ef60

File tree

4 files changed

+164
-7
lines changed

4 files changed

+164
-7
lines changed

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ on:
3737

3838
repo_ref:
3939
type: string
40-
required: True
40+
required: False
4141
description: |
4242
Commit SHA or branch to checkout the intel/llvm repo.
4343
tests_ref:
@@ -60,9 +60,10 @@ on:
6060

6161
e2e_binaries_artifact:
6262
description: |
63-
Must be set if `e2e_testing_mode` is equal to `run-only` and the
64-
artifact must exist. Can be set in other modes resulting in artifact
65-
upload.
63+
When set in modes other than `run-only` results in artifact upload.
64+
For `run-only` mode, if specified, means downloading pre-built
65+
binaries from the artifact, otherwise they are expected to be part of
66+
the container.
6667
type: string
6768
default: ''
6869
required: False
@@ -156,6 +157,7 @@ on:
156157
type: choice
157158
options:
158159
- 'ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest'
160+
- 'ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_2'
159161
- 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps'
160162
image_options:
161163
description: |
@@ -205,6 +207,7 @@ on:
205207
options:
206208
- "full"
207209
- "build-only"
210+
- "run-only"
208211

209212
permissions:
210213
contents: read
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Create container with pre-built tests
2+
3+
# The purpose of this is to build E2E tests with the latest release toolchain
4+
# and then run them with the trunk SYCL RT (libsycl.so and friends) to verify
5+
# that ABI compatibility hasn't been broken.
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
ref:
11+
type: string
12+
description: tag/sha
13+
required: true
14+
default:
15+
16+
push:
17+
branches:
18+
- sycl-rel-**
19+
20+
permissions: read-all
21+
22+
jobs:
23+
build:
24+
uses: ./.github/workflows/sycl-linux-build.yml
25+
with:
26+
build_ref: ${{ inputs.ref || github.sha }}
27+
build_cache_root: "/__w/"
28+
29+
build_image: "ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest"
30+
cc: clang
31+
cxx: clang++
32+
33+
changes: '[]'
34+
35+
toolchain_artifact: toolchain
36+
toolchain_artifact_filename: toolchain.tar.zst
37+
e2e_binaries_artifact: e2e_bin
38+
39+
# Couldn't make it work from inside the container, so have to use an extra job
40+
# and pass an artifact.
41+
docker:
42+
runs-on: [Linux, build]
43+
needs: build
44+
permissions:
45+
packages: write
46+
if: always()
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
sparse-checkout: |
51+
devops/
52+
53+
- name: Checkout E2E tests
54+
uses: actions/checkout@v4
55+
with:
56+
ref: ${{ inputs.ref || github.sha }}
57+
path: llvm
58+
sparse-checkout: |
59+
llvm/utils/lit
60+
sycl/test-e2e
61+
- name: Pack sources
62+
run: |
63+
tar -I 'zstd -9' -cf devops/e2e_sources.tar.zst -C ./llvm .
64+
65+
- name: Download toolchain
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: toolchain
69+
path: devops/
70+
- name: Download E2E binaries
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: e2e_bin
74+
path: devops/
75+
76+
77+
- name: Build container
78+
uses: ./devops/actions/build_container
79+
with:
80+
push: true
81+
file: release_tests_binaries
82+
username: ${{ github.repository_owner }}
83+
password: ${{ secrets.GITHUB_TOKEN }}
84+
tags: |
85+
ghcr.io/${{ github.repository }}/sycl_prebuilt_tests:${{ inputs.ref || github.ref_name }}
86+
87+
run-e2e:
88+
# Ensure those tests can actually pass with the toolchain they were built
89+
# with, otherwise testing compatibility with those binaries is pointless.
90+
# This job should be aligned with how the image will be used in trunk CI.
91+
#
92+
# I'll start with just a single configuration, but this might be extended
93+
# with a matrix in future (e.g., to run on cpu/CUDA/AMDGPU).
94+
name: Run E2E tests with SYCL RT they were built with
95+
runs-on: [Linux, pvc]
96+
needs: [docker, build]
97+
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
98+
container:
99+
image: ghcr.io/${{ github.repository }}/sycl_prebuilt_tests:${{ inputs.ref || github.ref_name }}
100+
options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
101+
steps:
102+
- uses: actions/checkout@v4
103+
with:
104+
sparse-checkout: |
105+
devops
106+
- run: |
107+
mkdir toolchain
108+
tar -I 'zstd' -xf /sycl-prebuilt/toolchain.tar.zst -C toolchain
109+
echo LD_LIBRARY_PATH=$PWD/toolchain/lib:$LD_LIBRARY_PATH >> $GITHUB_ENV
110+
echo PATH=$PWD/toolchain/bin:$PATH >> $GITHUB_ENV
111+
- run: |
112+
sycl-ls
113+
- name: Run E2E tests
114+
uses: ./devops/actions/run-tests/e2e
115+
timeout-minutes: 20
116+
with:
117+
testing_mode: run-only
118+
target_devices: level_zero:gpu

devops/actions/run-tests/e2e/action.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,34 @@ runs:
2424
using: "composite"
2525
steps:
2626
- name: Checkout E2E tests
27+
if: ${{ !(inputs.testing_mode == 'run-only' && inputs.binaries_artifact == '') }}
2728
uses: actions/checkout@v4
2829
with:
2930
path: llvm
3031
ref: ${{ inputs.ref || github.sha }}
3132
sparse-checkout: |
3233
llvm/utils/lit
3334
sycl/test-e2e
34-
3535
- name: Download E2E Binaries
36-
if: inputs.testing_mode == 'run-only'
36+
if: ${{ inputs.testing_mode == 'run-only' && inputs.binaries_artifact != '' }}
3737
uses: actions/download-artifact@v4
3838
with:
3939
name: ${{ inputs.binaries_artifact }}
4040
- name: Extract E2E Binaries
41-
if: inputs.testing_mode == 'run-only'
41+
if: ${{ inputs.testing_mode == 'run-only' && inputs.binaries_artifact != '' }}
4242
shell: bash
4343
run: |
4444
mkdir build-e2e
4545
tar -I 'zstd' -xf e2e_binaries.tar.zst -C build-e2e
4646
47+
- name: Extract E2E tests from container image
48+
if: ${{ inputs.testing_mode == 'run-only' && inputs.binaries_artifact == '' }}
49+
shell: bash
50+
run: |
51+
mkdir build-e2e llvm
52+
tar -I 'zstd' -xf /sycl-prebuilt/e2e_binaries.tar.zst -C build-e2e
53+
tar -I 'zstd' -xf /sycl-prebuilt/e2e_sources.tar.zst -C llvm
54+
4755
- name: Deduce E2E CMake options
4856
if: inputs.testing_mode != 'run-only'
4957
id: cmake_opts
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
ARG base_tag=alldeps
2+
ARG base_image=ghcr.io/intel/llvm/ubuntu2404_intel_drivers
3+
4+
FROM $base_image:$base_tag
5+
6+
# Actual CI maps volumes via something like "/runner/host/path":"/__w/", so
7+
# these won't be visible there. They can be used when manually reproducing
8+
# issues though. Path `/__w/llvm/llvm` is the property of Github Actions and
9+
# when CMake configures E2E tests this path is hardcoded in both CMake files and
10+
# e2e binaries themselve. As such, it's useful to have these in the image for
11+
# local manual experiments.
12+
#
13+
# One can map volumes as "/host/system/new/toolchain":"/__w/llvm/llvm/toolchain"
14+
# to override the toolchain in order to run the tests with local SYCL RT instead
15+
# of using the release RT included in this image.
16+
ADD --chown=sycl:sycl toolchain.tar.zst /__w/llvm/llvm/toolchain
17+
ADD --chown=sycl:sycl e2e_binaries.tar.zst /__w/llvm/llvm/build-e2e
18+
ADD --chown=sycl:sycl e2e_sources.tar.zst /__w/llvm/llvm/llvm
19+
20+
# Since `/__w/llvm/llvm` above is overriden by GHA, need to provide the
21+
# following for using in CI:
22+
COPY e2e_binaries.tar.zst /sycl-prebuilt/
23+
COPY e2e_sources.tar.zst /sycl-prebuilt/
24+
COPY toolchain.tar.zst /sycl-prebuilt/
25+
26+
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
27+
28+
USER sycl

0 commit comments

Comments
 (0)