diff --git a/.github/workflows/scip.yaml b/.github/workflows/scip.yaml new file mode 100644 index 00000000..6d48db52 --- /dev/null +++ b/.github/workflows/scip.yaml @@ -0,0 +1,48 @@ +name: Scip + +on: + pull_request: + push: + branches: + - master + +permissions: + contents: read + id-token: write + + +# TODO: replace this implementation with gha-dart once this: +# https://github.com/Workiva/gha-dart/pull/7 merges +jobs: + index: + runs-on: workiva-runner-dev + steps: + - uses: actions/checkout@v3 + - uses: dart-lang/setup-dart@v1 + with: + sdk: 2.18.7 + + - run: dart pub get + + - run: dart pub global activate -spath . + + - name: scip index + run: dart pub global run scip_dart ./ + + # provides SRC_ENDPOINT and SRC_ACCESS_TOKEN to the src installation step + - uses: Workiva/gha-setup-credentials@v1.0.0 + with: + vault-url: https://vault-dev.workiva.org + vault-env: dev + + # Install src cli + - name: Install Sourcegraph CLI + run: | + curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o _src-cli + chmod +x _src-cli + ./_src-cli login + echo ./_src-cli endpoint $SRC_ENDPOINT + echo ./_src-cli access token $SRC_ACCESS_TOKEN + + - name: Upload scip to sourcegraph + run: ./_src-cli code-intel upload -file=index.scip -github-token="${{ env.FEF_GH_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 23f147a0..ee8f3cb0 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -35,7 +35,7 @@ jobs: - name: Snapshots Diff Check run: | - dart ./bin/main.dart ./snapshots/input/basic-project + dart run scip_dart ./snapshots/input/basic-project ./scip snapshot --to ./snapshots/output/basic-project if [[ -z "$(git status --porcelain ./snapshots/output)" ]]; @@ -75,4 +75,4 @@ jobs: package-path: ${{ matrix.repo }} - run: | - dart ./bin/main.dart ./${{ matrix.repo }} || exit 1 + dart run scip_dart ./${{ matrix.repo }} || exit 1 diff --git a/README.md b/README.md index 4d4c3c2f..2c917432 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,17 @@ Experimental spike on a [scip](https://github.com/sourcegraph/scip) indexer for Designed to be a replacement for [lsif_indexer](https://github.com/Workiva/lsif_indexer), with better coverage and reliability +## Installation + +```sh +dart pub global activate --hosted-url https://pub.workiva.org scip_dart +``` + ## Usage The following command will output a `index.scip` file ```sh -dart scip-dart/bin/main.dart ./path/to/project/root +dart pub global run scip_dart ./path/to/project/root ``` This file can be analyzed / displayed using the [scip cli](https://github.com/sourcegraph/scip) diff --git a/bin/main.dart b/bin/scip_dart.dart similarity index 100% rename from bin/main.dart rename to bin/scip_dart.dart diff --git a/pubspec.yaml b/pubspec.yaml index 0e53d7b9..2aab2da8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ environment: sdk: ">=2.18.0 <3.0.0" executables: - scip-dart: main.dart + scip_dart: dependencies: analyzer: ^5.4.0