-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from jtx1999/it
Add it and report coverage
- Loading branch information
Showing
37 changed files
with
786 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Report coverage | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' # any branch | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '8' | ||
|
||
- name: Build with Maven | ||
run: mvn -B verify --file pom.xml | ||
|
||
- name: Merge coverage | ||
run: mvn jacoco:merge@merge-id -pl starts-core | ||
|
||
- name: Report | ||
run: mvn jacoco:report@report-id -pl starts-core | ||
|
||
- name: Generate JaCoCo Badge | ||
id: jacoco | ||
uses: cicirello/jacoco-badge-generator@v2 | ||
with: | ||
jacoco-csv-file: starts-core/target/site/jacoco-merged/jacoco.csv | ||
generate-branches-badge: true | ||
|
||
- name: Log coverage percentage | ||
run: | | ||
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | ||
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | ||
# Getting: RequestError [HttpError]: Resource not accessible by integration | ||
# - name: Add comment to PR | ||
# uses: actions/github-script@v4 | ||
# if: ${{ github.event_name == 'pull_request' }} | ||
# with: | ||
# github-token: ${{secrets.GITHUB_TOKEN}} | ||
# script: | | ||
# github.issues.createComment({ | ||
# issue_number: context.issue.number, | ||
# owner: context.repo.owner, | ||
# repo: context.repo.repo, | ||
# body: 'Statement coverage = ${{ steps.jacoco.outputs.coverage }}\n\nBranch coverage = ${{ steps.jacoco.outputs.branches }}' | ||
# }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>starts.plugin.it</groupId> | ||
<artifactId>parent-pom</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<relativePath>../parent-pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>multilevel-interfaces-it</artifactId> | ||
<description>This integration test checks that the tests selected are only those | ||
that reach a changed class or it's subclasses, but neither tests of | ||
unrelated siblings nor superclasses.</description> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
import edu.illinois.starts.jdeps.SetupUtil; | ||
|
||
setupUtil = new SetupUtil(new File(basedir, ".starts/deps.zlc")) | ||
file = new File(basedir, "src/main/java/inter/BaseB.java"); | ||
setupUtil.replaceAllInFile(file, "List", "ArrayList") |
11 changes: 11 additions & 0 deletions
11
starts-plugin/src/it/multilevel-interfaces-it/src/main/java/inter/BaseA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
package inter; | ||
|
||
import java.util.List; | ||
|
||
public interface BaseA { | ||
public List<String> toStringsBaseA(); | ||
} |
7 changes: 7 additions & 0 deletions
7
starts-plugin/src/it/multilevel-interfaces-it/src/main/java/inter/BaseB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package inter; | ||
|
||
import java.util.List; | ||
|
||
public interface BaseB { | ||
public List<String> toStringsBaseB(); | ||
} |
21 changes: 21 additions & 0 deletions
21
starts-plugin/src/it/multilevel-interfaces-it/src/main/java/inter/Child.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
package inter; | ||
|
||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
public class Child implements BaseA, BaseB { | ||
@Override | ||
public ArrayList<String> toStringsBaseA() { | ||
return new ArrayList<>(Arrays.asList("BaseA", "child")); | ||
} | ||
|
||
@Override | ||
public ArrayList<String> toStringsBaseB() { | ||
return new ArrayList<>(Arrays.asList("BaseB", "child")); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
starts-plugin/src/it/multilevel-interfaces-it/src/main/java/inter/GrandChild.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
package inter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
public class GrandChild extends Child { | ||
@Override | ||
public ArrayList<String> toStringsBaseA(){ | ||
return new ArrayList<>(Arrays.asList("BaseA", "GrandChild")); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
starts-plugin/src/it/multilevel-interfaces-it/src/main/java/inter/Sibling.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
package inter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
public class Sibling implements BaseA { | ||
|
||
@Override | ||
public ArrayList<String> toStringsBaseA() { | ||
return new ArrayList<>(Arrays.asList("sibling")); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
starts-plugin/src/it/multilevel-interfaces-it/src/test/java/inter/ChildTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
package inter; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
public class ChildTest { | ||
@Test | ||
public void test() { | ||
assertEquals("1", new ArrayList<>(Arrays.asList("BaseA", "child")), new Child().toStringsBaseA()); | ||
assertEquals("2", new ArrayList<>(Arrays.asList("BaseB", "child")), new Child().toStringsBaseB()); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
starts-plugin/src/it/multilevel-interfaces-it/src/test/java/inter/GrandChildTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
package inter; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Set; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
public class GrandChildTest { | ||
@Test | ||
public void test() { | ||
assertEquals("1", new ArrayList<>(Arrays.asList("BaseA", "GrandChild")), new GrandChild().toStringsBaseA()); | ||
assertEquals("2", new ArrayList<>(Arrays.asList("BaseB", "child")), new GrandChild().toStringsBaseB()); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
starts-plugin/src/it/multilevel-interfaces-it/src/test/java/inter/SiblingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
package inter; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Set; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
public class SiblingTest { | ||
@Test | ||
public void test() { | ||
assertEquals("1", new ArrayList<>(Arrays.asList("sibling")), new Sibling().toStringsBaseA()); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
starts-plugin/src/it/multilevel-interfaces-it/verify.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
import edu.illinois.starts.jdeps.VerifyUtil; | ||
|
||
firstRun = new File(basedir, "first-run.txt"); | ||
verifyUtil = new VerifyUtil(new File(basedir, "build.log")); | ||
|
||
if (!firstRun.exists()) { | ||
firstRun.createNewFile(); | ||
verifyUtil.assertCorrectlyAffected("3"); | ||
verifyUtil.assertContains("Running inter.ChildTest"); | ||
verifyUtil.assertContains("Running inter.SiblingTest"); | ||
verifyUtil.assertContains("Running inter.GrandChildTest"); | ||
} else { | ||
verifyUtil.assertCorrectlyAffected("2"); | ||
verifyUtil.assertContains("Running inter.ChildTest"); | ||
verifyUtil.assertNotContains("Running inter.SiblingTest"); | ||
verifyUtil.assertContains("Running inter.GrandChildTest"); | ||
verifyUtil.deleteFile(firstRun); | ||
verifyUtil.deleteFile(new File(basedir, ".starts/deps.zlc")); | ||
} |
48 changes: 48 additions & 0 deletions
48
starts-plugin/src/it/multilevel-no-parents-or-siblings-clz-it/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>starts.plugin.it</groupId> | ||
<artifactId>parent-pom</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<relativePath>../parent-pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>multilevel-no-parents-or-siblings-it</artifactId> | ||
<description>This integration test checks that the tests selected are only those | ||
that reach a changed class or it's subclasses, but neither tests of | ||
unrelated siblings nor superclasses.</description> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>touch</id> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>starts</goal> | ||
</goals> | ||
<configuration> | ||
<depFormat>CLZ</depFormat> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.19.1</version> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
9 changes: 9 additions & 0 deletions
9
starts-plugin/src/it/multilevel-no-parents-or-siblings-clz-it/setup.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright (c) 2015 - Present. The STARTS Team. All Rights Reserved. | ||
*/ | ||
|
||
import edu.illinois.starts.jdeps.SetupUtil; | ||
|
||
setupUtil = new SetupUtil(new File(basedir, ".starts/deps.zlc")) | ||
file = new File(basedir, "src/main/java/inter/Child.java"); | ||
setupUtil.replaceAllInFile(file, "Set<Integer>", "Set") |
Oops, something went wrong.