Skip to content

[Docs] Update documentation for local telemetry debugging #12705

[Docs] Update documentation for local telemetry debugging

[Docs] Update documentation for local telemetry debugging #12705

Workflow file for this run

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# This workflow will build and test the TypeAgent TypeScript code
name: build-ts
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]
merge_group:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
pull-requests: read
contents: read
id-token: write
env:
NODE_OPTIONS: --max_old_space_size=8192
jobs:
build_ts:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
version: [22, 24]
runs-on: ${{ matrix.os }}
steps:
- if: runner.os == 'Linux'
run: |
sudo apt-get install -y libsecret-1-dev
- name: Setup Git LF
run: |
git config --global core.autocrlf false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Full history so the changed-files lint can diff against the base.
fetch-depth: 0
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
continue-on-error: true
with:
filters: |
ts:
- "ts/**"
- ".github/workflows/build-ts.yml"
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
name: Install pnpm
with:
package_json_file: ts/package.json
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
with:
node-version: ${{ matrix.version }}
cache: "pnpm"
cache-dependency-path: ts/pnpm-lock.yaml
- name: Install dependencies
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
working-directory: ts
run: |
pnpm install --frozen-lockfile --strict-peer-dependencies
- name: Build
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
working-directory: ts
run: |
npm run build
# On pull requests only changed files are checked (fast); the
# format-pr workflow auto-fixes them. Other events check the whole repo.
- name: Lint
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
working-directory: ts
shell: bash
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch --no-tags origin "${{ github.base_ref }}"
node tools/scripts/prettier-changed.mjs --base "origin/${{ github.base_ref }}"
else
npm run lint
fi
# Complexity gate (PRs only): the files this PR changes may not add
# functions over the cyclomatic/cognitive budget versus the base branch
# (a stateless ratchet — the base branch is the baseline, so the count
# can only trend down), and any brand-new file is additionally held to a
# hard cap. Pre-existing offenders are grandfathered by inline
# // code-complexity-allow markers. Tune the thresholds down as hotspots
# get refactored.
- name: Complexity ratchet
if: ${{ github.event_name == 'pull_request' && steps.filter.outputs.ts != 'false' }}
working-directory: ts
shell: bash
run: |
git fetch --no-tags origin "${{ github.base_ref }}"
npm run code-complexity -- --ratchet --base "origin/${{ github.base_ref }}" \
--cyclomatic 25 --cognitive 30 \
--new-file-cyclomatic 25 --new-file-cognitive 30
# Lint ratchet (PRs only): the files this PR changes may not add ESLint
# violations (no-explicit-any, no-console, no-unused-vars, ...) versus the
# base branch. Syntactic rules only, so it is fast; the count can only
# trend down. Run `npm run code-lint` locally to see the full report.
- name: Lint ratchet
if: ${{ github.event_name == 'pull_request' && steps.filter.outputs.ts != 'false' }}
working-directory: ts
shell: bash
run: |
git fetch --no-tags origin "${{ github.base_ref }}"
npm run code-lint -- --ratchet --base "origin/${{ github.base_ref }}"
# Circular-dependency ratchet (PRs only): fail if the change introduces a
# runtime import cycle not already present at the base. Builds the cycle
# set for HEAD and for the merge base (via a throwaway git worktree), so
# this step is heavier than the others (madge runs twice).
- name: Circular dependency ratchet
if: ${{ github.event_name == 'pull_request' && steps.filter.outputs.ts != 'false' }}
working-directory: ts
shell: bash
run: |
git fetch --no-tags origin "${{ github.base_ref }}"
npm run code-circular -- --ratchet --base "origin/${{ github.base_ref }}" --exceptions-file tools/scripts/code/circular-baseline-exception.json
# Test-debt gate (PRs only): zero tolerance for focused tests
# (.only/fit/fdescribe) and no newly skipped tests (.skip/xit/xdescribe)
# in changed files. A small, fixable problem -> a hard gate, not a ratchet.
- name: Test debt gate
if: ${{ github.event_name == 'pull_request' && steps.filter.outputs.ts != 'false' }}
working-directory: ts
shell: bash
run: |
git fetch --no-tags origin "${{ github.base_ref }}"
npm run code-debt -- --gate --base "origin/${{ github.base_ref }}"
- name: Restore better-sqlite3 for Node.js
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
working-directory: ts
run: |
pnpm run postinstall:better-sqlite3-node-restore
# Runs the unit suite once, then reruns only the packages that owned a
# failing test up to two times (serially), stopping early on success.
# Flaky tests are reported as annotations / a step summary but do not fail
# the build; the final retry package suite must otherwise pass.
- name: Test
if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
working-directory: ts
run: |
node tools/scripts/runTestLocalWithSummary.mjs
- name: UI tests (requires display)
if: ${{ (github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false') && runner.os == 'Linux' }}
working-directory: ts
run: |
Xvfb :99 -screen 0 1600x1200x24 &
export DISPLAY=:99
npm run test:ui