Merge branch 'glide-sneak-2' #5
This file contains hidden or 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 | |
| # This is a simplified cut of upstream's gradle workflow. | |
| # Removed some features like VT scans and image stuff. | |
| on: | |
| push: | |
| branches-ignore: | |
| - "dependabot/**" | |
| tags-ignore: | |
| - "**" | |
| paths: | |
| - "**.java" | |
| - "**.json" | |
| - "**.yml" | |
| - "gradle**" | |
| - "*.gradle" | |
| - "*.accesswidener" | |
| pull_request: | |
| paths: | |
| - "**.java" | |
| - "**.json" | |
| - "**.yml" | |
| - "gradle**" | |
| - "*.gradle" | |
| - "*.accesswidener" | |
| workflow_dispatch: | |
| inputs: | |
| distinct_id: | |
| description: "Automatically set by the return-dispatch action (leave blank if running manually)" | |
| required: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Echo distinct ID ${{ github.event.inputs.distinct_id }} | |
| run: echo ${{ github.event.inputs.distinct_id }} | |
| - 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: Compile Java code | |
| run: ./gradlew remapJar --stacktrace --warning-mode=fail | |
| - name: Validate JSON files | |
| run: ./gradlew spotlessJsonCheck || (echo "::error::JSON validation failed! Run './gradlew spotlessApply' to fix style issues, or check the full error message for syntax errors." && exit 1) | |
| - name: Validate Java code style | |
| run: ./gradlew spotlessJavaCheck || (echo "::error::Java code style validation failed! To fix, run 'Clean Up' and then 'Format' in Eclipse, or './gradlew spotlessApply' in the terminal." && exit 1) | |
| - name: Validate license headers | |
| run: ./gradlew spotlessLicenseHeaderCheck || (echo "::error::License headers are missing or malformed in some files! Run './gradlew spotlessApply' to fix this, or check the full error message for details." && exit 1) | |
| - name: Run unit tests | |
| run: ./gradlew test --stacktrace --warning-mode=fail | |
| - name: Validate access widener | |
| run: ./gradlew validateAccessWidener --stacktrace --warning-mode=fail | |
| - name: Build | |
| run: ./gradlew build --stacktrace --warning-mode=fail | |
| - name: Draft GitHub Release | |
| uses: softprops/[email protected] | |
| with: | |
| draft: true | |
| files: build/libs/*.jar |