Skip to content

Updated snippet runners to find new data directory and updated README.md files for SENZING_PATH #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/csharp-darwin-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ jobs:

- name: configure environment
run: |
SENZING_DIR="${HOME}/senzing/er"
SENZING_PATH="${HOME}/senzing"
{
echo "SENZING_DIR=${SENZING_DIR}"
echo "DYLD_LIBRARY_PATH=${SENZING_DIR}/lib"
echo "DYLD_LIBRARY_PATH=${SENZING_PATH}/er/lib"
} >> "$GITHUB_ENV"

- name: configure local nuget repo
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/csharp-windows-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ jobs:

- name: Add to "Path" environment variable
run: |
Add-Content $env:GITHUB_PATH "$Env:USERPROFILE\Senzing\er\lib"
Add-Content $env:GITHUB_PATH "$Env:USERPROFILE\senzing\er\lib"

- name: run csharp snippets
run: |
$Env:SENZING_DIR = "$Env:USERPROFILE\Senzing\er"
cd ${Env:GITHUB_WORKSPACE}/csharp/runner
dotnet run --project SnippetRunner all
6 changes: 3 additions & 3 deletions .github/workflows/java-darwin-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:

- name: configure environment
run: |
SENZING_DIR="${HOME}/senzing/er"
SENZING_PATH="${HOME}/senzing"
{
echo "SENZING_DIR=${SENZING_DIR}"
echo "DYLD_LIBRARY_PATH=${SENZING_DIR}/lib:${SENZING_DIR}/lib/macos"
echo "SENZING_PATH=${SENZING_PATH}"
echo "DYLD_LIBRARY_PATH=${SENZING_PATH}/er/lib:${SENZING_PATH}/er/lib/macos"
} >> "$GITHUB_ENV"

- name: build with Maven
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-linux-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: build with Maven
env:
SENZING_DIR: "/opt/senzing/er"
SENZING_PATH: "/opt/senzing"
run: |
cd "${GITHUB_WORKSPACE}"/java
mvn clean package
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/java-windows-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ jobs:

- name: build with Maven
run: |
$Env:SENZING_DIR = "$Env:USERPROFILE\Senzing\er"
$Env:SENZING_PATH = "$Env:USERPROFILE\senzing"
cd "${Env:GITHUB_WORKSPACE}/java"
mvn clean install

- name: Add to "Path" environment variable
run: |
Add-Content $env:GITHUB_PATH "$Env:USERPROFILE\Senzing\er\lib"
Add-Content $env:GITHUB_PATH "$Env:USERPROFILE\senzing\er\lib"

- name: run java snippets
run: |
cd "${Env:GITHUB_WORKSPACE}/java"
java "-Dsenzing.install.dir=$Env:USERPROFILE\Senzing\er" -jar target/sz-sdk-snippets.jar all
java -jar target/sz-sdk-snippets.jar all
42 changes: 32 additions & 10 deletions csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@ Before attempting to build the snippets you will need to make the make the
`Senzing.Sdk.[version].nupkg` file available to the `dotnet` executable so
it can be used as a dependency. This is done via these [instructions](https://github.com/senzing-garage/sz-sdk-csharp/blob/main/README.md#Usage).

Further, you will need to set environment variables so the Senzing installation can be located:

- Linux:

```console
export SENZING_PATH=/opt/senzing/
export LD_LIBRARY_PATH=$SENZING_PATH/er/lib:$LD_LIBRARY_PATH
```

- macOS:

```console
export SENZING_PATH=$HOME/senzing
export DYLD_LIBRARY_PATH=$SENZING_PATH/er/lib:$SENZING_PATH/er/lib/macos:$DYLD_LIBRARY_PATH
```

- Windows:

```console
set SENZING_PATH=%USERPROFILE%\senzing
set Path=%SENZING_PATH%\er\lib;%Path%
```

## Building

The C# snippets can built using the `dotnet build [project-name]` command under each directory. They can be run using `dotnet run --project [project-name]` command. Attempting to run a snippet will also trigger building it.
Expand All @@ -23,22 +46,21 @@ You may run any individual Snippet class directly providing you have a Senzing r

1. Run a snippet that takes no command-line arguments.

```[shell]
```console
cd snippets
dotnet run --project loading/LoadRecords
```

2. Run a snippet and override the input file using command-line arguments

```[shell]
```console
dotnet run --project loading/LoadRecordsViaLoop ../../resources/data/load-500-with-errors.jsonl
```

### Run via Runner

The `SnippetRunner` project will run one or more snippets for you and create a temporary Senzing repository to run then against. This can be executed using:

```[shell]
```console
cd runner
dotnet run --project SnippetRunner
```
Expand All @@ -47,42 +69,42 @@ The `SnippetRunner` project will run one or more snippets for you and create a t

1. Execute all code snippets:

```[shell]
```console
cd runner
dotnet run --project SnippetRunner all
```

2. Execute all code snippets in a group:

```[shell]
```console
cd runner
dotnet run --project SnippetRunner loading
```

3. Execute all code snippets from multiple groups:

```[shell]
```console
cd runner
dotnet run --project SnippetRunner loading redo
```

4. Execute specific code snippets:

```[shell]
```console
cd runner
dotnet run --project SnippetRunner loading.LoadViaLoop loading.LoadViaQueue
```

5. Mix and match packages with individual snippets:

```[shell]
```console
cd runner
dotnet run --project SnippetRunner redo loading.LoadViaLoop
```

6. Generate a help message by specifying no arguments:

```[shell]
```console
cd runner
dotnet run --project SnippetRunner

Expand Down
Loading
Loading