Skip to content

Commit

Permalink
[98] Check pull_request event to launch tests on CI
Browse files Browse the repository at this point in the history
Add a trigger for launch tests when event is  "pull_request".

Bug: cea-hpc#98
Signed-off-by: Vincent Blain <[email protected]>
  • Loading branch information
vblainobeo committed Oct 14, 2022
1 parent 9748989 commit a5b99f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class GitCommitMessageTest
@Test
def void testTitle()
{
Assume.assumeTrue(testUtils.runningOnCI())
Assume.assumeTrue(testUtils.isPush())
val lines = this.runCommand()
Assertions.assertThat(lines.size()).isGreaterThan(5)

Expand Down Expand Up @@ -131,7 +131,7 @@ class GitCommitMessageTest
@Test
def void testSignedOffBy()
{
Assume.assumeTrue(testUtils.runningOnCI())
Assume.assumeTrue(testUtils.isPush())
val lines = this.runCommand()
Assertions.assertThat(lines).filteredOn(line | line.trim().startsWith(SIGNED_OFF_BY_PREFIX)).isNotEmpty()
}
Expand Down
15 changes: 12 additions & 3 deletions tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/TestUtils.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,19 @@ class TestUtils

def runningOnCI()
{
val event = System.getenv("GITHUB_EVENT_NAME") //$NON-NLS-1$
//System.out.println(event)
return isPush() || isPullRequest()
}

return System.getenv("CI") !== null && event.equals("push") //$NON-NLS-1$ //$NON-NLS-2$
def isPush()
{
val event = System.getenv("GITHUB_EVENT_NAME") // $NON-NLS-1$
return System.getenv("CI") !== null && event.equals("push") // $NON-NLS-1$ //$NON-NLS-2$
}

def isPullRequest()
{
val event = System.getenv("GITHUB_EVENT_NAME") // $NON-NLS-1$
return System.getenv("CI") !== null && event.equals("pull_request") // $NON-NLS-1$ //$NON-NLS-2$
}

def getAllAffectations(EObject it)
Expand Down

0 comments on commit a5b99f8

Please sign in to comment.