Files
poli0981andClaude Opus 5.5 ccae96dbeb chore: move to poli0981org — self-contained CI, Qodana, an npm licence gate, this week's dependencies (#119)
The repository now lives in the poli0981org organization, and this makes it at home there.

- main was red since 2026-11-18: RUSTSEC-2026-0543 (chrono), in Cargo.lock only through serde_with's weak features and compiled into nothing; ignored with its reason and exit condition.
- Supersedes #113–#118 (Rust 1.100.0, rusqlite 0.42.0, Tauri 2.12.6, code-health pins, actions, npm) plus jsdom 31.0.1; minimatch 11 closes GHSA-g3hv-75wg-m249. rfd 0.18 (#112) is held again until tauri-plugin-dialog moves.
- Dependabot's tauri groups never worked (it picks the most specific group); exclude-patterns on the catch-alls fix it.
- CI is self-contained: no workflow calls poli0981/.github; every action is pinned by commit; notify.yml vendors the Discord notifier.
- npm licences: scripts/check-licenses.mjs, deny.toml's allowlist for the npm half. Required, with cargo deny and tauri lockstep — eight required checks.
- Qodana in two parts (Rust, TS/JS), full scans, a triaged Rust baseline, fail on anything new. The Rust container needed its toolchain and CARGO_HOME pointed somewhere writable before it analysed anything.
- SonarQube Cloud analyses into poli0981org_pipdock; every npm ci runs with --ignore-scripts (S6505).
- Every repository URL points at the organization. README's attestation command for 1.4.0/1.5.0 had stopped working; it now says --owner poli0981 --signer-repo poli0981/pipdock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:50:41 +07:00

152 lines
6.4 KiB
YAML

# SonarQube Cloud, CI-based. sonar-project.properties says what is analysed, and why this replaced
# automatic analysis: that could not build, so it saw no Rust and imported no coverage.
#
# **One Windows job**, for the reason ci-rust.yml is on Windows: the Rust suite exercises the PEP 514
# registry and the `py` launcher, so coverage measured on Linux would be coverage of a different
# program. Scanning on the runner that produced the reports also means both LCOV files name paths
# the scanner can resolve, with nothing rewritten in between.
#
# **The token reaches one step.** Producing the reports runs third-party code — every crate's build
# script, every npm package's — so SONAR_TOKEN is in no environment but the scanner's, the same
# reasoning that keeps release.yml's write token away from its build.
#
# **No token, no analysis.** Dependabot's pull requests are given Dependabot secrets only, and a
# fork's none, so on those `secrets.SONAR_TOKEN` is empty and the job is skipped instead of failing
# on a missing token. Adding SONAR_TOKEN as a Dependabot secret as well brings their PRs back in.
#
# Not a required check. The quality gate is still reported as SonarCloud's own check on the PR, and
# `sonar.qualitygate.wait` makes this job fail with it — which is what lets a red gate on `main`
# reach Discord through notify-ci-failure.yml, where this workflow is listed by name.
name: SonarCloud
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: sonar-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# ci-rust.yml's, so the clippy run below matches the fingerprints in the cache it restores.
RUSTFLAGS: -D warnings
jobs:
token:
name: token present
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
present: ${{ steps.check.outputs.present }}
steps:
# `secrets` cannot be read in an `if:`, so its presence is turned into an output here. Only
# the emptiness test sees the value; nothing is checked out and nothing else runs.
- name: Check
id: check
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
if [ -n "$SONAR_TOKEN" ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "::notice::No SONAR_TOKEN for this run (a Dependabot or fork pull request); the analysis is skipped."
fi
analyze:
name: coverage · analysis
needs: token
# A dispatch from any branch but `main` would be a *branch* analysis, which this organization's
# plan does not offer: the report uploads, and then the gate check fails with "not allowed to
# access data from non main branches" (tried 2026-10-25). Pull requests and `main` are the two
# analyses there are.
if: >-
needs.token.outputs.present == 'true' &&
(github.event_name != 'workflow_dispatch' || github.ref == 'refs/heads/main')
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Full history: new code is decided by blame, and a shallow clone has none to give.
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '26'
cache: npm
# No install script runs: the only package in the lockfile that has one is fsevents, which
# is macOS-only, and a lifecycle script is how a compromised dependency runs on the runner
# (SonarCloud githubactions:S6505). `npm licences` and `npm audit` never needed them either.
- name: Install frontend dependencies
run: npm ci --ignore-scripts
- name: TypeScript coverage
run: npm run test:coverage
# Restore only, from ci-rust.yml's key. The registry and clippy's build are reused from it;
# the instrumented build lands in target/llvm-cov-target and is rebuilt every run, because
# saving a fourth multi-GB cargo cache would evict the three the required checks depend on.
- name: Restore cargo cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-
# For the toolchain rust-toolchain.toml pins, which installs itself on the first cargo call;
# adding the component there instead would make every contributor download it.
- name: Add llvm-tools
run: rustup component add llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@4a76afe23f9e08d2d9550fb56e556444e8611d21 # v2.90.4
with:
tool: cargo-llvm-cov
- name: Rust coverage
run: cargo llvm-cov --workspace --locked --lcov --output-path target/lcov-rust.info
# The same invocation as ci-rust.yml's gate, as JSON. That job is what fails on a finding;
# this one only records it, so a red clippy still leaves a report for the scanner to import.
- name: Clippy report
shell: pwsh
run: |
cargo clippy --workspace --all-targets --locked --message-format=json -- -D warnings |
Out-File -Encoding utf8NoBOM target/clippy.json
exit 0
# package.json is one of the five places the version lives, and a tag cannot be pushed while
# they disagree (release.yml), so any of them would do. Checked against a version's shape
# because it is spliced into the scanner's argv below, in the step that holds the token.
- name: Project version
id: version
shell: pwsh
run: |
$v = (Get-Content package.json -Raw | ConvertFrom-Json).version
if ($v -notmatch '^\d+\.\d+\.\d+(-[0-9A-Za-z.]+)?$') { throw "package.json version '$v' is not a version" }
"version=$v" >> $env:GITHUB_OUTPUT
- name: Scan
uses: SonarSource/sonarqube-scan-action@59202af334b4ba7b5db01b701b8e79f8b3bef0f4 # v8.5.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectVersion=${{ steps.version.outputs.version }}
-Dsonar.qualitygate.wait=true