-
Notifications
You must be signed in to change notification settings - Fork 2
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
175 changed files
with
2,582 additions
and
1,487 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,27 @@ | ||
# This workflow will run backend tests on the Python version defined in the Dockerfiles | ||
|
||
name: Backend unit tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'develop' | ||
- 'master' | ||
- 'feature/**' | ||
- 'bugfix/**' | ||
- 'hotfix/**' | ||
- 'release/**' | ||
- 'dependabot/**' | ||
paths-ignore: | ||
- 'frontend/**' | ||
- '**.md' | ||
|
||
jobs: | ||
backend-test: | ||
name: Test Backend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run backend tests | ||
run: sudo mkdir -p /ci-data && sudo docker-compose --env-file .env-ci run backend pytest |
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,27 @@ | ||
# This workflow will run frontend tests on the Node version defined in the Dockerfiles | ||
|
||
name: Frontend unit tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'develop' | ||
- 'master' | ||
- 'feature/**' | ||
- 'bugfix/**' | ||
- 'hotfix/**' | ||
- 'release/**' | ||
- 'dependabot/**' | ||
paths-ignore: | ||
- 'backend/**' | ||
- '**.md' | ||
|
||
jobs: | ||
frontend-test: | ||
name: Test Frontend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run frontend tests | ||
run: sudo docker-compose --env-file .env-ci run frontend yarn test |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This action will update the CITATION.cff file for new release or hotfix branches | ||
|
||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'release/**' | ||
- 'hotfix/**' | ||
|
||
jobs: | ||
citation-update: | ||
name: Update CITATION.cff | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Autoformat CITATION.cff | ||
run: | | ||
version=`grep -o '\d\+\.\d\+\.\d\+' package.json` | ||
today=`date +"%Y-%m-%d"` | ||
sed -i "s/^version: [[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\.[[:digit:]]\{1,\}/version: $version/" CITATION.cff | ||
sed -i "s/[[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}/$today/" CITATION.cff | ||
bash ./update-citation.sh | ||
git commit -a -m "update version and date in CITATION.cff" | ||
This file was deleted.
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,3 @@ | ||
FROM docker.elastic.co/elasticsearch/elasticsearch:8.10.2 | ||
|
||
RUN bin/elasticsearch-plugin install mapper-annotated-text |
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 |
---|---|---|
@@ -1,31 +1,14 @@ | ||
import pytest | ||
import os | ||
from django.contrib.auth.models import Group | ||
from addcorpus.models import Corpus | ||
|
||
@pytest.fixture() | ||
def group_with_access(db, mock_corpus): | ||
def group_with_access(db, basic_mock_corpus): | ||
'''Create a group with access to the mock corpus''' | ||
group = Group.objects.create(name='nice-users') | ||
corpus = Corpus.objects.get(name=mock_corpus) | ||
corpus = Corpus.objects.get(name=basic_mock_corpus) | ||
corpus.groups.add(group) | ||
corpus.save() | ||
yield group | ||
group.delete() | ||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
@pytest.fixture() | ||
def mock_corpus(): | ||
return 'mock-csv-corpus' | ||
|
||
|
||
@pytest.fixture() | ||
def basic_corpus(): | ||
corpus_name = 'mock-basic-corpus' | ||
basic_group = Group.objects.create(name='basic') | ||
corpus = Corpus.objects.get(name=corpus_name) | ||
corpus.groups.add(basic_group) | ||
yield corpus_name | ||
corpus.groups.remove(basic_group) | ||
basic_group.delete() |
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,147 @@ | ||
import pytest | ||
|
||
@pytest.fixture() | ||
def content_field_json(): | ||
return { | ||
'name': 'content', | ||
'display_name': 'Content', | ||
'description': 'Bla bla bla', | ||
'type': 'text_content', | ||
'language': 'en', | ||
'options': { | ||
'search': True, | ||
'filter': 'none', | ||
'preview': True, | ||
'visualize': True, | ||
'sort': False, | ||
'hidden': False | ||
}, | ||
'extract': {'column': 'content'} | ||
} | ||
|
||
@pytest.fixture() | ||
def keyword_field_json(): | ||
return { | ||
'name': 'author', | ||
'display_name': 'Author', | ||
'description': 'Author of the text', | ||
'type': 'text_metadata', | ||
'options': { | ||
'search': True, | ||
'filter': 'show', | ||
'preview': True, | ||
'visualize': True, | ||
'sort': False, | ||
'hidden': False | ||
}, | ||
'extract': {'column': 'author'} | ||
} | ||
|
||
@pytest.fixture() | ||
def int_field_json(): | ||
return { | ||
'name': 'year', | ||
'display_name': 'Year', | ||
'description': 'Year in which the text was written', | ||
'type': 'integer', | ||
'options': { | ||
'search': False, | ||
'filter': 'show', | ||
'preview': False, | ||
'visualize': True, | ||
'sort': True, | ||
'hidden': False | ||
}, | ||
'extract': {'column': 'year'} | ||
} | ||
|
||
@pytest.fixture() | ||
def float_field_json(): | ||
return { | ||
'name': 'ocr_confidence', | ||
'display_name': 'OCR confidence', | ||
'description': 'Confidence level of optical character recognition output', | ||
'type': 'float', | ||
'options': { | ||
'search': False, | ||
'filter': 'hide', | ||
'preview': False, | ||
'visualize': False, | ||
'sort': False, | ||
'hidden': False | ||
}, | ||
'extract': {'column': 'ocr'} | ||
} | ||
|
||
@pytest.fixture() | ||
def date_field_json(): | ||
return { | ||
'name': 'date', | ||
'display_name': 'Date', | ||
'description': 'Date on which the text was written', | ||
'type': 'date', | ||
'options': { | ||
'search': False, | ||
'filter': 'show', | ||
'preview': True, | ||
'visualize': True, | ||
'sort': True, | ||
'hidden': False | ||
}, | ||
'extract': {'column': 'date'} | ||
} | ||
|
||
@pytest.fixture() | ||
def boolean_field_json(): | ||
return { | ||
'name': 'author_known', | ||
'display_name': 'Author known', | ||
'description': 'Whether the author of the text is known', | ||
'type': 'boolean', | ||
'options': { | ||
'search': False, | ||
'filter': 'show', | ||
'preview': False, | ||
'visualize': True, | ||
'sort': False, | ||
'hidden': False | ||
}, | ||
'extract': {'column': 'author_known'} | ||
} | ||
|
||
@pytest.fixture() | ||
def geo_field_json(): | ||
return { | ||
'name': 'location', | ||
'display_name': 'Location', | ||
'description': 'Location where the text was published', | ||
'type': 'geo_point', | ||
'options': { | ||
'search': False, | ||
'filter': 'none', | ||
'preview': False, | ||
'visualize': False, | ||
'sort': False, | ||
'hidden': False | ||
}, | ||
'extract': {'column': 'location'} | ||
} | ||
|
||
@pytest.fixture( | ||
params=['content', 'keyword', 'int', 'float', 'date', 'boolean', 'geo'] | ||
) | ||
def any_field_json( | ||
request, content_field_json, keyword_field_json, int_field_json, float_field_json, | ||
date_field_json, boolean_field_json, geo_field_json | ||
): | ||
field_type = request.param | ||
funcs = { | ||
'content': content_field_json, | ||
'keyword': keyword_field_json, | ||
'int': int_field_json, | ||
'float': float_field_json, | ||
'date': date_field_json, | ||
'boolean': boolean_field_json, | ||
'geo': geo_field_json, | ||
} | ||
return funcs[field_type] |
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,2 @@ | ||
DEFAULT_CSV_DELIMITER = ',' | ||
DATE_FORMAT = '%Y-%m-%d' |
Oops, something went wrong.