Add standardized Sourcegraph CI (build checks + code intel) #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SG CI - Node | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install deps | |
| run: | | |
| corepack enable || true | |
| if [ -f yarn.lock ]; then yarn install --frozen-lockfile || yarn install || true; | |
| elif [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile || pnpm install || true; | |
| elif [ -f package-lock.json ]; then npm ci || npm install || true; | |
| elif [ -f package.json ]; then npm install || true; | |
| else echo "no manifest"; fi | |
| - name: Typecheck | |
| run: | | |
| if [ -f tsconfig.json ]; then npx --yes -p typescript tsc -p tsconfig.json --noEmit; | |
| else | |
| # These are concatenated CodeSearchNet corpus files, not a coherent | |
| # program, so duplicate declarations across samples are expected. | |
| # Run a best-effort syntax scan without failing the job. | |
| for f in $(git ls-files '*.js' '*.jsx' | head -n 300); do node --check "$f" || true; done; | |
| fi | |
| code-intel: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install scip-typescript and src-cli | |
| run: | | |
| npm install -g @sourcegraph/scip-typescript | |
| curl -sfL https://demo.sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src | |
| chmod +x /usr/local/bin/src | |
| - name: Index and upload | |
| env: | |
| SRC_ENDPOINT: https://demo.sourcegraph.com | |
| SRC_ACCESS_TOKEN: ${{secrets.SRC_ACCESS_TOKEN}} | |
| run: | | |
| npm install || true | |
| scip-typescript index --infer-tsconfig --no-progress || scip-typescript index || true | |
| if [ -f index.scip ]; then src code-intel upload -no-progress; else echo "no index produced"; fi |