Skip to content

Commit

Permalink
chore(ci): add python project for test
Browse files Browse the repository at this point in the history
  • Loading branch information
williamfzc committed Jul 17, 2023
1 parent c30ae7e commit 94d3bc0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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
5 changes: 4 additions & 1 deletion parser/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,17 @@ 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
}
}
resultSetId = finalResultSetId

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
}

Expand Down

0 comments on commit 94d3bc0

Please sign in to comment.