Skip to content

Commit 45e55ee

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 45e55ee

File tree

1 file changed

+49
-20
lines changed

1 file changed

+49
-20
lines changed

.github/workflows/ci.yaml

+49-20
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 == 'schedule'
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

0 commit comments

Comments
 (0)