Skip to content

Commit

Permalink
Merge pull request #7 from arthur-schnitzler/main
Browse files Browse the repository at this point in the history
tests and some other things
  • Loading branch information
csae8092 authored Dec 20, 2023
2 parents ab6a65d + 8259fc4 commit 2c84572
Show file tree
Hide file tree
Showing 121 changed files with 1,085 additions and 56,403 deletions.
10 changes: 5 additions & 5 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
POSTGRES_DB=pmb
POSTGRES_USER=pmb
POSTGRES_PASSWORD=pmb
POSTGRES_HOST=172.17.0.1
DEBUG=True
POSTGRES_DB=pmb_play
# NEW_PMB=True
# POSTGRES_HOST=172.17.0.1
DEBUG=True
POSTGRES_HOST=127.0.0.1
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test
on:
push:
jobs:
test:
name: Test Application
runs-on: ubuntu-latest
env:
POSTGRES_DB: github_actions
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
pip install --upgrade --upgrade-strategy eager -r requirements_dev.txt
- name: Run migrations
run: |
export NEW_PMB=TRUE
python manage.py migrate
unset NEW_PMB
- name: Run tests
run: coverage run manage.py test -v 3
- name: Create Coverage Report
run: coverage xml
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.xml
fail_ci_if_error: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,4 @@ tmp/
pmb_dump.sql
.secret
play.ipynb
pmb_play_dump.sql
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![flake8 Lint](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/lint.yml/badge.svg)](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/lint.yml)
<!-- [![Build and publish Docker image](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/build-deploy.yml/badge.svg)](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/build-deploy.yml) -->

[![Test](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/test.yml/badge.svg)](https://github.com/arthur-schnitzler/pmb-service/actions/workflows/test.yml)
# PMB-SERVICE

lightweight APIS-PMB instance to generate TEI/XML dumps
Expand All @@ -12,4 +11,9 @@ maybe in future also with PMB CRUD included

### process gnd-beacon

`python manage.py process_beacon --beacon=https://thun-korrespondenz.acdh.oeaw.ac.at/beacon.txt --domain=thun-korrespondenz`
`python manage.py process_beacon --beacon=https://thun-korrespondenz.acdh.oeaw.ac.at/beacon.txt --domain=thun-korrespondenz`


## set up new instance

in order to avoid errors on a new instance you'll need to set an environment variable `PMB_NEW=whatever`. After you run the inital `python manage.py migrate` you should `unset PMB_NEW`
2 changes: 0 additions & 2 deletions apis_core/.vscode/settings.json

This file was deleted.

5 changes: 0 additions & 5 deletions apis_core/api_routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def generic_serializer_creation_factory():
select_related.append(f.name)

class TemplateSerializer(serializers.HyperlinkedModelSerializer):

id = serializers.ReadOnlyField()
url = serializers.HyperlinkedIdentityField(
view_name=f"apis:apis_api:{entity_str.lower()}-detail"
Expand All @@ -207,7 +206,6 @@ class TemplateSerializer(serializers.HyperlinkedModelSerializer):
_app_label = app_label

class Meta:

model = entity
exclude = exclude_lst_fin

Expand Down Expand Up @@ -269,7 +267,6 @@ def __init__(self, *args, **kwargs):
) = f"{entity_str.title().replace(' ', '')}Serializer"

class TemplateSerializerRetrieve(TemplateSerializer):

if entity_str.lower() == "text":
text = serializers.SerializerMethodField(
method_name="txt_serializer_add_text"
Expand Down Expand Up @@ -447,14 +444,12 @@ def __init__(self, *args, **kwargs):
filter_fields[f1[0]] = f1[1]

class MetaFilter(object):

model = entity
fields = filter_fields

filterset_dict["Meta"] = MetaFilter

class TemplateViewSet(viewsets.ModelViewSet):

_select_related = select_related
_prefetch_rel = prefetch_rel
pagination_class = CustomPagination
Expand Down
3 changes: 0 additions & 3 deletions apis_core/apis_entities/admin.py

This file was deleted.

Empty file.
Loading

0 comments on commit 2c84572

Please sign in to comment.