ci: Add DuplicatedCode Qodana check #12
Workflow file for this run
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: Qodana - Duplicated Code | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main, feature/** ] | |
pull_request: | |
branches: [ '**' ] | |
concurrency: | |
group: ${{ github.workflow }}${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
qodana: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
# PR check | |
checks: write | |
# PR comments | |
pull-requests: write | |
# SARIF upload | |
security-events: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Maximize Build Space | |
if: runner.os == 'Linux' | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
large-packages: false | |
- name: 'Qodana Scan' | |
uses: JetBrains/[email protected] | |
env: | |
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} | |
with: | |
# --config points to the DuplicatedCode-only Qodana config | |
# --baseline points to the DuplicatedCode baseline to ensure that only new DuplicatedCode changes are found | |
# --baseline-include-absent will make this test fail if duplicated code from the baseline is remediated, which calls for a rebaselining. | |
args: | |
--config,${{ github.workspace }}/qodana-configs/duplicated-code/qodana.yaml,--baseline,${{ github.workspace }}/qodana-configs/duplicated-code/qodana.sarif.json,--baseline-include-absent | |
cache-default-branch-only: true | |
# pr-mode off means that the whole repo should be checked for duplicate code, instead of just copy/pastes within the PR | |
pr-mode: false | |
- uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json |