AWS CodeBuild Test Reports for Gradle builds
Although AWS documentation has instructions for adding Test Reports for a maven build they currently lack instructions for a gradle build.
You can find the maven instructions here: https://aws.amazon.com/blogs/devops/test-reports-with-aws-codebuild/
Assuming you have your gradle wrapper in your code commit repository, you just need to update two sections in your buildspec.yml
First, update your buildspec.yml to call the gradlew test by changing the “phases -> builds -> commands” to “bash ./gradlew test”.
Second, update the buildspec.yml to where gradle stores the test reports by changing “reports -> ReportGroupName -> base-directory” to “build/test-results”.
Here is an example of a buildspec.yml with the updates.
version: 0.2 phases: build: commands: - bash ./gradlew test reports: #New TestReports: # CodeBuild will create a report group called "TestReports". files: #Store all of the files - '**/*' base-directory: 'build/test-results' # Location of the reports cache: paths: - '/root/.gradle/**/*'