Skip to content

SCIP index uploading #151

SCIP index uploading

SCIP index uploading #151

name: SCIP index uploading
on:
schedule:
- cron: '0 0 * * *' # Run every day at midnight UTC
workflow_dispatch: # Allow manual triggering
permissions:
contents: read
jobs:
index:
if: github.repository == 'sourcegraph/scip' # Skip running on forks
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false # If a job fails allow others to continue
matrix:
# If this list of targets changes, update the list of
# precise code navigation examples at:
# https://github.com/sourcegraph/docs/blob/main/docs/code-search/code-navigation/precise_code_navigation.mdx#precise-navigation-examples
target:
- repository: kubernetes/kubernetes
scip_binary: scip-go
scip_args: "--verbose"
- repository: google/guava
scip_binary: scip-java
scip_args: "index --verbose"
# scip-java has problems with indexing Kotlin codebase
# - repository: arrow-kt/arrow
# scip_binary: scip-java
# scip_args: "index --verbose"
- repository: apache/pekko
scip_binary: scip-java
scip_args: "index --verbose"
- repository: Textualize/rich
scip_binary: scip-python
scip_args: "index ."
- repository: vuejs/core
scip_binary: scip-typescript
scip_args: "index"
- repository: Homebrew/brew
scip_binary: scip-ruby
# We pass gem-metadata as an easy alternative to directly
# linking to brew/Library/Homebrew/Gemfile.lock.
scip_args: "--gem-metadata homebrew@latest ."
- repository: serde-rs/serde
scip_binary: scip-rust
scip_args: ""
- repository: fmtlib/fmt
scip_binary: scip-clang
scip_args: ""
- repository: serilog/serilog
scip_binary: scip-dotnet
scip_args: "index"
container: sourcegraph/${{ matrix.target.scip_binary }}:latest
concurrency:
group: index-${{ matrix.target.repository }}
cancel-in-progress: true
steps:
- name: Checkout ${{ matrix.target.repository }}
uses: actions/checkout@v5
with:
repository: ${{ matrix.target.repository }}
fetch-depth: 1
- name: Generate compile_commands.json
if: ${{ matrix.target.scip_binary == 'scip-clang' }}
run: |
apt-get update
apt-get install -y bear cmake make g++
cmake -S . -B build
bear -- make -C build
- name: Install Go
if: ${{ matrix.target.scip_binary == 'scip-go' }}
uses: actions/setup-go@v5
with: { go-version-file: 'go.mod' }
- name: Cache Maven dependencies
if: ${{ matrix.target.scip_binary == 'scip-java' }}
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ matrix.target.repository }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-maven-${{ matrix.target.repository }}-
${{ runner.os }}-maven-
- name: Install curl
if: ${{ matrix.target.scip_binary == 'scip-ruby' }}
run: |
apk add --no-cache curl
- name: Setup Rust toolchain
if: ${{ matrix.target.scip_binary == 'scip-rust' }}
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rust-analyzer
- name: Run SCIP
run: |
${{ matrix.target.scip_binary }} --version
${{ matrix.target.scip_binary }} ${{ matrix.target.scip_args }}
- name: Validate SCIP index size
run: |
size=$(stat -c%s index.scip) || {
echo "ERROR: Failed to get SCIP index size"
exit 1
}
if [ "$size" -lt 1000000 ]; then
echo "ERROR: SCIP dump suspiciously small (< 1MB)"
exit 1
fi
echo "SCIP dump size: $(du -h index.scip)"
- name: Configure git safe.directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Get src-cli
run: |
curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 \
-o /usr/local/bin/src
chmod +x /usr/local/bin/src
- name: Upload SCIP dump to Sourcegraph
run: |
src code-intel upload -no-progress \
-repo=github.com/${{ matrix.target.repository }} \
-file=index.scip
env:
SRC_ENDPOINT: https://sourcegraph.com/
# A repo-local secret with access token for a Service Account
# that has a role allowing SCIP index upload.
SRC_ACCESS_TOKEN: ${{ secrets.SRC_ACCESS_TOKEN_DOTCOM_SCIP_SA }}