Skip to content

Commit

Permalink
La testdekning innhold i egen fil
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikmork committed Dec 2, 2024
1 parent 277b8f4 commit bb40613
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 35 deletions.
43 changes: 8 additions & 35 deletions .github/workflows/integrasjonsTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,43 +28,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn --no-transfer-progress verify --settings .m2/maven-settings.xml --file pom.xml

- name: Generate JaCoCo report
run: mvn jacoco:prepare-agent test jacoco:report --no-transfer-progress --settings .m2/maven-settings.xml --file pom.xml

- name: Upload JaCoCo report
uses: actions/upload-artifact@v3
with:
name: jacoco-report
path: target/site/jacoco

sonar:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: Download JaCoCo report
uses: actions/download-artifact@v3
with:
name: jacoco-report
path: target/site/jacoco
- name: Cache Sonar packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Run Sonar
- name: Bygg og SonarCloud
if: github.actor != 'dependabot[bot]'
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_PROJECTKEY: ${{ secrets.SONAR_PROJECTKEY }}
SONAR_LOGIN: ${{ secrets.SONAR_LOGIN }}
run: mvn sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml --settings .m2/maven-settings.xml --file pom.xml
run: mvn --no-transfer-progress verify --settings .m2/maven-settings.xml --file pom.xml
#run: mvn --no-transfer-progress verify sonar:sonar --settings .m2/maven-settings.xml --file pom.xml

testdekning:
needs: build
uses: ./.github/workflows/testdekning.yml
51 changes: 51 additions & 0 deletions .github/workflows/testdekning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Testdekning

on:
workflow_dispatch:
pull_request:

jobs:
code-coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'

- name: Generate JaCoCo report
run: mvn jacoco:prepare-agent test jacoco:report --no-transfer-progress --settings .m2/maven-settings.xml --file pom.xml

- name: Upload JaCoCo report
uses: actions/upload-artifact@v3
with:
name: jacoco-report
path: target/site/jacoco

- name: Download JaCoCo report
uses: actions/download-artifact@v3
with:
name: jacoco-report
path: target/site/jacoco

- name: Cache Sonar packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Run Sonar
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_PROJECTKEY: ${{ secrets.SONAR_PROJECTKEY }}
SONAR_LOGIN: ${{ secrets.SONAR_LOGIN }}
run: mvn sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml --settings .m2/maven-settings.xml --file pom.xml

0 comments on commit bb40613

Please sign in to comment.