Skip to content

Commit 16c6284

Browse files
committed
Add standardized Sourcegraph CI workflows (build checks + code intel)
1 parent e148ad7 commit 16c6284

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/sg-ci-node.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: SG CI - Node
2+
on:
3+
push:
4+
pull_request:
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-node@v4
11+
with:
12+
node-version: 20
13+
- name: Install deps
14+
run: |
15+
corepack enable || true
16+
if [ -f yarn.lock ]; then yarn install --frozen-lockfile || yarn install || true;
17+
elif [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile || pnpm install || true;
18+
elif [ -f package-lock.json ]; then npm ci || npm install || true;
19+
elif [ -f package.json ]; then npm install || true;
20+
else echo "no manifest"; fi
21+
- name: Typecheck
22+
run: |
23+
if [ -f tsconfig.json ]; then npx --yes -p typescript tsc -p tsconfig.json --noEmit;
24+
else for f in $(git ls-files '*.js' '*.jsx' | head -n 300); do node --check "$f"; done; fi
25+
code-intel:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
- name: Install scip-typescript and src-cli
33+
run: |
34+
npm install -g @sourcegraph/scip-typescript
35+
curl -sfL https://demo.sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
36+
chmod +x /usr/local/bin/src
37+
- name: Index and upload
38+
env:
39+
SRC_ENDPOINT: https://demo.sourcegraph.com
40+
SRC_ACCESS_TOKEN: ${{secrets.SRC_ACCESS_TOKEN}}
41+
run: |
42+
npm install || true
43+
scip-typescript index --infer-tsconfig --no-progress || scip-typescript index || true
44+
if [ -f index.scip ]; then src code-intel upload -no-progress; else echo "no index produced"; fi

0 commit comments

Comments
 (0)