Skip to content

Commit

Permalink
Added codecov GH action (google#973)
Browse files Browse the repository at this point in the history
  • Loading branch information
bashir2 authored Mar 5, 2024
1 parent bf8cc8a commit aa769f0
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 20 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This is based on:
# https://github.com/codecov/example-java-maven/blob/main/.github/workflows/ci.yml
name: Codecov
on: [push, pull_request]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Install dependencies
run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
- name: Run tests and collect coverage
run: mvn -B test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
# To find this token, and how it is stored in the repo, see:
# https://docs.codecov.com/docs/adding-the-codecov-token
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ COPY ./bunsen ./bunsen
COPY ./pipelines ./pipelines
COPY ./pom.xml ./pom.xml
COPY ./utils ./utils
COPY ./coverage ./coverage

# Updating license will fail in e2e and there is no point doing it here anyways.
# Note this build can be faster by excluding some uber-jars we don't copy.
Expand Down
11 changes: 0 additions & 11 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ steps:
- mvn --no-transfer-progress -e install -Dlicense.skip=true -Dspotless.apply.skip=true
waitFor: ['-']

# - name: 'gcr.io/cloud-builders/curl'
# id: 'Upload coverage reports to codecov.io'
# entrypoint: bash
# args: ['-c', 'bash <(curl -s https://codecov.io/bash)']
# env:
# - 'VCS_COMMIT_ID=$COMMIT_SHA'
# - 'VCS_BRANCH_NAME=$BRANCH_NAME'
# - 'VCS_PULL_REQUEST=$_PR_NUMBER'
# - 'CI_BUILD_ID=$BUILD_ID'
# - 'CODECOV_TOKEN=$_CODECOV_TOKEN' # This token is generated when you setup your repo on codecov: https://docs.codecov.com/docs

- name: 'gcr.io/cloud-builders/docker'
id: 'Build Uploader Image'
entrypoint: /bin/bash
Expand Down
109 changes: 109 additions & 0 deletions coverage/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2020-2023 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.google.fhir.analytics</groupId>
<artifactId>root</artifactId>
<version>0.2.7-SNAPSHOT</version>
</parent>

<groupId>org.openmrs.analytics</groupId>
<artifactId>coverage</artifactId>
<name>coverage</name>
<description>Compute aggregated test code coverage</description>
<packaging>pom</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>com.cerner.bunsen</groupId>
<artifactId>bunsen-avro</artifactId>
<version>0.5.14-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.cerner.bunsen</groupId>
<artifactId>bunsen-core</artifactId>
<version>0.5.14-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.cerner.bunsen</groupId>
<artifactId>bunsen-core-r4</artifactId>
<version>0.5.14-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.cerner.bunsen</groupId>
<artifactId>bunsen-core-stu3</artifactId>
<version>0.5.14-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.cerner.bunsen</groupId>
<artifactId>bunsen-uscore-resources</artifactId>
<version>0.5.14-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.fhir.analytics</groupId>
<artifactId>batch</artifactId>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>com.google.fhir.analytics</groupId>
<artifactId>common</artifactId>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>com.google.fhir.analytics</groupId>
<artifactId>controller</artifactId>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>com.google.fhir.analytics</groupId>
<artifactId>streaming</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>test</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
2 changes: 1 addition & 1 deletion pipelines/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Enable access to the packages at run time -->
<argLine>--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED</argLine>
<argLine>@{argLine} --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
Expand Down
11 changes: 3 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<modules>
<module>bunsen</module>
<module>pipelines</module>
<!-- This module is only for collecting all coverage data, see:
https://github.com/jacoco/jacoco/wiki/MavenMultiModule -->
<module>coverage</module>
</modules>

<properties>
Expand Down Expand Up @@ -59,13 +62,6 @@
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>

Expand Down Expand Up @@ -161,5 +157,4 @@
</plugins>

</build>

</project>

0 comments on commit aa769f0

Please sign in to comment.