Skip to content

Commit

Permalink
Add build and test workflow (#22)
Browse files Browse the repository at this point in the history
* Add build and test workflow
* Adjust source and target levels
* Enable jacoco coverage profile
* Update jacoco plugin version

See jacoco/jacoco#1132 for JDK 17 support.

Signed-off-by: David Greven <fixed-term.David.Greven@de.bosch.com>
  • Loading branch information
grevend-bosch committed Oct 15, 2021
1 parent d10625a commit e828ed1
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 3 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-and-test.yaml
@@ -0,0 +1,41 @@
#
# Copyright (c) 2021 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/carbynestack/cli-ng.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Build and test artifacts
on: push
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Setting up Github Package Repository as Maven Repository
uses: s4u/maven-settings-action@v2
with:
githubServer: false
servers: |
[{
"id": "github",
"username": "${{ secrets.GHPR_USERNAME }}",
"password": "${{ secrets.GHPR_TOKEN }}"
}]
- name: Build with Maven
run: mvn install -Dskip.tests --batch-mode --update-snapshots --no-transfer-progress
- name: Run Tests
run: mvn verify --activate-profiles coverage --batch-mode --no-transfer-progress
- name: Collect Jacoco reports
run: echo ::set-output name=reports::$(find . -regex '.*/target/site/jacoco/jacoco.xml' | tr '\n' ',' | sed 's/.$//')
id: jacoco
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ steps.jacoco.outputs.reports }}
name: codecov
34 changes: 31 additions & 3 deletions pom.xml
Expand Up @@ -39,13 +39,13 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

<!-- Plugin versions -->
<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-jacoco-plugin.version>0.8.6</maven-jacoco-plugin.version>
<maven-jacoco-plugin.version>0.8.7</maven-jacoco-plugin.version>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
Expand Down Expand Up @@ -249,4 +249,32 @@
</resources>
</build>

<profiles>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${maven-jacoco-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>generate-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit e828ed1

Please sign in to comment.