Merge pull request #261 from SkyBlade1978/master-1.19 #196
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: CodeQL | |
| on: | |
| push: | |
| branches: | |
| - master-1.19 | |
| - 'feature/**' | |
| pull_request: | |
| branches: | |
| - master-1.19 | |
| schedule: | |
| - cron: '43 7 * * 4' | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| jobs: | |
| analyze: | |
| name: Analyze Java | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Install pinned Java 25 Mavenizer runtime | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5 | |
| with: | |
| distribution: temurin | |
| java-version: '25.0.3+9.0.LTS' | |
| - name: Install pinned Java 8 launcher toolchain | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5 | |
| with: | |
| distribution: temurin | |
| java-version: '8.0.502+7' | |
| - name: Install pinned Java 17 runtime and toolchain | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5 | |
| with: | |
| distribution: temurin | |
| java-version: '17.0.1+12' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6 | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4 | |
| with: | |
| languages: java-kotlin | |
| - name: Compile production code | |
| run: | | |
| chmod +x ./gradlew | |
| gradle_args=( | |
| clean classes --no-daemon --stacktrace | |
| "-Dorg.gradle.java.installations.paths=$JAVA_HOME,$JAVA_HOME_8_X64,$JAVA_HOME_25_X64" | |
| -Dorg.gradle.java.installations.auto-detect=false | |
| -Dorg.gradle.java.installations.auto-download=false | |
| ) | |
| for attempt in 1 2 3; do | |
| if ./gradlew "${gradle_args[@]}"; then | |
| exit 0 | |
| fi | |
| if [ "$attempt" -eq 3 ]; then | |
| echo "CodeQL compilation failed after $attempt attempts." >&2 | |
| exit 1 | |
| fi | |
| echo "::warning::CodeQL compilation attempt $attempt failed; retrying with the preserved Forge cache." | |
| done | |
| - name: Analyze | |
| uses: github/codeql-action/analyze@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4 |