Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup codecov and update badges #188

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
85 changes: 61 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,79 @@ on:
- master

jobs:
build:
runs-on: ${{ matrix.os }}
# build:
# runs-on: ${{ matrix.os }}
# permissions:
# id-token: write
# contents: read
# strategy:
# matrix:
# os: [ macos-latest, ubuntu-latest, windows-2019]
# java: [ 8, 11, 16 ]
# steps:
# - name: Checkout the repository
# uses: actions/checkout@v4
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
# role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
# aws-region: ${{ secrets.AWS_REGION }}
# - name: Set up JDK
# uses: actions/setup-java@v4
# with:
# java-version: ${{ matrix.java }}
# distribution: 'adopt'
# cache: maven
# - name: Build with Maven
# run: mvn clean compile assembly:single
# - name: Run tests
# run: |
# if [ "$RUNNER_OS" == "Linux" ]; then
# mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/ubuntu/ -Dlog4j.configurationFile=log4j2.xml"
# elif [ "$RUNNER_OS" == "Windows" ]; then
# mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/windows/ -Dlog4j.configurationFile=log4j2.xml"
# elif [ "$RUNNER_OS" == "macOS" ]; then
# mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/mac/ -Dlog4j.configurationFile=log4j2.xml"
# else
# echo "$RUNNER_OS not supported"
# exit 1
# fi
# shell: bash
codecov-build:
runs-on: macos-latest
permissions:
id-token: write
contents: read
strategy:
matrix:
os: [ macos-10.15, ubuntu-18.04, windows-2019]
java: [ 8, 11, 16 ]
steps:
- name: Checkout the repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'adopt'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: mvn clean compile assembly:single
- name: Run tests
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/ubuntu/ -Dlog4j.configurationFile=log4j2.xml"
elif [ "$RUNNER_OS" == "Windows" ]; then
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/windows/ -Dlog4j.configurationFile=log4j2.xml"
elif [ "$RUNNER_OS" == "macOS" ]; then
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/mac/ -Dlog4j.configurationFile=log4j2.xml"
else
echo "$RUNNER_OS not supported"
exit 1
fi
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/ubuntu/ -Dlog4j.configurationFile=log4j2.xml"
shell: bash
- name: Check contents
run: |
sudo apt-get install tree
tree
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
# directory: target/surefire-reports/
files: /home/runner/work/amazon-kinesis-video-streams-producer-sdk-java/amazon-kinesis-video-streams-producer-sdk-java/target/site/jacoco/jacoco.xml
fail_ci_if_error: true

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Amazon Kinesis Video Streams Producer SDK Java
<p align="center">
<a href="https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-java/actions/workflows/ci.yml"> <img src="https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-java/actions/workflows/ci.yml/badge.svg"> </a>
</p>

## License

Expand Down
28 changes: 23 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@
<artifactId>log4j-api</artifactId>
<version>2.17.1</version>
</dependency>

<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -212,12 +216,26 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<configuration>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
<destFile>${project.build.directory}/site/jacoco/jacoco.xml</destFile>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
Loading