From 94d3bc0ef9844f33aaaed9358c0383c43c25efdf Mon Sep 17 00:00:00 2001 From: williamfzc <178894043@qq.com> Date: Mon, 17 Jul 2023 13:50:40 +0800 Subject: [PATCH] chore(ci): add python project for test --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++------------ parser/api.go | 5 ++++- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d061cf..4305b47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,8 @@ jobs: with: go-version: 1.19 - - name: Prepare test source + # smoke test + - name: Create index file run: | curl -L https://github.com/sourcegraph/lsif-go/releases/download/v1.9.3/src_linux_amd64 -o /usr/local/bin/lsif-go chmod +x /usr/local/bin/lsif-go @@ -32,12 +33,15 @@ jobs: - name: Cmd Test run: | make - ./srctx diff --outputHtml output.html + ./srctx diff --outputHtml output.html --outputJson output.json + cat ./output.json + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + + # smoke test done, start heavy test - name: Set up Node.js uses: actions/setup-node@v3 - with: - node-version: '14.16.0' - name: Build Extra Dep (scip-java) run: | @@ -53,32 +57,43 @@ jobs: npm install -g lsif lsif -v + - name: Build Extra Dep (scip-python) + run: | + npm install -g @sourcegraph/scip-python + scip-python -V + - name: Third Party Test (Golang) run: | - git clone https://github.com/gin-gonic/gin --depth=2 + git clone https://github.com/gin-gonic/gin --depth=6 cd gin lsif-go -v - ../srctx diff --outputHtml ../golang.html --outputJson ../golang.json + ../srctx diff --before HEAD~5 --outputHtml ../golang.html --outputJson ../golang.json cd .. cat ./golang.json - name: Third Party Test (Java) run: | - git clone https://github.com/junit-team/junit4 --depth=2 + git clone https://github.com/junit-team/junit4 --depth=6 cd junit4 ../scip-java index -- package -DskipTests --batch-mode --errors --settings .github/workflows/settings.xml - ../srctx diff --scip ./index.scip --outputHtml ../java.html --outputJson ../java.json + ../srctx diff --before HEAD~5 --scip ./index.scip --outputHtml ../java.html --outputJson ../java.json cd .. cat ./java.json - name: Thrid Party Test (Node) run: | - git clone https://github.com/microsoft/lsif-node.git --depth=2 + git clone https://github.com/microsoft/lsif-node.git --depth=6 cd lsif-node lsif tsc -p ./tsconfig.json --package ./package.json --noContents --out ./dump.lsif - ../srctx diff --lsif ./dump.lsif --outputHtml ../node.html --outputJson ../node.json + ../srctx diff --before HEAD~5 --lsif ./dump.lsif --outputHtml ../node.html --outputJson ../node.json cd .. cat ./node.json - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + - name: Thrid Party Test (Python) + run: | + git clone https://github.com/psf/requests.git --depth=6 + cd requests + scip-python index . --project-name requests + ../srctx diff --before HEAD~5 --scip ./index.scip --outputHtml ../python.html --outputJson ../python.json + cd .. + cat ./python.json diff --git a/parser/api.go b/parser/api.go index 28607bb..b1834fe 100644 --- a/parser/api.go +++ b/parser/api.go @@ -249,6 +249,7 @@ func FromParser(readyParser *lsif.Parser) (*object.SourceContext, error) { finalResultSetId := resultSetId for ok { if resultSetId, ok = readyParser.Docs.Ranges.NextMap[resultSetId]; ok { + log.Debugf("result set id offset: %d -> %d", finalResultSetId, resultSetId) finalResultSetId = resultSetId } } @@ -256,7 +257,9 @@ func FromParser(readyParser *lsif.Parser) (*object.SourceContext, error) { foundDefinitionResult, ok := readyParser.Docs.Ranges.TextDefinitionMap[resultSetId] if !ok { - log.Warnf("failed to jump with reference map: %v", resultSetId) + // this result set may not exist for def/ref + // maybe moniker + log.Warnf("result set %d is not related to any def/ref", resultSetId) continue }