-
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
6 changed files
with
1,013 additions
and
47 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,47 @@ | ||
name: LDTab tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
|
||
- name: Install clojure tools | ||
uses: DeLaGuardo/setup-clojure@12.5 | ||
with: | ||
# Install just one or all simultaneously | ||
# The value must indicate a particular version of the tool, or use 'latest' | ||
# to always provision the latest version | ||
cli: 1.10.1.693 # Clojure CLI based on tools.deps | ||
lein: 2.9.1 # Leiningen | ||
cljfmt: 0.10.2 # cljfmt | ||
|
||
- name: Cache Leiningen dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/project.clj') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Install SQLite | ||
run: sudo apt-get update && sudo apt-get install -y sqlite3 | ||
|
||
- name: Run tests | ||
run: | | ||
make test |
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,15 +1,101 @@ | ||
### Configuration | ||
# | ||
# These are standard options to make Make sane: | ||
# <http://clarkgrubb.com/makefile-style-guide#toc2> | ||
|
||
MAKEFLAGS += --warn-undefined-variables | ||
SHELL := bash | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
.DEFAULT_GOAL := help | ||
.DELETE_ON_ERROR: | ||
.PRECIOUS: | ||
.SUFFIXES: | ||
|
||
export PATH := $(shell pwd)/bin:$(PATH) | ||
|
||
DB := build/database.db | ||
ontology := resources/ontology.owl | ||
LEIN := lein | ||
|
||
### Main Tasks | ||
|
||
.PHONY: help | ||
help: | ||
@echo "USAGE:" | ||
@echo " make update update tests/ from README.md" | ||
@echo "LDTab Makefile" | ||
@echo "" | ||
@echo "TASKS" | ||
@echo " ldtab build LDTab executable" | ||
@echo " test run round-trip tests" | ||
@echo " all build all files" | ||
@echo " clean remove all build files" | ||
@echo " clobber remove all generated files" | ||
@echo " help print this message" | ||
|
||
.PHONY: ldtab | ||
ldtab: bin/ldtab | ||
|
||
.PHONY: all | ||
all: ldtab bin/robot test | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf build/ | ||
|
||
build: | ||
.PHONY: clobber | ||
clobber: | ||
rm -rf bin/ build/ | ||
|
||
bin/ build/: | ||
mkdir -p $@ | ||
|
||
build/waltz: | build | ||
curl -L -o build/waltz.tar.gz https://github.com/killercup/waltz/releases/download/waltz_cli-0.1.4/waltz-waltz_cli-0.1.4-x86_64-unknown-linux-musl.tar.gz | ||
cd build && tar xvf waltz.tar.gz | ||
### Install Dependencies | ||
|
||
# Require SQLite | ||
ifeq ($(shell command -v sqlite3),) | ||
$(error 'Please install SQLite 3') | ||
endif | ||
|
||
# Require Java | ||
ifeq ($(shell command -v java),) | ||
$(error 'Please install Java, so we can run ROBOT and LDTab') | ||
endif | ||
|
||
# Require Leiningen | ||
ifeq ($(shell command -v lein),) | ||
$(error 'Please install Leiningen, so we can build LDTab') | ||
endif | ||
|
||
# Install ROBOT | ||
bin/robot.jar: | bin/ | ||
curl -L -o $@ 'https://github.com/ontodev/robot/releases/download/v1.9.5/robot.jar' | ||
|
||
bin/robot: bin/robot.jar | ||
curl -L -o $@ 'https://raw.githubusercontent.com/ontodev/robot/master/bin/robot' | ||
chmod +x $@ | ||
|
||
# Install LDTab | ||
bin/ldtab.jar: | bin/ | ||
$(LEIN) uberjar | ||
mv target/uberjar/ldtab-0.1.0-SNAPSHOT-standalone.jar $@ | ||
|
||
bin/ldtab: bin/ldtab.jar | ||
echo '#!/bin/sh' > $@ | ||
echo 'java -jar "$$(dirname $$0)/ldtab.jar" "$$@"' >> $@ | ||
chmod +x $@ | ||
|
||
.PHONY: update | ||
update: build/waltz | ||
build/waltz README.md --target_dir . | ||
### Round-trip Test | ||
# The test ontology was taken from here: https://raw.githubusercontent.com/ontodev/robot/master/robot-core/src/test/resources/axioms.owl | ||
|
||
.PHONY: test | ||
test: tests/prefix/prefix.tsv | bin/ldtab bin/robot build/ $(ontology) | ||
echo "Testing round-trip" | ||
rm -f $(DB) | ||
rm -f build/ontology.ttl | ||
rm -f build/ontology.owl | ||
ldtab init $(DB) | ||
ldtab prefix $(DB) $< | ||
ldtab import $(DB) $(ontology) | ||
ldtab export $(DB) build/ontology.ttl --format ttl | ||
robot convert --input build/ontology.ttl --output build/ontology.owl | ||
robot diff --left $(ontology) --right build/ontology.owl \ | ||
| grep 'Ontologies are identical' |
Oops, something went wrong.