From ec511d3278e1fef32eea404f637d1e7226f2d8ca Mon Sep 17 00:00:00 2001 From: kgondaliya Date: Fri, 12 Aug 2022 15:04:14 +0200 Subject: [PATCH] Add validation and publishing actions --- .github/workflows/build-ontology.yaml | 32 +++++++++++++++++++++++++++ .github/workflows/validation.yaml | 16 ++++++++++++++ .travis.yml | 2 +- singleTTL.sh | 12 ++++++++++ validate.sh | 1 + 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-ontology.yaml create mode 100644 .github/workflows/validation.yaml create mode 100644 singleTTL.sh create mode 100755 validate.sh diff --git a/.github/workflows/build-ontology.yaml b/.github/workflows/build-ontology.yaml new file mode 100644 index 00000000000..3f547a44978 --- /dev/null +++ b/.github/workflows/build-ontology.yaml @@ -0,0 +1,32 @@ +on: + release: + types: [created] + +name: Build ontology + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + environment: production + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: prepare single ttl file + run: | + sh validate.sh + sh singleTTL.sh + + - name: Publish Asset + uses: softprops/action-gh-release@v1 + with: + tag_name: test + files: graphit-ontology.ttl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/validation.yaml b/.github/workflows/validation.yaml new file mode 100644 index 00000000000..65ba9ffb491 --- /dev/null +++ b/.github/workflows/validation.yaml @@ -0,0 +1,16 @@ +name: Validate ontology + +on: pull_request + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: validate ontology + run: | + ./validate.sh diff --git a/.travis.yml b/.travis.yml index 7cf88d5a2c7..750c437fa79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,5 @@ language: java jdk: - oraclejdk8 install: true # skip -script: find . -type f -name "*.ttl" | xargs java -jar bin/ogit-validator.jar +script: find . -type f ! -name 'graphit-ontology.*' -name "*.ttl" | xargs java -jar bin/ogit-validator.jar diff --git a/singleTTL.sh b/singleTTL.sh new file mode 100644 index 00000000000..4d1819fa408 --- /dev/null +++ b/singleTTL.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +TTLFILE=graphit-ontology.ttl +rm -f $TTLFILE + + +find . -type f -name '*.ttl' -exec cat {} \; -exec echo $'\n' \;> TMP_cat_all.txt +grep "@prefix" TMP_cat_all.txt | awk '{$1=$1}!A[toupper($0)]++' > TMP_prefixed.txt +grep -v "@prefix" TMP_cat_all.txt > TMP_no_prefixes.txt +cat TMP_prefixed.txt TMP_no_prefixes.txt > $TTLFILE +rm TMP_prefixed.txt TMP_no_prefixes.txt TMP_cat_all.txt +echo $TTLFILE 'has been generated.' diff --git a/validate.sh b/validate.sh new file mode 100755 index 00000000000..4cfafd4fea8 --- /dev/null +++ b/validate.sh @@ -0,0 +1 @@ +find . -type f ! -name 'graphit-ontology.*' -name "*.ttl" | xargs java -jar bin/ogit-validator.jar