Skip to content

Merge pull request #878 from steffenlarsen/steffen/fix_multi_dev_kb #2641

Merge pull request #878 from steffenlarsen/steffen/fix_multi_dev_kb

Merge pull request #878 from steffenlarsen/steffen/fix_multi_dev_kb #2641

Workflow file for this run

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: b209b321b5a8540263af9ba317c89a1882f06120
- 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: b209b321b5a8540263af9ba317c89a1882f06120
- 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