Java CI with Gradle #1051
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI with Gradle | |
on: | |
push: | |
paths: | |
- "**.java" | |
- "**.json" | |
- "gradle**" | |
- "*.gradle" | |
pull_request: | |
paths: | |
- "**.java" | |
- "**.json" | |
- "gradle**" | |
- "*.gradle" | |
workflow_dispatch: | |
permissions: | |
# Required for Gradle dependency submission | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Java 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: "21" | |
distribution: "microsoft" | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" | |
build-scan-terms-of-use-agree: "yes" | |
- name: Generate and submit dependency graph | |
if: ${{ github.event_name == 'push' }} | |
uses: gradle/actions/dependency-submission@v4 | |
- name: Run tests and build | |
run: ./gradlew build --stacktrace --warning-mode=fail | |
- name: Upload to VirusTotal for analysis | |
if: ${{ github.secrets.VIRUSTOTAL_API_KEY }} | |
uses: crazy-max/ghaction-virustotal@v4 | |
with: | |
vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }} | |
vt_monitor: true | |
monitor_path: /Wurst7 | |
files: | | |
./build/libs/*.jar | |
# An error in this step means that the upload failed, not that a false | |
# positive was detected. | |
continue-on-error: true | |
- name: Run the mod and take screenshots | |
uses: modmuss50/xvfb-action@v1 | |
with: | |
run: ./gradlew runEndToEndTest --stacktrace --warning-mode=fail | |
- name: Upload test screenshots | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: Test Screenshots | |
path: run/screenshots |