Skip to content

Commit d221fb5

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 d221fb5

File tree

1 file changed

+80
-30
lines changed

1 file changed

+80
-30
lines changed

.github/workflows/ci.yaml

+80-30
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@ 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 == 'schedule'
22+
|| (
23+
github.event_name == 'push'
24+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
25+
)
26+
|| (
27+
github.event_name == 'pull_request'
28+
&& !contains(github.event.head_commit.message, '[skip ci]')
29+
&& contains(github.event.head_commit.message, '[test_non_bootstrapped]')
30+
)"
2631
steps:
2732
- name: Set JDK 15 as default
2833
run: echo "/usr/lib/jvm/java-15-openjdk-amd64/bin" >> $GITHUB_PATH
@@ -52,8 +57,16 @@ jobs:
5257
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
5358
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
5459
- ${{ github.workspace }}/../../cache/general:/root/.cache
55-
if: "!(github.event_name == 'push' &&
56-
startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))"
60+
if: "github.event_name == 'schedule'
61+
|| (
62+
github.event_name == 'push'
63+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
64+
)
65+
|| (
66+
github.event_name == 'pull_request'
67+
&& !contains(github.event.head_commit.message, '[skip ci]')
68+
&& !contains(github.event.head_commit.message, '[skip test]')
69+
)"
5770

5871
steps:
5972
- name: Set JDK 15 as default
@@ -78,8 +91,16 @@ jobs:
7891
7992
test_windows:
8093
runs-on: [self-hosted, Windows]
81-
if: "!(github.event_name == 'push' &&
82-
startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))"
94+
if: "github.event_name == 'schedule'
95+
|| (
96+
github.event_name == 'push'
97+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
98+
)
99+
|| (
100+
github.event_name == 'pull_request'
101+
&& !contains(github.event.head_commit.message, '[skip ci]')
102+
&& !contains(github.event.head_commit.message, '[skip test_windows]')
103+
)"
83104

84105
steps:
85106
- name: Git Checkout
@@ -101,6 +122,16 @@ jobs:
101122
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
102123
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
103124
- ${{ github.workspace }}/../../cache/general:/root/.cache
125+
if: "github.event_name == 'schedule'
126+
|| (
127+
github.event_name == 'push'
128+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
129+
)
130+
|| (
131+
github.event_name == 'pull_request'
132+
&& !contains(github.event.head_commit.message, '[skip ci]')
133+
&& !contains(github.event.head_commit.message, '[skip community_build]')
134+
)"
104135

105136
steps:
106137
- name: Checkout cleanup script
@@ -129,6 +160,15 @@ jobs:
129160
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
130161
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
131162
- ${{ github.workspace }}/../../cache/general:/root/.cache
163+
if: "github.event_name == 'schedule'
164+
|| (
165+
github.event_name == 'push'
166+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
167+
)
168+
|| (
169+
!contains(github.event.head_commit.message, '[skip ci]')
170+
&& !contains(github.event.head_commit.message, '[skip community_build]')
171+
)"
132172

133173
steps:
134174
- name: Checkout cleanup script
@@ -157,11 +197,16 @@ jobs:
157197
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
158198
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
159199
- ${{ 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'
200+
if: "github.event_name == 'schedule'
201+
|| (
202+
github.event_name == 'push'
203+
&& startsWith(github.event.ref, 'refs/tags/')
204+
)
205+
|| (
206+
github.event_name == 'pull_request'
207+
&& !contains(github.event.head_commit.message, '[skip ci]')
208+
&& contains(github.event.head_commit.message, '[test_sbt]')
209+
)"
165210

166211
steps:
167212
- name: Checkout cleanup script
@@ -188,12 +233,17 @@ jobs:
188233
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
189234
- ${{ github.workspace }}/../../cache/general:/root/.cache
190235

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'"
236+
if: "github.event_name == 'schedule'
237+
|| (
238+
github.event_name == 'push'
239+
&& startsWith(github.event.ref, 'refs/tags/')
240+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
241+
)
242+
|| (
243+
github.event_name == 'pull_request'
244+
&& !contains(github.event.head_commit.message, '[skip ci]')
245+
&& contains(github.event.head_commit.message, '[test_java8]')
246+
)"
197247

198248
steps:
199249
- name: Set JDK 8 as default
@@ -225,7 +275,7 @@ jobs:
225275
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
226276
- ${{ github.workspace }}/../../cache/general:/root/.cache
227277
needs: [test_non_bootstrapped, test, community_build_a, community_build_b, test_sbt, test_java8]
228-
if: github.event_name == 'schedule'
278+
if: "github.event_name == 'schedule'"
229279
env:
230280
NIGHTLYBUILD: yes
231281
PGP_PW: ${{ secrets.PGP_PW }} # PGP passphrase
@@ -259,7 +309,7 @@ jobs:
259309
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
260310
- ${{ github.workspace }}/../../cache/general:/root/.cache
261311
needs: [publish_nightly]
262-
if: github.event_name == 'schedule'
312+
if: "github.event_name == 'schedule'"
263313
env:
264314
NIGHTLYBUILD: yes
265315
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} # If you need to change this:
@@ -300,9 +350,9 @@ jobs:
300350
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
301351
- ${{ github.workspace }}/../../cache/general:/root/.cache
302352
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-')
353+
if: "github.event_name == 'push'
354+
&& startsWith(github.event.ref, 'refs/tags/')
355+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"
306356

307357
env:
308358
RELEASEBUILD: yes
@@ -382,9 +432,9 @@ jobs:
382432
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
383433
- ${{ github.workspace }}/../../cache/general:/root/.cache
384434
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-')
435+
if: "github.event_name == 'push'
436+
&& startsWith(github.event.ref, 'refs/tags/')
437+
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"
388438

389439
env:
390440
RELEASEBUILD: yes
@@ -426,8 +476,8 @@ jobs:
426476
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
427477
- ${{ github.workspace }}/../../cache/general:/root/.cache
428478
needs: [community_build_a, community_build_b, test_sbt]
429-
if: github.event_name == 'push' &&
430-
startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
479+
if: "github.event_name == 'push'
480+
&& startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"
431481

432482
env:
433483
RELEASEBUILD: yes

0 commit comments

Comments
 (0)