Skip to content

Commit

Permalink
Merge pull request #7 from Coreoz/evol/add-github-actions
Browse files Browse the repository at this point in the history
add github actions
  • Loading branch information
amanteaux committed Jan 18, 2024
2 parents ad674ab + de07b49 commit 42a01e7
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 5 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI

on:
push:
branches: [ "master" ]
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build & test with Maven
run: mvn -B clean test
- name: Sonar analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
run: mvn -B verify -P coverage org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=Coreoz_PPT-Templates -Dsonar.organization=coreoz
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<version>0.8.11</version>
<executions>
<execution>
<id>prepare-agent</id>
Expand Down
19 changes: 19 additions & 0 deletions sonar-projet.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
sonar.projectKey=ppt-templates
sonar.projectName=PPT Templates
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src/main

# Java
sonar.java.source=8
sonar.exclusion=demo/*

#Tests
# Disable some rules on some files
sonar.issue.ignore.multicriteria=j1,j2
#No literal duplication tests
sonar.issue.ignore.multicriteria.j1.ruleKey=squid:S1192
sonar.issue.ignore.multicriteria.j1.resourceKey=src/test/**/*
#No method name compliance for tests
sonar.issue.ignore.multicriteria.j2.ruleKey=squid:S00100
sonar.issue.ignore.multicriteria.j2.resourceKey=src/test/**/*

0 comments on commit 42a01e7

Please sign in to comment.