Skip to content

Commit 9f80cdf

Browse files
committed
Add a way to run specific tests on the CI
With this commit, the CI will look for some magic strings in commit messages to decide what tests to run, for example if "[test_non_bootstrapped]" anywhere in the commit message of a PR, the non-bootstrapped tests will be run on top of the normal tests we run for PRs. It's also possible for example to turn off the windows tests with "[skip test_windows]".
1 parent 947fb5b commit 9f80cdf

File tree

1 file changed

+59
-30
lines changed

1 file changed

+59
-30
lines changed

.github/workflows/ci.yaml

+59-30
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ jobs:
1818
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
1919
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
2020
- ${{ github.workspace }}/../../cache/general:/root/.cache
21-
if: "(
22-
github.event_name == 'push' &&
23-
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
24-
) ||
25-
github.event_name == 'schedule')"
21+
if: "github.event_name != 'pull_request'
22+
|| (
23+
!contains(github.event.head_commit.message, '[skip ci]')
24+
&& (
25+
contains(github.event.head_commit.message, '[test_non_bootstrapped]')
26+
|| (github.event_name == 'push' && !startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))
27+
)
28+
)"
2629
steps:
2730
- name: Set JDK 15 as default
2831
run: echo "/usr/lib/jvm/java-15-openjdk-amd64/bin" >> $GITHUB_PATH
@@ -52,8 +55,11 @@ jobs:
5255
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
5356
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
5457
- ${{ github.workspace }}/../../cache/general:/root/.cache
55-
if: "!(github.event_name == 'push' &&
56-
startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))"
58+
if: "github.event_name == 'schedule'
59+
|| (
60+
!contains(github.event.head_commit.message, '[skip ci]')
61+
&& !(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))
62+
)"
5763

5864
steps:
5965
- name: Set JDK 15 as default
@@ -78,8 +84,12 @@ jobs:
7884
7985
test_windows:
8086
runs-on: [self-hosted, Windows]
81-
if: "!(github.event_name == 'push' &&
82-
startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))"
87+
if: "github.event_name == 'schedule'
88+
|| (
89+
!contains(github.event.head_commit.message, '[skip ci]')
90+
&& !contains(github.event.head_commit.message, '[skip test_windows]')
91+
&& !(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))
92+
)"
8393

8494
steps:
8595
- name: Git Checkout
@@ -101,6 +111,11 @@ jobs:
101111
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
102112
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
103113
- ${{ github.workspace }}/../../cache/general:/root/.cache
114+
if: "github.event_name == 'schedule'
115+
|| (
116+
!contains(github.event.head_commit.message, '[skip ci]')
117+
&& !contains(github.event.head_commit.message, '[skip community_build]')
118+
)"
104119

105120
steps:
106121
- name: Checkout cleanup script
@@ -129,6 +144,11 @@ jobs:
129144
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
130145
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
131146
- ${{ github.workspace }}/../../cache/general:/root/.cache
147+
if: "github.event_name == 'schedule'
148+
|| (
149+
!contains(github.event.head_commit.message, '[skip ci]')
150+
&& !contains(github.event.head_commit.message, '[skip community_build]')
151+
)"
132152

133153
steps:
134154
- name: Checkout cleanup script
@@ -157,11 +177,14 @@ jobs:
157177
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
158178
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
159179
- ${{ github.workspace }}/../../cache/general:/root/.cache
160-
if: (
161-
github.event_name == 'push' &&
162-
startsWith(github.event.ref, 'refs/tags/')
163-
) ||
164-
github.event_name == 'schedule'
180+
if: "github.event_name == 'schedule'
181+
|| (
182+
!contains(github.event.head_commit.message, '[skip ci]')
183+
&& (
184+
contains(github.event.head_commit.message, '[test_sbt]')
185+
|| (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/'))
186+
)
187+
)"
165188

166189
steps:
167190
- name: Checkout cleanup script
@@ -188,12 +211,18 @@ jobs:
188211
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
189212
- ${{ github.workspace }}/../../cache/general:/root/.cache
190213

191-
if: "(
192-
github.event_name == 'push' &&
193-
startsWith(github.event.ref, 'refs/tags/') &&
194-
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
195-
) ||
196-
github.event_name == 'schedule'"
214+
if: "github.event_name == 'schedule'
215+
|| (
216+
!contains(github.event.head_commit.message, '[skip ci]')
217+
&& (
218+
contains(github.event.head_commit.message, '[test_java8]')
219+
|| (
220+
github.event_name == 'push'
221+
&& startsWith(github.event.ref, 'refs/tags/')
222+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
223+
)
224+
)
225+
)"
197226

198227
steps:
199228
- name: Set JDK 8 as default
@@ -225,7 +254,7 @@ jobs:
225254
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
226255
- ${{ github.workspace }}/../../cache/general:/root/.cache
227256
needs: [test_non_bootstrapped, test, community_build_a, community_build_b, test_sbt, test_java8]
228-
if: github.event_name == 'schedule'
257+
if: "github.event_name == 'schedule'"
229258
env:
230259
NIGHTLYBUILD: yes
231260
PGP_PW: ${{ secrets.PGP_PW }} # PGP passphrase
@@ -259,7 +288,7 @@ jobs:
259288
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
260289
- ${{ github.workspace }}/../../cache/general:/root/.cache
261290
needs: [publish_nightly]
262-
if: github.event_name == 'schedule'
291+
if: "github.event_name == 'schedule'"
263292
env:
264293
NIGHTLYBUILD: yes
265294
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} # If you need to change this:
@@ -300,9 +329,9 @@ jobs:
300329
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
301330
- ${{ github.workspace }}/../../cache/general:/root/.cache
302331
needs: [test_non_bootstrapped, test, community_build_a, community_build_b, test_sbt, test_java8]
303-
if: github.event_name == 'push' &&
304-
startsWith(github.event.ref, 'refs/tags/') &&
305-
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
332+
if: "github.event_name == 'push'
333+
&& startsWith(github.event.ref, 'refs/tags/')
334+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"
306335

307336
env:
308337
RELEASEBUILD: yes
@@ -382,9 +411,9 @@ jobs:
382411
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
383412
- ${{ github.workspace }}/../../cache/general:/root/.cache
384413
needs: [publish_release]
385-
if: github.event_name == 'push' &&
386-
startsWith(github.event.ref, 'refs/tags/') &&
387-
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
414+
if: "github.event_name == 'push'
415+
&& startsWith(github.event.ref, 'refs/tags/')
416+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"
388417

389418
env:
390419
RELEASEBUILD: yes
@@ -426,8 +455,8 @@ jobs:
426455
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
427456
- ${{ github.workspace }}/../../cache/general:/root/.cache
428457
needs: [community_build_a, community_build_b, test_sbt]
429-
if: github.event_name == 'push' &&
430-
startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
458+
if: "github.event_name == 'push'
459+
&& startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"
431460

432461
env:
433462
RELEASEBUILD: yes

0 commit comments

Comments
 (0)