Skip to content

Commit 657baee

Browse files
author
Alexander Batashev
authored
[CI] Enable GitHub Actions in pre-commit (#4850)
Enable basic SYCL build and in-tree LIT tests on GitHub Actions in pre-commit as an experiment
1 parent 3b17da6 commit 657baee

File tree

3 files changed

+53
-30
lines changed

3 files changed

+53
-30
lines changed

.github/workflows/clang-format.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/sycl_precommit.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: SYCL
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- sycl
7+
8+
jobs:
9+
lint:
10+
# TODO use nightly builds of SYCL to get clang-format
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Get clang-format first
14+
run: sudo apt-get install -yqq clang-format
15+
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 2
19+
20+
- name: Run clang-format
21+
uses: ./devops/actions/clang-format
22+
23+
linux_default:
24+
name: Default Linux
25+
# Only build and test patches, that have passed all linter checks, because
26+
# the next commit is likely to be a follow-up on that job.
27+
needs: lint
28+
if: always() && (success() || contains(github.event.pull_request.labels.*.name, 'ignore-lint'))
29+
uses: intel/llvm/.github/workflows/sycl_linux_build_and_test.yml@sycl
30+
with:
31+
build_runs_on: "sycl-precommit-linux"
32+
build_cache_root: "/__w/"
33+
build_cache_size: "8G"
34+
build_artifact_suffix: "default"
35+
build_cache_suffix: "default"
36+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'clang-format'
2+
description: 'Run clang-format on pull request'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Run clang-format for the patch
7+
shell: bash
8+
run: |
9+
git diff --no-color ${GITHUB_SHA}^1 ${GITHUB_SHA} --name-only -- | grep -v "/test/" | xargs git diff -U0 --no-color ${GITHUB_SHA}^1 ${GITHUB_SHA} -- | ./clang/tools/clang-format/clang-format-diff.py -p1 -binary clang-format > ./clang-format.patch
10+
# Add patch with formatting fixes to CI job artifacts
11+
- uses: actions/upload-artifact@v1
12+
with:
13+
name: clang-format-patch
14+
path: ./clang-format.patch
15+
- name: Check if clang-format patch is empty
16+
shell: bash
17+
run: bash -c "if [ -s ./clang-format.patch ]; then cat ./clang-format.patch; exit 1; fi"

0 commit comments

Comments
 (0)