Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
anasoid authored Jan 7, 2025
1 parent fe68c27 commit 0d4b896
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name : Java CI with Gradle

on : [ push, pull_request ]

jobs :
build :

runs-on : ubuntu-latest

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

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

- name : Cache Sonar
uses : actions/cache@v4
with :
path : |
~/.sonar
key : ${{ runner.os }}-sonar-${{ hashFiles('**/*.gradle*') }}
restore-keys : |
${{ runner.os }}-sonar-
- name : Setup Gradle
uses : gradle/actions/setup-gradle@v4
with :
build-scan-publish : true
build-scan-terms-of-use-url : "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree : "yes"

- name : Build with Gradle
run : ./gradlew build


- name : Publish Test Report
uses : mikepenz/action-junit-report@v5
with :
report_paths : '**/build/test-results/test/TEST-*.xml'
github_token : ${{ secrets.GITHUB_TOKEN }}

- name : Upload artifact Report
uses : actions/upload-artifact@v4
with :
name : reports
path : '**/build/reports/**'

- name : Run codacy-coverage-reporter
uses : codacy/[email protected]
with :
project-token : ${{ secrets.CODACY_PROJECT_TOKEN }}
# or
# api-token: ${{ secrets.CODACY_API_TOKEN }}
coverage-reports : ${{ github.workspace }}/buildUtils/code-coverage-report/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml

- name : CodeCov
uses : codecov/codecov-action@v5
with :
token : ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files : ${{ github.workspace }}/buildUtils/code-coverage-report/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml # optional
verbose : true

- name : Sonar check
run : ./gradlew sonar
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}

0 comments on commit 0d4b896

Please sign in to comment.