Skip to content

Commit 2e6f732

Browse files
[CI] Move lint job to self-hosted runner (#9844)
Github's allocation of default ubuntu-* runners isn't reliably stable, so keep moving tasks to self hosted runners. We don't use the cuda runner currently, so assign those to it for the time being. Later we should be able to extend those utility tasks to run on generic `Linux` class of self-hosted runners.
1 parent 36e6e06 commit 2e6f732

File tree

2 files changed

+36
-8
lines changed

2 files changed

+36
-8
lines changed

.github/workflows/sycl_precommit.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,42 @@ jobs:
3131
uses: ./.github/workflows/sycl_detect_changes.yml
3232

3333
lint:
34-
runs-on: ubuntu-22.04
34+
runs-on: cuda
3535
container:
3636
image: ghcr.io/intel/llvm/sycl_ubuntu2204_nightly:no-drivers
37+
# actions/checkout fails without "--privileged".
38+
options: -u 1001:1001 --privileged
3739
steps:
40+
- name: Fake actions/checkout task
41+
uses: actions/checkout@v3
42+
with:
43+
# cached_checkout below uses actions/checkout internally. However, when
44+
# actions/checkout is run from within another action step (not from
45+
# workflow), github seems to try to download from within the container
46+
# and doesn't have requried filesystem permissions. Make sure it's
47+
# already downloaded by the time it's needed by checking out some small
48+
# repository.
49+
repository: actions/checkout
50+
path: fake-checkout
3851
- name: 'PR commits + 1'
3952
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
40-
- uses: actions/checkout@v3
53+
- name: Setup action
54+
# We can switch to `cp -r /actions .` once changes in cached_checkout are
55+
# propagated into the nightly container image.
56+
run: |
57+
mkdir -p actions/cached_checkout
58+
wget raw.githubusercontent.com/intel/llvm/sycl/devops/actions/cached_checkout/action.yml -P ./actions/cached_checkout
59+
- uses: ./actions/cached_checkout
4160
with:
42-
ref: ${{ github.event.pull_request.head.sha }}
43-
persist-credentials: false
61+
path: src
4462
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
63+
ref: ${{ github.event.pull_request.head.sha }}
64+
cache_path: "/__w/repo_cache/"
65+
merge: false
4566
- name: Run clang-format
46-
uses: ./devops/actions/clang-format
67+
uses: ./src/devops/actions/clang-format
68+
with:
69+
path: src
4770

4871
# This job generates matrix of tests for SYCL End-to-End tests
4972
test_matrix:

devops/actions/clang-format/action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
name: 'clang-format'
22
description: 'Run clang-format on pull request'
3+
inputs:
4+
path:
5+
description: Path to the checkout
6+
required: true
7+
38
runs:
49
using: "composite"
510
steps:
611
- name: Run clang-format for the patch
712
shell: bash {0}
813
run: |
9-
git config --global --add safe.directory /__w/llvm/llvm
10-
git clang-format ${{ github.event.pull_request.base.sha }}
11-
git diff > ./clang-format.patch
14+
git config --global --add safe.directory ${{ inputs.path }}
15+
git -C ${{ inputs.path }} clang-format ${{ github.event.pull_request.base.sha }}
16+
git -C ${{ inputs.path }} diff > ./clang-format.patch
1217
# Add patch with formatting fixes to CI job artifacts
1318
- uses: actions/upload-artifact@v1
1419
with:

0 commit comments

Comments
 (0)