From 239c4825268d0c02af9dc8d6eabbe88bd78989e5 Mon Sep 17 00:00:00 2001 From: Erik Seliger Date: Thu, 9 Jul 2026 11:32:49 +0000 Subject: [PATCH] Add standardized Sourcegraph CI workflows (build checks + code intel) --- .github/workflows/sg-ci-go.yml | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/sg-ci-go.yml diff --git a/.github/workflows/sg-ci-go.yml b/.github/workflows/sg-ci-go.yml new file mode 100644 index 0000000..b1f2e79 --- /dev/null +++ b/.github/workflows/sg-ci-go.yml @@ -0,0 +1,50 @@ +name: SG CI - Go +on: + push: + pull_request: +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - name: gofmt + run: | + out=$(gofmt -l .) + if [ -n "$out" ]; then echo "Unformatted files:"; echo "$out"; exit 1; fi + - name: go vet and build (per module) + run: | + set -e + mods=$(find . -name go.mod -not -path '*/vendor/*') + if [ -z "$mods" ]; then echo "no go.mod found; nothing to vet/build"; exit 0; fi + for mod in $mods; do + dir=$(dirname "$mod") + echo "=== $dir ===" + (cd "$dir" && go vet ./... && go build ./...) + done + code-intel: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: stable + - name: Generate SCIP index (gate) + uses: sourcegraph/scip-go-action@v2 + with: + upload: false + recursive: true + - name: Upload SCIP index (best-effort) + continue-on-error: true + env: + SRC_ENDPOINT: https://demo.sourcegraph.com + SRC_ACCESS_TOKEN: ${{secrets.SRC_ACCESS_TOKEN}} + run: | + curl -sfL https://demo.sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src + chmod +x /usr/local/bin/src + find . -name index.scip -print0 | while IFS= read -r -d '' f; do + echo "Uploading $f" + (cd "$(dirname "$f")" && src code-intel upload -file=index.scip -no-progress) || echo "upload failed for $f (non-blocking)" + done