Skip to content

Commit

Permalink
gha
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall committed Jan 29, 2022
1 parent 826a45d commit 57250c5
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 2 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Built from:
# https://docs.github.com/en/actions/guides/building-and-testing-python
# https://github.com/snok/install-poetry#workflows-and-tips

name: Build and test linkml-datalog

on: [pull_request]

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]

steps:

#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

#----------------------------------------------
# install & configure poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction

#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests
run: poetry run python -m unittest discover -p 'test_*.py'

#----------------------------------------------
# upload coverage results
#----------------------------------------------
- name: Upload pytest test results
uses: actions/upload-artifact@v2
with:
name: pytest-results
path: htmlcov
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
53 changes: 53 additions & 0 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish Python Package

on:
release:
types: [created]

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest

#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2.2.2
with:
python-version: 3.9

#----------------------------------------------
# install & configure poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.6
with:
virtualenvs-create: true
virtualenvs-in-project: true

#----------------------------------------------
# install dependencies
#----------------------------------------------
- name: Install dependencies
run: poetry install --no-interaction

#----------------------------------------------
# build dist
#----------------------------------------------
- name: Build source and wheel archives
run: |
poetry version $(git describe --tags --abbrev=0)
poetry build
#----------------------------------------------
# publish package to PyPI
#----------------------------------------------
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@v1.2.2
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Docker containers will be provided in future
Pass in a schema and a data file

```bash
poetry run python -m linkml_datalog.engines.datalog_engine -d tmp -s personinfo.yaml example_personinfo_data.yaml
poetry run linkml-dl -d tmp -s personinfo.yaml example_personinfo_data.yaml
```

The output will be a ValidationReport object, in yaml
Expand Down
2 changes: 2 additions & 0 deletions linkml_datalog/generators/dataloggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ def domains(self, slot: SlotDefinition) -> List[ClassDefinitionName]:
for cn in sv.all_classes().keys():
if slot.name in sv.class_slots(cn, direct=True):
domains.append(cn)
if slot.domain:
domains.append(slot.domain)
return domains

def get_slot_range(self, sn: SlotDefinitionName):
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
version = "0.0.0"
name = "linkml_datalog"
version = "0.1.0"
description = ""
authors = ["cmungall <cjm@berkeleybop.org>"]

Expand All @@ -14,3 +14,6 @@ pytest = "^5.2"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
linkml-dl = "linkml_datalog.engines.datalog_engine:cli"
2 changes: 2 additions & 0 deletions tests/inputs/biolink-model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4881,6 +4881,8 @@ slots:

part of:
is_a: overlaps
annotations:
transitive: true
description: >-
holds between parts and wholes (material entities or processes)
in_subset:
Expand Down

0 comments on commit 57250c5

Please sign in to comment.