Skip to content

Commit

Permalink
add github actions script that comments "test test" after test covera…
Browse files Browse the repository at this point in the history
…ge is created

known-issues: should not comment test test but a badge with coverage result

Signed-off-by: Aleksandar Zivkovic <[email protected]>
  • Loading branch information
alekszivko committed Dec 23, 2024
1 parent 5cee728 commit 0a11e14
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Measure coverage

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '22'
cache: maven

- name: Run Coverage
run: |
chmod +x mvnw
./mvnw clean verify
- name: Add coverage to PR
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

script: |
github.rest.issues.createComment({
issue_number: ${{ github.event.number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: 'test test'
})
39 changes: 39 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,45 @@
<artifactId>sj2324-seed</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<executions>
Expand Down

0 comments on commit 0a11e14

Please sign in to comment.