|
| 1 | +# Reference: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle |
| 2 | + |
| 3 | +name: Java CI with Gradle |
| 4 | + |
| 5 | +#on: [push, pull_request] |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ '**' ] |
| 9 | + pull_request: |
| 10 | + branches: [ '**' ] |
| 11 | + |
| 12 | + # Allow running from Actions tab |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +permissions: |
| 16 | + # Reference: https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/ |
| 17 | + contents: read |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + # TODO Fix freenet.client.filter.M3UFilterTest on Windows, enable Windows builds |
| 24 | + #os: [macos-latest, ubuntu-latest, windows-latest] |
| 25 | + os: [macos-latest, ubuntu-latest] |
| 26 | + distribution: [temurin] |
| 27 | + # TODO What JDK versions are needed? |
| 28 | + # TODO Fix freenet.support.compress.GzipCompressorTest on Java 16, enable 16 builds |
| 29 | + #java: [8, 11, 16] |
| 30 | + java: [8, 11] |
| 31 | + |
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v3 |
| 36 | + |
| 37 | + - uses: gradle/wrapper-validation-action@v1 |
| 38 | + |
| 39 | + - uses: actions/setup-java@v3 |
| 40 | + with: |
| 41 | + cache: 'gradle' |
| 42 | + distribution: '${{ matrix.distribution }}' |
| 43 | + java-version: '${{ matrix.java }}' |
| 44 | + |
| 45 | + - name: before_install |
| 46 | + run: | |
| 47 | + echo "" > gradle.properties # Force empty gradle.properties file |
| 48 | + echo "org.gradle.configureondemand=true" >> gradle.properties |
| 49 | + echo "org.gradle.jvmargs=-Xms256m -Xmx1024m" >> gradle.properties |
| 50 | + echo "org.gradle.parallel = true" >> gradle.properties |
| 51 | + echo "tasks.withType(Test) { maxParallelForks = Runtime.runtime.availableProcessors() }" >> gradle.properties |
| 52 | + cat gradle.properties |
| 53 | +
|
| 54 | + - name: gradle --warning-mode all |
| 55 | + run: | |
| 56 | + echo "Run Gradle in pedantic mode to flush out Gradle upgrade issues" |
| 57 | + ./gradlew --warning-mode all |
| 58 | +
|
| 59 | + - name: gradle javadoc |
| 60 | + run: | |
| 61 | + ./gradlew javadoc |
| 62 | +
|
| 63 | + - name: gradle jar |
| 64 | + run: | |
| 65 | + ./gradlew jar |
| 66 | +
|
| 67 | + - name: gradle copyRuntimeLib |
| 68 | + run: | |
| 69 | + ./gradlew copyRuntimeLib |
| 70 | +
|
| 71 | + - name: gradle test |
| 72 | + run: | |
| 73 | + ./gradlew test |
| 74 | +
|
0 commit comments