Merge pull request #65 from SanctumLabs/dependabot/gradle/io.ktor.plu… #254
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
# https://github.com/github/codeql-action | |
# References from https://github.com/gradle/gradle/blob/master/.github/workflows/codeql-analysis.yml | |
name: "Code Scanning" | |
on: | |
push: | |
branches: [ develop, main ] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [ main ] | |
schedule: | |
# At 06:00 on Monday. | |
- cron: '0 6 * * 1' | |
jobs: | |
codeql-build: | |
name: Code Quality Check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
language: | |
- java | |
steps: | |
# Ref: https://github.com/actions/cache | |
- name: Cache Gradle Modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches/modules-2/ | |
~/.gradle/caches/build-cache-1/ | |
~/.gradle/caches/signatures/ | |
~/.gradle/caches/keyrings/ | |
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
if: ${{ matrix.language == 'java' }} | |
- name: Disable checksum offloading | |
# See: https://github.com/actions/virtual-environments/issues/1187#issuecomment-686735760 | |
run: sudo ethtool -K eth0 tx off rx off | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
# We must fetch at least the immediate parents so that if this is | |
# a pull request then we can checkout the head. | |
fetch-depth: 2 | |
# Install and setup JDK 11 | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
# If this run was triggered by a pull request event, then checkout | |
# the head of the pull request instead of the merge commit. | |
- run: git checkout HEAD^2 | |
if: ${{ github.event_name == 'pull_request' }} | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v1 | |
with: | |
languages: ${{ matrix.language }} | |
config-file: ./.github/codeql/codeql-config.yml | |
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | |
- name: Autobuild | |
uses: github/codeql-action/autobuild@v1 | |
# - name: Compile with Gradle without Build Scan | |
# if: ${{ matrix.language == 'java' }} | |
# run: ./gradlew --init-script .github/workflows/codeql-analysis.init.gradle -S testClasses | |
- name: Cleanup Gradle Daemons | |
run: ./gradlew --stop | |
if: ${{ matrix.language == 'java' }} | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
- name: Cleanup Gradle Cache | |
if: ${{ matrix.language == 'java' }} | |
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | |
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | |
run: | | |
rm -f ~/.gradle/caches/modules-2/modules-2.lock | |
rm -f ~/.gradle/caches/modules-2/gc.properties |