Skip to content

Commit

Permalink
Add a way to run specific tests on the CI
Browse files Browse the repository at this point in the history
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]".
  • Loading branch information
smarter committed Nov 19, 2020
1 parent 947fb5b commit 9f80cdf
Showing 1 changed file with 59 additions and 30 deletions.
89 changes: 59 additions & 30 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ jobs:
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
if: "(
github.event_name == 'push' &&
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
) ||
github.event_name == 'schedule')"
if: "github.event_name != 'pull_request'
|| (
!contains(github.event.head_commit.message, '[skip ci]')
&& (
contains(github.event.head_commit.message, '[test_non_bootstrapped]')
|| (github.event_name == 'push' && !startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))
)
)"
steps:
- name: Set JDK 15 as default
run: echo "/usr/lib/jvm/java-15-openjdk-amd64/bin" >> $GITHUB_PATH
Expand Down Expand Up @@ -52,8 +55,11 @@ jobs:
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
if: "!(github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))"
if: "github.event_name == 'schedule'
|| (
!contains(github.event.head_commit.message, '[skip ci]')
&& !(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))
)"

steps:
- name: Set JDK 15 as default
Expand All @@ -78,8 +84,12 @@ jobs:
test_windows:
runs-on: [self-hosted, Windows]
if: "!(github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))"
if: "github.event_name == 'schedule'
|| (
!contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.head_commit.message, '[skip test_windows]')
&& !(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/sbt-dotty-'))
)"

steps:
- name: Git Checkout
Expand All @@ -101,6 +111,11 @@ jobs:
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
if: "github.event_name == 'schedule'
|| (
!contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.head_commit.message, '[skip community_build]')
)"

steps:
- name: Checkout cleanup script
Expand Down Expand Up @@ -129,6 +144,11 @@ jobs:
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
if: "github.event_name == 'schedule'
|| (
!contains(github.event.head_commit.message, '[skip ci]')
&& !contains(github.event.head_commit.message, '[skip community_build]')
)"

steps:
- name: Checkout cleanup script
Expand Down Expand Up @@ -157,11 +177,14 @@ jobs:
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
if: (
github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/')
) ||
github.event_name == 'schedule'
if: "github.event_name == 'schedule'
|| (
!contains(github.event.head_commit.message, '[skip ci]')
&& (
contains(github.event.head_commit.message, '[test_sbt]')
|| (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/'))
)
)"

steps:
- name: Checkout cleanup script
Expand All @@ -188,12 +211,18 @@ jobs:
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache

if: "(
github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/') &&
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
) ||
github.event_name == 'schedule'"
if: "github.event_name == 'schedule'
|| (
!contains(github.event.head_commit.message, '[skip ci]')
&& (
contains(github.event.head_commit.message, '[test_java8]')
|| (
github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/')
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
)
)
)"

steps:
- name: Set JDK 8 as default
Expand Down Expand Up @@ -225,7 +254,7 @@ jobs:
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
needs: [test_non_bootstrapped, test, community_build_a, community_build_b, test_sbt, test_java8]
if: github.event_name == 'schedule'
if: "github.event_name == 'schedule'"
env:
NIGHTLYBUILD: yes
PGP_PW: ${{ secrets.PGP_PW }} # PGP passphrase
Expand Down Expand Up @@ -259,7 +288,7 @@ jobs:
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
needs: [publish_nightly]
if: github.event_name == 'schedule'
if: "github.event_name == 'schedule'"
env:
NIGHTLYBUILD: yes
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} # If you need to change this:
Expand Down Expand Up @@ -300,9 +329,9 @@ jobs:
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
needs: [test_non_bootstrapped, test, community_build_a, community_build_b, test_sbt, test_java8]
if: github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/') &&
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
if: "github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/')
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"

env:
RELEASEBUILD: yes
Expand Down Expand Up @@ -382,9 +411,9 @@ jobs:
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
needs: [publish_release]
if: github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/') &&
!startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
if: "github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/')
&& !startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"

env:
RELEASEBUILD: yes
Expand Down Expand Up @@ -426,8 +455,8 @@ jobs:
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
needs: [community_build_a, community_build_b, test_sbt]
if: github.event_name == 'push' &&
startsWith(github.event.ref, 'refs/tags/sbt-dotty-')
if: "github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags/sbt-dotty-')"

env:
RELEASEBUILD: yes
Expand Down

0 comments on commit 9f80cdf

Please sign in to comment.