81569f3461
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
200 lines
6.4 KiB
YAML
200 lines
6.4 KiB
YAML
name: Static Analysis
|
|
on:
|
|
pull_request: {}
|
|
merge_group:
|
|
types: [checks_requested]
|
|
push:
|
|
branches: [develop, master]
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
permissions: {} # No permissions needed
|
|
jobs:
|
|
ts_lint:
|
|
name: "Typescript Syntax Check"
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
cache: "pnpm"
|
|
node-version-file: package.json
|
|
|
|
- name: Install Deps
|
|
run: "pnpm install"
|
|
|
|
- name: Typecheck
|
|
run: "pnpm run lint:types"
|
|
|
|
js_lint:
|
|
name: "ESLint"
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
cache: "pnpm"
|
|
node-version-file: package.json
|
|
|
|
- name: Install Deps
|
|
run: "pnpm install"
|
|
|
|
- name: Run Linter
|
|
run: "pnpm run lint:js"
|
|
|
|
node_example_lint:
|
|
name: "Node.js example"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
cache: "pnpm"
|
|
node-version-file: package.json
|
|
|
|
- name: Install Deps
|
|
run: "pnpm install"
|
|
|
|
- name: Build Types
|
|
run: "pnpm build:types"
|
|
|
|
- name: Install Example Deps
|
|
run: "npm install"
|
|
working-directory: "examples/node"
|
|
|
|
- name: Check Syntax
|
|
run: "node --check app.js"
|
|
working-directory: "examples/node"
|
|
|
|
- name: Typecheck
|
|
run: "npx tsc"
|
|
working-directory: "examples/node"
|
|
|
|
workflow_lint:
|
|
name: "Workflow Lint"
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
security-events: write
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
cache: "pnpm"
|
|
node-version-file: package.json
|
|
|
|
- name: Install Deps
|
|
run: "pnpm install --frozen-lockfile"
|
|
|
|
- name: Run Linter
|
|
run: "pnpm lint:workflows"
|
|
|
|
- name: Run zizmor
|
|
uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
|
|
|
|
docs:
|
|
name: "JSDoc Checker"
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
cache: "pnpm"
|
|
node-version-file: package.json
|
|
|
|
- name: Install Deps
|
|
run: "pnpm install"
|
|
|
|
- name: Generate Docs
|
|
run: "pnpm run gendoc --treatWarningsAsErrors --suppressCommentWarningsInDeclarationFiles"
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: docs
|
|
path: _docs
|
|
# We'll only use this in a workflow_run, then we're done with it
|
|
retention-days: 1
|
|
|
|
analyse_dead_code:
|
|
name: "Analyse Dead Code"
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
cache: "pnpm"
|
|
node-version-file: package.json
|
|
|
|
- name: Install Deps
|
|
run: "pnpm install --frozen-lockfile"
|
|
|
|
- name: Run linter
|
|
run: "pnpm run lint:knip"
|
|
|
|
element-web:
|
|
name: Downstream tsc element-web
|
|
if: github.event_name == 'merge_group'
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
repository: element-hq/element-web
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
cache: "pnpm"
|
|
node-version: "lts/*"
|
|
|
|
- name: Install Dependencies
|
|
run: "./scripts/layered.sh"
|
|
env:
|
|
# tell layered.sh to check out the right sha of the JS-SDK
|
|
JS_SDK_GITHUB_BASE_REF: ${{ github.sha }}
|
|
|
|
- name: Typecheck
|
|
working-directory: apps/web
|
|
run: "pnpm run lint:types"
|
|
|
|
# Workflow consolidation job
|
|
done:
|
|
needs:
|
|
- ts_lint
|
|
- js_lint
|
|
- node_example_lint
|
|
- workflow_lint
|
|
- docs
|
|
- analyse_dead_code
|
|
- element-web
|
|
name: Static Analysis
|
|
runs-on: ubuntu-24.04
|
|
if: always()
|
|
steps:
|
|
- if: contains(needs.*.result , 'failure') || contains(needs.*.result, 'cancelled')
|
|
run: exit 1
|