Skip to content

Commit 90d0d95

Browse files
committed
do not run if old commit
1 parent dc6c35a commit 90d0d95

File tree

1 file changed

+39
-13
lines changed

1 file changed

+39
-13
lines changed

.github/workflows/sycl-rel-nightly.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,40 @@ name: SYCL Release Branch Nightly
22

33
on:
44
workflow_dispatch:
5-
# TODO: we need to skip the whole workflow if it was launched by cron job, but
6-
# there were no new commits since the last cron run.
7-
# schedule:
8-
# - cron: '0 3 * * *'
5+
schedule:
6+
- cron: '0 3 * * *'
97

108
permissions: read-all
119

10+
env:
11+
# NOTE: so that GitHub Actions can trigger the scheduled workflow run - the
12+
# workflow file should be on the default branch. Therefore every job should
13+
# checkout the release branch.
14+
SYCL_REL_BRANCH: "draft-sycl-rel-6_0_0"
15+
1216
jobs:
17+
# To avoid unnecessary scheduled runs this job checks if there are new commits
18+
# since the last run. More precisely, it checks if the last commit is older
19+
# than 24h. That means the previous Nightly already tested this commit.
20+
check_for_new_commits:
21+
runs-on: ubuntu-latest
22+
name: Check for new commits
23+
outputs:
24+
is_new_commit: ${{ steps.is_new_commit.outputs.is_new_commit }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
ref: ${{ env.SYCL_REL_BRANCH }}
29+
run: |
30+
git show --quiet | tee -a $GITHUB_STEP_SUMMARY
31+
32+
- id: is_new_commit
33+
if: ${{ github.event_name == 'schedule' }}
34+
run: test -z $(git rev-list --after="24 hours" HEAD) && echo "::set-output name=is_new_commit::false"
35+
1336
ubuntu2204_build:
14-
if: github.repository == 'intel/llvm'
37+
needs: [check_for_new_commits]
38+
if: ${{ github.repository == 'intel/llvm' && needs.check_for_new_commits.outputs.is_new_commit != 'false' }}
1539
uses: ./.github/workflows/sycl-linux-build.yml
1640
secrets: inherit
1741
with:
@@ -20,7 +44,7 @@ jobs:
2044
build_configure_extra_args: '--hip --cuda'
2145
merge_ref: ''
2246
retention-days: 90
23-
branch: draft-sycl-rel-6_0_0
47+
ref: ${{ env.SYCL_REL_BRANCH }}
2448

2549
# We upload the build for people to download/use, override its name and
2650
# prefer widespread gzip compression.
@@ -88,21 +112,22 @@ jobs:
88112
tests_selector: ${{ matrix.tests_selector }}
89113
extra_lit_opts: ${{ matrix.extra_lit_opts }}
90114
reset_intel_gpu: ${{ matrix.reset_intel_gpu }}
91-
ref: draft-sycl-rel-6_0_0
115+
ref: ${{ env.SYCL_REL_BRANCH }}
92116
merge_ref: ''
93117
sycl_toolchain_artifact: sycl_linux_default
94118
sycl_toolchain_archive: ${{ needs.ubuntu2204_build.outputs.artifact_archive_name }}
95119
sycl_toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }}
96120

97121
build-win:
122+
needs: [check_for_new_commits]
123+
if: ${{ github.repository == 'intel/llvm' && needs.check_for_new_commits.outputs.is_new_commit != 'false' }}
98124
uses: ./.github/workflows/sycl-windows-build.yml
99-
if: github.repository == 'intel/llvm'
100125
with:
101126
retention-days: 90
102127
# We upload both Linux/Windows build via Github's "Releases"
103128
# functionality, make sure Linux/Windows names follow the same pattern.
104129
artifact_archive_name: sycl_windows.tar.gz
105-
build_ref: draft-sycl-rel-6_0_0
130+
build_ref: ${{ env.SYCL_REL_BRANCH }}
106131

107132
e2e-win:
108133
needs: build-win
@@ -117,7 +142,7 @@ jobs:
117142
runner: '["Windows","gen12"]'
118143
sycl_toolchain_archive: ${{ needs.build-win.outputs.artifact_archive_name }}
119144
extra_lit_opts: --param gpu-intel-gen12=True
120-
ref: draft-sycl-rel-6_0_0
145+
ref: ${{ env.SYCL_REL_BRANCH }}
121146

122147
cuda-aws-start:
123148
needs: [ubuntu2204_build]
@@ -126,7 +151,7 @@ jobs:
126151
secrets: inherit
127152
with:
128153
mode: start
129-
ref: draft-sycl-rel-6_0_0
154+
ref: ${{ env.SYCL_REL_BRANCH }}
130155

131156
cuda-run-tests:
132157
needs: [ubuntu2204_build, cuda-aws-start]
@@ -138,7 +163,7 @@ jobs:
138163
image: ghcr.io/intel/llvm/ubuntu2204_build:latest-0300ac924620a51f76c4929794637b82790f12ab
139164
image_options: -u 1001 --gpus all --cap-add SYS_ADMIN --env NVIDIA_DISABLE_REQUIRE=1
140165
target_devices: ext_oneapi_cuda:gpu
141-
ref: draft-sycl-rel-6_0_0
166+
ref: ${{ env.SYCL_REL_BRANCH }}
142167
merge_ref: ''
143168

144169
sycl_toolchain_artifact: sycl_linux_default
@@ -240,4 +265,5 @@ jobs:
240265
# base_tag=latest
241266
# tags: |
242267
# ghcr.io/${{ github.repository }}/sycl_ubuntu2204_nightly:build-${{ github.sha }}
243-
# ghcr.io/${{ github.repository }}/sycl_ubuntu2204_nightly:build
268+
# ghcr.io/${{ github.repository }}/sycl_ubuntu2204_nightly:build
269+

0 commit comments

Comments
 (0)