-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
537 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build container image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image: | ||
type: string | ||
description: "Version to build" | ||
required: true | ||
push: | ||
type: boolean | ||
description: "Whether to push the container image or not" | ||
default: false | ||
|
||
jobs: | ||
build_container_image: | ||
name: Build container image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Docker | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build container image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: ${{ inputs.push }} | ||
tags: ${{ inputs.image }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build and test | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
- name: Install poetry | ||
uses: abatilo/actions-poetry@v4 | ||
- name: Setup a local virtual environment | ||
run: | | ||
poetry config virtualenvs.create true --local | ||
poetry config virtualenvs.in-project true --local | ||
- uses: actions/cache@v3 | ||
name: Define a cache for the virtual environment based on the dependencies lock file | ||
with: | ||
path: ./.venv | ||
key: venv-${{ hashFiles('poetry.lock') }} | ||
- name: Install the project dependencies | ||
run: poetry install | ||
- name: Run the automated tests (for example) | ||
run: poetry run pytest -v | ||
build: | ||
uses: ./.github/workflows/docker.yml | ||
needs: [test] | ||
with: | ||
image: europe-west1-docker.pkg.dev/marble-infra/marble/marble-ner:dev | ||
push: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from fastapi.testclient import TestClient | ||
from main import app | ||
|
||
client = TestClient(app) | ||
|
||
def test_healthcheck(): | ||
response = client.get('/-/health') | ||
|
||
assert response.status_code == 200 | ||
|
||
def test_detection(): | ||
response = client.post('/detect', json={"text": "dinner with joe finnigan"}) | ||
|
||
assert response.status_code == 200 | ||
|
||
json = response.json() | ||
|
||
assert len(json) == 1 | ||
assert json[0]['type'] == "Person" | ||
assert json[0]['text'] == "joe finnigan" |