Skip to content

Widoco docs updates #49

Widoco docs updates

Widoco docs updates #49

Workflow file for this run

name: FUEL_CI
concurrency:
group: fuel-gist-badges
cancel-in-progress: true
on:
push:
branches:
- dev
- main
env:
ONTO_DIR: src/ontology
ONTO_FILE: fuel.ttl
ONTO_ABBREV: fuel
DOCS_DIR: docs
RELEASES_DIR: ./public/releases
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check.outputs.version }}
is_new: ${{ steps.check.outputs.is_new }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check version
id: check
run: |
VERSION=$(grep -oP 'owl:versionInfo\s+"\K[^"]+' src/ontology/fuel.ttl || echo "")
echo "version=$VERSION" >> $GITHUB_OUTPUT
if [ "${{ github.ref_name }}" != "main" ] || [ -z "$VERSION" ]; then
echo "is_new=false" >> $GITHUB_OUTPUT
exit 0
fi
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "is_new=false" >> $GITHUB_OUTPUT
else
echo "is_new=true" >> $GITHUB_OUTPUT
fi
build:
needs: check-version
runs-on: ubuntu-latest
env:
BUILD_DIR: ${{ github.ref_name == 'main' && './public' || './public/dev' }}
RELEASE_VERSION: ${{ needs.check-version.outputs.is_new == 'true' && needs.check-version.outputs.version || '' }}
IS_MAIN: ${{ github.ref_name == 'main' && 'true' || 'false' }}
CURRENT_VERSION: ${{ needs.check-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute safe ref name
if: always()
run: |
SAFE_REF="${GITHUB_REF_NAME//\//-}"
echo "SAFE_REF=$SAFE_REF" >> $GITHUB_ENV
- name: Java Setup
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Install ROBOT
run: |
wget -q https://github.com/ontodev/robot/releases/download/v1.9.8/robot.jar -O robot.jar
curl -sL https://raw.githubusercontent.com/ontodev/robot/master/bin/robot > robot
chmod +x robot
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Python packages
run: |
python -m pip install --upgrade pip
pip install rdflib dotenv pylode==3.2.1 "ontospy[HTML]"
- name: Validate ontology profile
id: profile
run: |
./robot validate-profile --input "${ONTO_DIR}/${ONTO_FILE}" --profile DL -vvv || \
(echo "Profile check failed." && exit 1)
- name: Badge — Syntax
if: always()
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: ${{ secrets.GIST_ID }}
filename: fuel-ci-profile-${{ env.SAFE_REF }}.json
label: OWL DL Profile (${{ github.ref_name }})
message: ${{ steps.profile.outcome || 'failed' }}
color: ${{ steps.profile.outcome == 'success' && 'brightgreen' || steps.profile.outcome == 'cancelled' && 'yellow' || 'red' }}
forceUpdate: true
- name: Reasoning and consistency check
id: reasoning
run: |
if ./robot reason --reasoner HermiT --input "${ONTO_DIR}/${ONTO_FILE}" --output reasoned.owl; then
echo "result=consistent" >> $GITHUB_OUTPUT
else
echo "result=inconsistent" >> $GITHUB_OUTPUT
exit 1
fi
- name: Badge — Reasoning
if: always()
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: ${{ secrets.GIST_ID }}
filename: fuel-ci-reasoning-${{ github.ref_name }}.json
label: Reasoning (${{ github.ref_name }})
message: ${{ steps.reasoning.outputs.result || 'failed'}}
color: ${{ steps.reasoning.outputs.result == 'consistent' && 'brightgreen' || 'red' }}
forceUpdate: true
- name: Generate ontology syntaxes and documentation
run: |
python3 src/scripts/ontology_build.py
- name: Upload root artifact
# if BUILD_DIR is set to something non-empty, we upload the whole public struct
if: ${{ env.BUILD_DIR != '' && env.BUILD_DIR != null }}
uses: actions/upload-artifact@v4
with:
name: site
path: ./public
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download site artifact
uses: actions/download-artifact@v4
with:
name: site
path: ./public
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
keep_files: true
create-release:
needs: [check-version, deploy]
if: needs.check-version.outputs.is_new == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check-version.outputs.version }}
name: Release v${{ needs.check-version.outputs.version }}
generate_release_notes: true