-
Notifications
You must be signed in to change notification settings - Fork 81
185 lines (178 loc) · 6.91 KB
/
cts_ci.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
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
name: SYCL CTS CI
on:
pull_request:
workflow_dispatch:
push:
branches:
# Run on our default base branch to prime ccache for faster CI runs in PRs.
- SYCL-2020
jobs:
# Pushing container images requires DockerHub credentials, provided as GitHub secrets.
# Secrets are not available for runs triggered from external branches (forks).
check-secrets:
runs-on: ubuntu-20.04
outputs:
available: ${{ steps.check.outputs.available }}
steps:
- name: Check whether secrets are available
id: check
run: |
SECRET=${{ secrets.DOCKERHUB_TOKEN }}
echo "available=${SECRET:+yes}" >> $GITHUB_OUTPUT
build-common-base-image:
needs: check-secrets
if: needs.check-secrets.outputs.available == 'yes'
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build common base image
uses: docker/build-push-action@v4
with:
context: docker/common
push: true
tags: khronosgroup/sycl-cts-ci:common
cache-from: type=registry,ref=khronosgroup/sycl-cts-ci:common
cache-to: type=inline
build-image-for-sycl-impl:
needs: build-common-base-image
runs-on: ubuntu-20.04
strategy:
fail-fast: false
# NB: Don't forget to update versions in compile-cts step as well
matrix:
include:
- sycl-impl: dpcpp
version: c4db251179dcd1b30a1043d4780634dbe39b3e3a
- sycl-impl: hipsycl
version: 3d8b1cd
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build SYCL container image
uses: docker/build-push-action@v4
with:
context: docker/${{ matrix.sycl-impl }}
push: true
tags: khronosgroup/sycl-cts-ci:${{ matrix.sycl-impl }}-${{ matrix.version }}
cache-from: type=registry,ref=khronosgroup/sycl-cts-ci:${{ matrix.sycl-impl }}-${{ matrix.version }}
cache-to: type=inline
build-args: |
IMPL_VERSION=${{ matrix.version }}
check-clang-format:
if: github.event_name == 'pull_request'
runs-on: "ubuntu-22.04"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Need to check out base branch as well
- name: Run clang-format on changed files
run: |
set -o errexit -o pipefail -o noclobber -o nounset
DIFF=$( git diff -U0 --no-color ${{ github.event.pull_request.base.sha }} | clang-format-diff-14 -p1 )
if [ ! -z "$DIFF" ]; then
echo 'The following changes are not formatted according to `clang-format`:' >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "$DIFF" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "Not all files are formatted according to clang-format. See workflow summary for details."
exit 1 # Fail CI run
fi
compile-cts:
needs: build-image-for-sycl-impl
# Wait for Docker image builds, but run even if they're skipped
if: always()
runs-on: ubuntu-20.04
strategy:
fail-fast: false
# NB: Don't forget to update versions in build-image-for-sycl-impl step as well
matrix:
include:
- sycl-impl: dpcpp
version: c4db251179dcd1b30a1043d4780634dbe39b3e3a
- sycl-impl: hipsycl
version: 3d8b1cd
env:
container-workspace: /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
parallel-build-jobs: 2
container:
image: khronosgroup/sycl-cts-ci:${{ matrix.sycl-impl }}-${{ matrix.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Configure CMake
working-directory: ${{ env.container-workspace }}
run: |
bash /scripts/configure.sh \
-DSYCL_CTS_EXCLUDE_TEST_CATEGORIES="${{ env.container-workspace }}/ci/${{ matrix.sycl-impl }}.filter" \
-DSYCL_CTS_MEASURE_BUILD_TIMES=ON
- name: Set up ccache
uses: actions/cache@v3
with:
path: ${{ env.container-workspace }}/.ccache
key: ${{ matrix.sycl-impl }}-ccache-${{ github.sha }}
restore-keys: |
${{ matrix.sycl-impl }}-ccache-
# Use ccache's "depend mode" to work around DPC++ issue (see https://github.com/intel/llvm/issues/5260)
# This requires compilation with -MD, which is enabled because we use the Ninja generator
# Using this mode should not have any practical disadvantages
- name: Set ccache environment variables
run: |
echo "CCACHE_DEPEND=1" >> "$GITHUB_ENV"
echo "CCACHE_DIR=${{ env.container-workspace }}/.ccache" >> "$GITHUB_ENV"
- name: Build 'oclmath'
working-directory: ${{ env.container-workspace }}/build
run: cmake --build . --target oclmath
- name: Build 'util'
working-directory: ${{ env.container-workspace }}/build
run: cmake --build . --target util
- name: Build all supported test categories
working-directory: ${{ env.container-workspace }}/build
run: |
TS_BEFORE=$(date +%s)
cmake --build . --target test_all --parallel ${{ env.parallel-build-jobs }}
TS_AFTER=$(date +%s)
ELAPSED=$(($TS_AFTER - $TS_BEFORE))
sort --numeric-sort --reverse --output=build_times.log build_times.log
echo "Total time: $( date --date=@$ELAPSED --utc '+%-Hh %-Mm %-Ss' )" >> build_times.log
- name: Upload build times artifact
uses: actions/upload-artifact@v3
with:
name: build-times-${{ matrix.sycl-impl }}
path: ${{ env.container-workspace }}/build/build_times.log
# This job simply summarizes the results of the "compile-cts" matrix build job above.
# It can then be used in a branch protection rule instead of having to enumerate all
# entries of the matrix manually (and having to update it whenever the matrix changes).
cts-compiles-for-all-implementations:
needs: [compile-cts]
if: always()
runs-on: ubuntu-22.04
steps:
- name: Summarize matrix build results
run: |
if [[ "${{ needs.compile-cts.result }}" == "success" ]]; then
exit 0
else
exit 1
fi