diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..ff2341c --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,69 @@ +# This workflow configures CodeQL as the auto-configuration fails for Java/Kotlin. +# +# @author Armin Schnabel +# @version 1.0.0 +# @since 4.2.0 +name: "CodeQL Analysis" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '23 11 * * 2' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + + permissions: + # required for all workflows + security-events: write + + strategy: + fail-fast: false + matrix: + include: + - language: java-kotlin + build-mode: manual # autobuild fails (gradle.properties required) + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + # 'java-kotlin' to analyze code written in Java, Kotlin or both + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Cache Gradle dependencies + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + # Only update cache on hash change (gradle build files and the wrapper properties) + key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: gradle- + + #- name: Grant execute permission for Gradle wrapper + # run: chmod +x gradlew + + - name: Add gradle.properties + run: cp gradle.properties.template gradle.properties + + - name: Build with Gradle + run: ./gradlew build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index fbd1bcb..a99d71d 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -34,5 +34,13 @@ jobs: run: | cp gradle.properties.template gradle.properties + - name: Cache Gradle dependencies + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + # Only update cache on hash change (gradle build files and the wrapper properties) + key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: gradle- + - name: Build with Gradle run: ./gradlew build