mirror of
https://github.com/pezkuwichain/pezkuwi-subquery.git
synced 2026-10-20 18:56:24 +00:00
deploy-vps reached subquery1 as root, through appleboy/ssh-action referenced by tag, with a key whose comment (mamostehp@MamostePC) made it look like a person's. It now uses plain ssh with SUBQUERY_DEPLOY_KEY, which the host pins (authorized_keys restrict,command=) to ops/host/subquery-deploy-ssh: the commit SHA is its only input. subquery-deploy, run through sudo, does what the workflow's script did, with three changes: - It deploys exactly the SHA CI was triggered for, and only a commit on main. - The host's local edits to tracked files (the indexer manifests) are put back whether the deploy succeeds or fails. Before, a failed build exited before `stash pop` and left them stashed. - Only tracked files are stashed. Stashing untracked ones too (.yarn/, which yarn install recreates) made every pop fail half-way; that is how 13 stash entries piled up on the host. test-deploy.sh covers this against a scratch clone (red with the restore trap removed); CI runs it with shellcheck. subquery1's host key is pinned. The indexer endpoints themselves are unchanged. Actions pinned to SHAs; the secret scanner's own AGPL licence is allowed in dependency review.
123 lines
3.2 KiB
YAML
123 lines
3.2 KiB
YAML
name: Code Quality
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
lint:
|
|
name: ESLint
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Enable Corepack
|
|
run: corepack enable
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --immutable
|
|
|
|
- name: Run ESLint
|
|
run: yarn eslint src/ --ext .ts --max-warnings 0
|
|
continue-on-error: true
|
|
|
|
format:
|
|
name: Prettier
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Enable Corepack
|
|
run: corepack enable
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --immutable
|
|
|
|
- name: Check formatting
|
|
run: yarn prettier --check "src/**/*.ts"
|
|
|
|
typecheck:
|
|
name: TypeScript
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Enable Corepack
|
|
run: corepack enable
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --immutable
|
|
|
|
- name: Generate types
|
|
run: ./node_modules/.bin/subql codegen pezkuwi.yaml
|
|
|
|
- name: TypeScript check
|
|
run: yarn tsc --noEmit
|
|
|
|
complexity:
|
|
name: Code Complexity
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Install complexity checker
|
|
run: npm install -g complexity-report
|
|
|
|
- name: Check complexity
|
|
run: |
|
|
cr src/**/*.ts --format json > complexity-report.json || true
|
|
HIGH_COMPLEXITY=$(cat complexity-report.json 2>/dev/null | jq '[.reports[].functions[] | select(.cyclomatic > 15)] | length' 2>/dev/null || echo "0")
|
|
if [ "$HIGH_COMPLEXITY" -gt 0 ]; then
|
|
echo "::warning::Found $HIGH_COMPLEXITY functions with cyclomatic complexity > 15"
|
|
fi
|
|
|
|
duplicate-code:
|
|
name: Duplicate Code Detection
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Install jscpd
|
|
run: npm install -g jscpd
|
|
|
|
- name: Check for duplicates
|
|
run: jscpd src/ --min-lines 10 --min-tokens 50 --threshold 5
|
|
continue-on-error: true
|