Skip to content

Commit

Permalink
adding github actions workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
persapiens committed Nov 26, 2023
1 parent 8d703f0 commit fe15a9c
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
target-branch: "master"
schedule:
interval: daily

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
55 changes: 55 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

name: Java CI

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
name: Java ${{ matrix.java }}
strategy:
matrix:
java: [17,21]

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'

- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: browser-actions/setup-firefox@latest
- uses: browser-actions/setup-chrome@latest

- name: Validate with Maven
run: ./mvnw -B clean validate

- name: Static validation with Maven
run: ./mvnw -B -Pcheck-duplicate,check-checkstyle,check-cycles,check-cpd,check-pmd,check-spotbugs,check-dependency -DskipTests=true -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.target=${{ matrix.java }} install

- name: Tests with Maven
run: ./mvnw -B -DwebDriverType=chrome verify

- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true

- name: Sonarqube with Maven
env:
# to get access to secrets.SONAR_TOKEN, provide GITHUB_TOKEN
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.java == 17 && github.event_name == 'push' && github.ref_name == 'master' && github.repository_owner == 'devops-education' }}
run: ./mvnw -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Pcheck-sonarqube sonar:sonar

3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<plantuml-maven-plugin.version>0.2.6</plantuml-maven-plugin.version>

<!-- check library versions -->
<decycle-maven-plugin.version>1.0.0</decycle-maven-plugin.version>
<decycle-maven-plugin.version>1.1.0</decycle-maven-plugin.version>
<spotbugs-maven-plugin.version>4.7.3.6</spotbugs-maven-plugin.version>
<findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
<findbugs-annotations.version>3.0.1</findbugs-annotations.version>
Expand Down Expand Up @@ -506,6 +506,7 @@
<artifactId>spotbugs-maven-plugin</artifactId>
<executions>
<execution>
<phase>process-test-classes</phase>
<goals>
<goal>check</goal>
</goals>
Expand Down

0 comments on commit fe15a9c

Please sign in to comment.