|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time |
| 6 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle |
| 7 | + |
| 8 | +name: Java CI with Gradle |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: [ "main" ] |
| 13 | + pull_request: |
| 14 | + branches: [ "main" ] |
| 15 | + |
| 16 | +jobs: |
| 17 | + java-prettier: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: prettier-java-format-action |
| 24 | + # You may pin to the exact commit or the version. |
| 25 | + # uses: tsar-boomba/prettier-java-action@0b6f73e327951a4ba1da05f5dbb3e227201af0a4 |
| 26 | + uses: tsar-boomba/prettier-java-action@v1.1.0 |
| 27 | + with: |
| 28 | + # Arguments for Prettier cli. |
| 29 | + prettier-args: # optional, default is -w |
| 30 | + # Pattern to match the files to be formatted. |
| 31 | + files: # optional, default is **/*.java |
| 32 | + # Whether or not you want the action to push to your repo with the formatting. |
| 33 | + commit: # optional, default is true |
| 34 | + # Username for the github action to commit with. |
| 35 | + github-username: # optional, default is github-actions |
| 36 | + # Message for formatter commit. |
| 37 | + commit-message: # optional, default is Format Java |
| 38 | + |
| 39 | + build: |
| 40 | + runs-on: ubuntu-latest |
| 41 | + permissions: |
| 42 | + contents: read |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + - name: Set up JDK 17 |
| 47 | + uses: actions/setup-java@v4 |
| 48 | + with: |
| 49 | + java-version: '17' |
| 50 | + distribution: 'temurin' |
| 51 | + |
| 52 | + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. |
| 53 | + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md |
| 54 | + - name: Setup Gradle |
| 55 | + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 |
| 56 | + |
| 57 | + - name: Build with Gradle Wrapper |
| 58 | + run: ./gradlew build |
| 59 | + |
| 60 | + # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). |
| 61 | + # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. |
| 62 | + # |
| 63 | + # - name: Setup Gradle |
| 64 | + # uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 |
| 65 | + # with: |
| 66 | + # gradle-version: '8.9' |
| 67 | + # |
| 68 | + # - name: Build with Gradle 8.9 |
| 69 | + # run: gradle build |
| 70 | + |
| 71 | + dependency-submission: |
| 72 | + |
| 73 | + runs-on: ubuntu-latest |
| 74 | + permissions: |
| 75 | + contents: write |
| 76 | + |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v4 |
| 79 | + - name: Set up JDK 17 |
| 80 | + uses: actions/setup-java@v4 |
| 81 | + with: |
| 82 | + java-version: '17' |
| 83 | + distribution: 'temurin' |
| 84 | + |
| 85 | + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. |
| 86 | + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md |
| 87 | + - name: Generate and submit dependency graph |
| 88 | + uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 |
0 commit comments