Skip to content

Commit

Permalink
build: only run Go tests when Go files change, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Feb 7, 2025
1 parent f0ae165 commit 753c627
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'CI'

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request: {}

permissions:
id-token: write
contents: read
pull-requests: read

jobs:
detect_changes:
name: Detect file changes
runs-on: ubuntu-latest
outputs:
go_changes: ${{ steps.go_changes.outputs.src }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: go_changes
with:
filters: |
src:
- go.mod
- '**/*.go'
go:
needs: detect_changes
if: ${{ needs.detect_changes.outputs.go_changes == 'true' }}
uses: ./.github/workflows/go.yml
name: Go Tests
secrets: inherit
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
# deepparse-go

Go client for GRAAL-Research/deepparse
[![GoDoc](https://godoc.org/github.com/adamdecaf/deadcheck?status.svg)](https://godoc.org/github.com/adamdecaf/deepparse-go)
[![Build Status](https://github.com/adamdecaf/deepparse-go/workflows/Go/badge.svg)](https://github.com/adamdecaf/deepparse-go/actions)
[![Coverage Status](https://codecov.io/gh/adamdecaf/deepparse-go/branch/master/graph/badge.svg)](https://codecov.io/gh/adamdecaf/deepparse-go)
[![Go Report Card](https://goreportcard.com/badge/github.com/adamdecaf/deepparse-go)](https://goreportcard.com/report/github.com/adamdecaf/deepparse-go)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/adamdecaf/deepparse-go/master/LICENSE)


https://github.com/GRAAL-Research/deepparse
Go client for [GRAAL-Research/deepparse](https://github.com/GRAAL-Research/deepparse)'s [HTTP API](https://deepparse.org/api.html).

https://github.com/GRAAL-Research/deepparse/pkgs/container/deepparse
## Usage

Import the Go library and create a client to start parsing addresses. Requires a running instance of deepparse.

```go
httpClient := &http.Client{
Timeout: 5 * time.Second,
}
cc := NewClient(httpClient, "http://localhost:8000")

ctx := context.Background()
resp, err := cc.ParseAddresses(ctx, ModelBPEmbAttention, []string{
"350 rue des Lilas Ouest Quebec city Quebec G1L 1B6",
"2325 Rue de l'Université, Québec, QC G1V 0A6",
})

// handle resp.Addresses
```

## Contributing

The tests require pulling the [ghcr.io/graal-research/deepparse](https://github.com/GRAAL-Research/deepparse/pkgs/container/deepparse) image.

Pull and start the container before running Go tests:

```
$ docker compose up -d # takes a while to download and load data
```

```
$ go test ./...
ok github.com/adamdecaf/deepparse-go 0.773s
```

## License

MIT Licensed

0 comments on commit 753c627

Please sign in to comment.