ci: Qodana for .NET analysis
JetBrains Qodana (qodana-dotnet, Ultimate licence) in native mode, with the SDK installed by setup-dotnet and the settings in qodana.yaml. Results go to Qodana Cloud, to annotations and a pull request comment, and to the qodana-report artifact. Pull requests analyse the files they change; pushes to main, a weekly run and manual runs analyse everything. Skipped without QODANA_TOKEN (forks, Dependabot); not a required check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3987be2094
commit
f7e9c932b4
3 files changed
+108
No files matched your search
@@ -0,0 +1,86 @@
|
||||
name: Qodana
|
||||
|
||||
# JetBrains Qodana for .NET (linter qodana-dotnet, Ultimate licence) in native mode: the solution is analysed with the
|
||||
# .NET SDK installed by setup-dotnet, as CI builds it (configuration in qodana.yaml). Results go to Qodana Cloud (the
|
||||
# token selects the project), to check annotations, to a pull request comment and to the qodana-report artifact.
|
||||
# Pull requests analyse the files they change; pushes to main, the weekly run and manual runs analyse everything.
|
||||
# Not a required check.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
schedule:
|
||||
- cron: "37 4 * * 4"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: qodana-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
env:
|
||||
DOTNET_NOLOGO: true
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
||||
AVALONIA_TELEMETRY_OPTOUT: 1
|
||||
|
||||
jobs:
|
||||
# Pull requests from forks and from Dependabot get no repository secrets: skip the analysis instead of failing it.
|
||||
token:
|
||||
name: token
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions: {}
|
||||
outputs:
|
||||
available: ${{ steps.check.outputs.available }}
|
||||
steps:
|
||||
- name: Check for QODANA_TOKEN
|
||||
id: check
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
run: |
|
||||
if [ -n "$QODANA_TOKEN" ]; then
|
||||
echo "available=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "available=false" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::QODANA_TOKEN is not available to this run (fork or Dependabot pull request); analysis skipped."
|
||||
fi
|
||||
|
||||
qodana:
|
||||
name: qodana
|
||||
needs: token
|
||||
if: needs.token.outputs.available == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
permissions:
|
||||
contents: read
|
||||
# Annotations on the changed lines and a comment with the results on pull requests.
|
||||
checks: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
# Pull requests: the head commit rather than the merge commit, so findings point at the changed lines. The
|
||||
# full history lets the pull request mode compare with the base branch.
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
# Native mode analyses with this SDK (global.json picks the version), installed where the linter looks for it.
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
dotnet-version: 10.0.4xx
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore HashTool.slnx
|
||||
|
||||
- name: Qodana scan
|
||||
uses: JetBrains/qodana-action@3e8d76ff0e0241618abd808682f426afe84bab3f # v2026.2.2
|
||||
with:
|
||||
upload-result: true
|
||||
cache-default-branch-only: true
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
QODANA_ENDPOINT: https://qodana.cloud
|
||||
@@ -63,3 +63,7 @@ Run the app or smoke test with `HASHTOOL_DATA_DIR` pointing at a scratch folder
|
||||
- `codeql.yml` — CodeQL advanced setup, mirroring default setup (actions, csharp, python; build mode none; default
|
||||
suite; `/language:` categories) but also analysing Dependabot pull requests. The `Analyze (…)` job names are required
|
||||
checks. Default setup must stay off: while it is on, it rejects uploads from workflows.
|
||||
- `qodana.yml` — JetBrains Qodana for .NET (Ultimate licence, `qodana-dotnet` in native mode, settings in `qodana.yaml`):
|
||||
results in Qodana Cloud, as annotations and a pull request comment, and in the `qodana-report` artifact
|
||||
(`gh run download <run> -n qodana-report`, then read `qodana.sarif.json`). Skipped when `QODANA_TOKEN` isn't
|
||||
available (forks, Dependabot); not a required check.
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
# Qodana for .NET (Ultimate licence), run by .github/workflows/qodana.yml.
|
||||
version: "1.0"
|
||||
|
||||
# Native mode: analyses with the .NET SDK installed on the runner instead of the one bundled in the Docker image.
|
||||
linter: qodana-dotnet
|
||||
withinDocker: false
|
||||
|
||||
profile:
|
||||
name: qodana.recommended
|
||||
|
||||
dotnet:
|
||||
solution: HashTool.slnx
|
||||
|
||||
exclude:
|
||||
- name: All
|
||||
paths:
|
||||
# Pinned to Velopack 0.0.1298 on purpose: the release upgrade gate runs it like a Hash Tool 1.1.x client.
|
||||
- tests/Compat
|
||||
Reference in new issue
Block a user