Skip to content

Commit

Permalink
added codecov GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
bashir2 committed Mar 1, 2024
1 parent 27d691e commit 1efc981
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 11 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 }}
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>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
3 changes: 3 additions & 0 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

0 comments on commit 1efc981

Please sign in to comment.