Merge pull request #45 from fabrizio-turchi/issue-#6 #89
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
name: Continuous Integration | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.9' | |
- '3.12' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
pip -q install poetry pre-commit rdflib | |
poetry install | |
- name: Pre-commit Checks | |
run: pre-commit run --all-files | |
- name: Type Checking | |
run: poetry run mypy case_mapping example.py tests | |
- name: Unit Tests | |
run: poetry run pytest --doctest-modules | |
- name: Run Example | |
run: poetry run python example.py > case.jsonld | |
# Ensure that the example output is a valid CASE JSON-LD graph | |
- name: CASE Export Validation | |
uses: kchason/[email protected] | |
with: | |
case-path: ./ | |
case-version: "case-1.3.0" | |
extension-filter: "jsonld" | |
- name: Convert example | |
run: | | |
rdfpipe --output-format turtle case.jsonld > case.ttl | |
test 0 -eq $(grep 'file:' case.ttl | wc -l) || (echo "ERROR:ci.yml:Some graph IRIs do not supply a resolving prefix. Look for the string 'file:///' in the file case.ttl (created by running 'make check') to see these instances." >&2 ; exit 1) | |
# Always build the package as a sanity check to ensure no issues with the build system | |
# exist as part of the CI process | |
- name: Build Package | |
run: | | |
poetry build | |
# Only push to PyPi when a tag is created starting with 'v' | |
- name: Push to PyPi | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
poetry publish |