Skip to content

Commit bf9f7eb

Browse files
committed
Update readme with better instructions. Use correct CWD in Docker image
1 parent 7fbe0c5 commit bf9f7eb

File tree

3 files changed

+94
-17
lines changed

3 files changed

+94
-17
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.formatOnSave": true
3+
}

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ ADD . /scip-dotnet
44
RUN dotnet pack
55
ENV PATH="/root/.dotnet/tools:${PATH}"
66
RUN dotnet tool install --add-source ScipDotnet/bin/Debug/ --global scip-dotnet
7-
RUN rm -rf /scip-dotnet
7+
RUN rm -rf /scip-dotnet
8+
WORKDIR /root

readme.md

Lines changed: 89 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,62 @@ SCIP indexer for the C# programming language.
44

55
## Getting started
66

7-
This project is not yet published so the only way to run the indexer is by building it from [source locally](#running-locally).
8-
This section will be updated in the future when it's possible to run pre-built binaries.
7+
The easiest way to run `scip-dotnet` is to run it through the
8+
`sourcegraph/scip-dotnet` Docker image.
99

10-
## Running locally
10+
### Docker image
1111

12-
First, install .NET https://dotnet.microsoft.com/en-us/download/dotnet-framework.
12+
Execute `docker run` to index a codebase with `scip-dotnet`.
13+
14+
```sh
15+
docker run -v $(pwd):/root sourcegraph/scip-dotnet:latest scip-dotnet index
16+
```
17+
18+
Once this command finishes then you should have an `index.scip` file that you
19+
can upload to Sourcegraph with `src code-intel upload`.
20+
21+
```sh
22+
npm install -g @sourcegraph/src
23+
export SRC_ACCESS_TOKEN=PASTE_YOUR_ACCESS_TOKEN
24+
export SRC_ENDPOINT=https://sourcegraph.com
25+
src code-intel upload
26+
```
27+
28+
### Local install
29+
30+
The following steps show you how to install a `scip-dotnet` command-line tool to
31+
your local computer.
32+
33+
First, install .NET
34+
https://dotnet.microsoft.com/en-us/download/dotnet-framework.
35+
36+
Next, run `dotnet tool install`.
37+
38+
```sh
39+
dotnet tool install --global scip-dotnet
40+
scip-dotnet --version
41+
```
42+
43+
Finally, run `scip-dotnet index` at the root of your project to index the
44+
codebase.
45+
46+
```sh
47+
cd PATH_TO_CSHARP_PROJECT
48+
scip-dotnet index
49+
```
50+
51+
If you already have `scip-dotnet` installed you will get an error message saying
52+
"Tool 'scip-dotnet' is already installed.". To fix this problem, run the command
53+
`dotnet tool update --global scip-dotnet` to update to the latest version.
54+
55+
## Contributing
56+
57+
The section below is only relevant for contributors to this repository.
58+
59+
## Building from source
60+
61+
First, install .NET
62+
https://dotnet.microsoft.com/en-us/download/dotnet-framework.
1363

1464
Next, clone this repo locally:
1565

@@ -19,12 +69,15 @@ cd scip-dotnet
1969
```
2070

2171
Finally, use `dotnet run` to run the indexer locally.
72+
2273
```shell
2374
dotnet run --framework net6.0 --project ScipDotnet -- index --working-directory PATH_TO_DIRECTORY_YOU_WANT_TO_INDEX
2475
```
2576

26-
Once scip-dotnet has finished indexing the project, there should be an `index.scip` at the root of the
27-
directory you've indexed. Use `src code-intel upload` to upload the SCIP index to Sourcegraph.
77+
Once scip-dotnet has finished indexing the project, there should be an
78+
`index.scip` at the root of the directory you've indexed. Use
79+
`src code-intel upload` to upload the SCIP index to Sourcegraph.
80+
2881
```shell
2982
npm install -g @sourcegraph/src
3083
export SRC_ACCESS_TOKEN=PASTE_YOUR_TOKEN_HERE
@@ -34,13 +87,17 @@ src code-intel upload
3487

3588
## Testing
3689

37-
This project heavily uses "snapshot" or "expect" tests.
38-
See [Verify](https://github.com/VerifyTests/Verify), ["Testing with expectations"](https://blog.janestreet.com/testing-with-expectations/)
39-
or ["Snapshot Testing"](https://jestjs.io/docs/snapshot-testing) to learn more about this style of testing.
90+
This project heavily uses "snapshot" or "expect" tests. See
91+
[Verify](https://github.com/VerifyTests/Verify),
92+
["Testing with expectations"](https://blog.janestreet.com/testing-with-expectations/)
93+
or ["Snapshot Testing"](https://jestjs.io/docs/snapshot-testing) to learn more
94+
about this style of testing.
95+
96+
Run `dotnet test` to run all tests. The tests fail with a unified diff output
97+
when the generated SCIP index does not format according to the generated
98+
snapshot output in the directory `snapshots/output/` .
4099

41-
Run `dotnet test` to run all tests.
42-
The tests fail with a unified diff output when the generated SCIP index does not format according to the generated snapshot output in the directory `snapshots/output/` .
43-
```diff
100+
````diff
44101
❯ dotnet test
45102
...
46103
A total of 1 test files matched the specified pattern.
@@ -52,12 +109,28 @@ A total of 1 test files matched the specified pattern.
52109
+ // documentation ```cs\npublic Main.Expressions.TargetType.TargetType(System.String name)\n```
53110

54111
...
55-
```
112+
````
113+
114+
If you're happy with the new behavior, run
115+
`SCIP_UPDATE_SNAPSHOTS=true dotnet test` to update the snapshot tests.
116+
117+
## Releasing a new version
118+
119+
First, make sure that you are on the latest `main` branch and have no dirty
120+
changes.
121+
122+
Next, figure out the correct version number by finding the current in
123+
[ScipDotnet.cspro](ScipDotnet/ScipDotnet.csproj).
56124

57-
If you're happy with the new behavior, run `SCIP_UPDATE_SNAPSHOTS=true dotnet test` to update the snapshot tests.
125+
Next, run the `./release.sh NEW_VERSION`. For example, run `./release.sh 1.2.0`
126+
to release the version 1.2.0. The script commits the necessary changes and
127+
pushes a git tag, which triggers a CI job that publishes assemblies to NuGet and
128+
the Docker image to Docker Hub.
58129

59130
## Editor support
60131

61-
We recommend using [JetBrains Rider](https://www.jetbrains.com/rider/) to work on this codebase.
132+
We recommend using [JetBrains Rider](https://www.jetbrains.com/rider/) to work
133+
on this codebase.
62134

63-
The snapshot testing project is independent from the main solution and should be opened as a separate Rider window.
135+
The snapshot testing project is independent from the main solution and should be
136+
opened as a separate Rider window.

0 commit comments

Comments
 (0)