name: Build PR snapshot on: pull_request: paths: - '**.gradle' - '**.properties' - '**/src/**' types: [ opened, synchronize, reopened ] jobs: validate-gradle: name: "Validate Gradle wrapper" runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - uses: gradle/wrapper-validation-action@v1 license: name: "Verify License integrity" runs-on: ubuntu-20.04 if: | !contains(github.event.head_commit.message, '[ci skip]') steps: - uses: actions/checkout@v2 - name: Set up JDK 8 uses: actions/setup-java@v2 with: java-version: 8 distribution: 'adopt' - name: Cache Gradle wrapper uses: actions/cache@v2 with: path: ~/.gradle/wrapper key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/**/*') }} restore-keys: gradle-wrapper-${{ runner.os }}- - name: Cache packages id: cache-packages uses: actions/cache@v2 with: path: ~/.gradle/caches key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: gradle-packages-${{ runner.os }}- - name: Make gradlew executable run: chmod +x ./gradlew - name: Build with Gradle run: | ./gradlew licenseCheck # Remove some potentially problematic files from the Gradle cache, # so that GitHub Actions doesn't cache them. - name: Cleanup Gradle Cache if: steps.cache-packages.outputs.cache-hit != 'true' run: | rm -f $HOME/.gradle/caches/*/*.lock rm -rf $HOME/.gradle/caches/*/plugin-resolution/ rm -rf $HOME/.gradle/caches/*/scripts/ rm -rf $HOME/.gradle/caches/*/scripts-remapped/ rm -rf $HOME/.gradle/caches/*/fileHashes/ rm -f $HOME/.gradle/caches/journal-1/file-access.bin build: name: "Build" strategy: matrix: java: [ 8, 11, 15 ] runs-on: ubuntu-20.04 if: | !contains(github.event.head_commit.message, '[ci skip]') steps: - uses: actions/checkout@v2 - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v2 with: java-version: ${{ matrix.java }} distribution: 'adopt' - name: Cache Gradle wrapper uses: actions/cache@v2 with: path: ~/.gradle/wrapper key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/**/*') }} restore-keys: gradle-wrapper-${{ runner.os }}- - name: Cache packages id: cache-packages uses: actions/cache@v2 with: path: ~/.gradle/caches key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: gradle-packages-${{ runner.os }}- - name: Make gradlew executable run: chmod +x ./gradlew - name: Build with Gradle run: | ./gradlew build --stacktrace --no-daemon # Remove some potentially problematic files from the Gradle cache, # so that GitHub Actions doesn't cache them. - name: Cleanup Gradle Cache if: steps.cache-packages.outputs.cache-hit != 'true' run: | rm -f $HOME/.gradle/caches/*/*.lock rm -rf $HOME/.gradle/caches/*/plugin-resolution/ rm -rf $HOME/.gradle/caches/*/scripts/ rm -rf $HOME/.gradle/caches/*/scripts-remapped/ rm -rf $HOME/.gradle/caches/*/fileHashes/ rm -f $HOME/.gradle/caches/journal-1/file-access.bin - name: Upload Artifacts uses: actions/upload-artifact@v2 with: name: '${{ github.event.repository.name }} PR${{ github.event.number }} Snapshot #${{ github.run_number }}' path: | **/build/libs/ !build/libs/ !**/*-dev.jar !**/*-shadow.jar !**/*-transformProduction*.jar !**/testmod*/