StruckCroissant / Game-DB

Game-DB is a game database search engine deployed on Docker and powered by Java Spring Boot and AngularJS
GNU General Public License v3.0
2 stars 0 forks source link

Java CI Job not running any tests #38

Closed StruckCroissant closed 2 years ago

StruckCroissant commented 2 years ago

As seen in Java CI #3 - the job is currently not running tests. Previously, there were issues with getting this job to run at all, which I could fix by adding <start-class> line to pom.xml.

<properties>
    <java.version>17</java.version>
    <start-class>com.StruckCroissant.GameDB.GameDbApplication</start-class>
</properties>

It looks like this issue could be because of a missing <testSourceDirectory> tag. For more details, see these Stack Overflow issues: https://stackoverflow.com/questions/66907650/github-ci-with-maven-testing-not-running-any-tests https://stackoverflow.com/questions/19139509/maven-project-build-testsourcedirectory-property-not-working-from-profile

StruckCroissant commented 2 years ago

adding testSourceDirectory did not resolve the issue.

StruckCroissant commented 2 years ago

Refactored Java source folder from api to src, & that 'fixed' the issue (aka there's just a different error now that shows me that the job actually sees the tests). Refactor was done in commit 144a257 - going to revert from this commit to previous commit for now because I would like to avoid a large refactor like that in favor of just overwriting the source in the pom.

see here for 'successful' build execution

StruckCroissant commented 2 years ago

Reverted refactor in 69cea3a

StruckCroissant commented 2 years ago

fixed in ade00cd - the issue was that the there were no source/test directories in the pom.

Additions:

<sourceDirectory>
            ${project.basedir}/api/main/java
        </sourceDirectory>
        <testSourceDirectory>
            ${project.basedir}/api/test/java
        </testSourceDirectory>
        <resources>
            <resource>
                <directory>
                    ${project.basedir}/api/main/resources
                </directory>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>
                    ${project.basedir}/api/test/resources
                </directory>
            </testResource>
        </testResources>
</sourceDirectory>

Successful job run:

Java CI #16