Skip to content

Merge pull request #534 from ontologyportal/Rose_5-26-26 #895

Merge pull request #534 from ontologyportal/Rose_5-26-26

Merge pull request #534 from ontologyportal/Rose_5-26-26 #895

Workflow file for this run

# This workflow will build a Java project with Ant
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-ant
name: 'Java CI with Ant / Build sumo-ci'
on:
push:
branches: [ "master", "main" ]
pull_request:
branches: [ "master", "main" ]
workflow_dispatch:
env:
DEFAULT_DOCKER_ACCOUNT: apease
SUMO_REF: 5051a4ebf1a8d1c00e602bcdabaa7b5bd3a5ed1c
jobs:
build-test-upload:
name: Build & Test
runs-on: ubuntu-latest
container:
image: apease/sigma-ci:latest
steps:
- name: checkout sigmakee
uses: actions/checkout@v4
with:
path: sigmakee
- name: checkout TPTP-ANTLR
uses: actions/checkout@v4
with:
repository: 'ontologyportal/TPTP-ANTLR'
path: TPTP-ANTLR
- name: checkout SigmaUtils
uses: actions/checkout@v4
with:
repository: 'ontologyportal/SigmaUtils'
path: SigmaUtils
- name: checkout sigmaAntlr
uses: actions/checkout@v4
with:
repository: 'ontologyportal/sigmaAntlr'
path: sigmaAntlr
- name: checkout sumo
uses: actions/checkout@v4
with:
repository: 'ontologyportal/sumo'
ref: ${{ env.SUMO_REF }}
path: sumo
fetch-depth: 0
- name: Setup SIGMA_HOME
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
SIGMA_SRC: ${{ github.workspace }}/sigmakee
ONTOLOGYPORTAL_GIT: ${{ github.workspace }}
working-directory: ${{ github.workspace }}
run: |
echo "SIGMA_HOME: $SIGMA_HOME"
echo "SIGMA_SRC: $SIGMA_SRC"
echo "ONTOLOGYPORTAL_GIT: $ONTOLOGYPORTAL_GIT"
mkdir -p $SIGMA_HOME/KBs/WordNetMappings
cp -R $ONTOLOGYPORTAL_GIT/sumo/* $SIGMA_HOME/KBs
cp /opt/WordNet-3.0/dict/* $SIGMA_HOME/KBs/WordNetMappings/
- name: Set up JDK 21 for x64
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build with Ant
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
SIGMA_SRC: ${{ github.workspace }}/sigmakee
ONTOLOGYPORTAL_GIT: ${{ github.workspace }}
working-directory: ./sigmakee
run: ant
- name: Prepare test env
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
SIGMA_SRC: ${{ github.workspace }}/sigmakee
ONTOLOGYPORTAL_GIT: ${{ github.workspace }}
working-directory: ./sigmakee
run: |
sed -i "s|/home/theuser/workspace/sumo|$SIGMA_HOME/KBs|g" $SIGMA_SRC/test/unit/java/resources/config_topOnly.xml
sed -i "s|/home/theuser/.sigmakee|$SIGMA_HOME|g" $SIGMA_SRC/test/unit/java/resources/config_topOnly.xml
sed -i "s|/home/theuser/E/bin/e_ltb_runner|/usr/local/bin/e_ltb_runner|g" $SIGMA_SRC/test/unit/java/resources/config_topOnly.xml
sed -i "s|/home/theuser/Programs/vampire/build/vampire|/usr/local/bin/vampire|g" $SIGMA_SRC/test/unit/java/resources/config_topOnly.xml
- name: Run unit tests
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
SIGMA_SRC: ${{ github.workspace }}/sigmakee
ONTOLOGYPORTAL_GIT: ${{ github.workspace }}
TPTP_BG_WAIT: "true"
working-directory: ./sigmakee
run: |
ant test.unit
- name: Setup SIGMA_HOME for integration tests
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
SIGMA_SRC: ${{ github.workspace }}/sigmakee
ONTOLOGYPORTAL_GIT: ${{ github.workspace }}
TPTP_BG_WAIT: "true"
working-directory: ${{ github.workspace }}
run: |
find $SIGMA_HOME/KBs -name '**/*.ser' -delete
cp $SIGMA_SRC/config.xml $SIGMA_HOME/KBs
sed -i "s|/home/theuser/workspace/sumo|$SIGMA_HOME/KBs|g" $SIGMA_HOME/KBs/config.xml
sed -i "s|/home/theuser/.sigmakee|$SIGMA_HOME|g" $SIGMA_HOME/KBs/config.xml
sed -i "s|/home/theuser/E/bin/e_ltb_runner|/usr/local/bin/e_ltb_runner|g" $SIGMA_HOME/KBs/config.xml
sed -i "s|/home/theuser/Programs/vampire/build/vampire|/usr/local/bin/vampire|g" $SIGMA_HOME/KBs/config.xml
sed -i "s|/home/theuser|/root|g" $SIGMA_HOME/KBs/config.xml
sed -i '/<kb name/,/<\/kb>/d' $SIGMA_HOME/KBs/config.xml
- name: Setup KB for integration tests
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
TPTP_BG_WAIT: "true"
working-directory: ${{ github.workspace }}
run: >
sed -i '/<\/configuration>/i\
<kb name="SUMO">\n
<constituent filename="Merge.kif"\/>\n
<constituent filename="Mid-level-ontology.kif"\/>\n
<constituent filename="english_format.kif"\/>\n
<constituent filename="domainEnglishFormat.kif"\/>\n
<\/kb>' $SIGMA_HOME/KBs/config.xml
- name: Run integration tests
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
SIGMA_SRC: ${{ github.workspace }}/sigmakee
ONTOLOGYPORTAL_GIT: ${{ github.workspace }}
TPTP_BG_WAIT: "true"
working-directory: ./sigmakee
run: |
ant test.integration
- name: Prune KB after integration tests
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
working-directory: ${{ github.workspace }}
run: |
find $SIGMA_HOME/KBs -name '**/*.ser' -delete
- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
./sigmakee/build/test/results/*
- name: Upload sigmakee jars
uses: actions/upload-artifact@v4
with:
name: sigma-base
path: |
./sigmakee/build/sigmakee.jar
./sigmakee/lib/*.jar
!./sigmakee/lib/hamcrest-core*.jar
!./sigmakee/lib/junit*.jar
./sigmakee-runtime
- name: Upload sigmakee war
uses: actions/upload-artifact@v4
with:
name: sigma-webapp
path: /usr/local/tomcat/webapps/sigma.war
build-related-repos:
name: Build related repos
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
container:
image: apease/sigma-ci:latest
steps:
- name: checkout sigmakee
uses: actions/checkout@v4
with:
path: sigmakee
- name: checkout TPTP-ANTLR
uses: actions/checkout@v4
with:
repository: ontologyportal/TPTP-ANTLR
path: TPTP-ANTLR
- name: checkout SigmaUtils
uses: actions/checkout@v4
with:
repository: ontologyportal/SigmaUtils
path: SigmaUtils
- name: checkout sigmaAntlr
uses: actions/checkout@v4
with:
repository: ontologyportal/sigmaAntlr
path: sigmaAntlr
- name: checkout SUMOjEdit
uses: actions/checkout@v4
with:
repository: ontologyportal/SUMOjEdit
path: SUMOjEdit
- name: checkout sigmanlp
uses: actions/checkout@v4
with:
repository: ontologyportal/sigmanlp
path: sigmanlp
- name: checkout sumo
uses: actions/checkout@v4
with:
repository: ontologyportal/sumo
ref: ${{ env.SUMO_REF }}
path: sumo
fetch-depth: 0
- name: Set up JDK 21 for x64
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup SIGMA_HOME
env:
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
ONTOLOGYPORTAL_GIT: ${{ github.workspace }}
working-directory: ${{ github.workspace }}
run: |
mkdir -p "$SIGMA_HOME/KBs/WordNetMappings"
cp -R "$ONTOLOGYPORTAL_GIT/sumo/"* "$SIGMA_HOME/KBs/"
cp /opt/WordNet-3.0/dict/* "$SIGMA_HOME/KBs/WordNetMappings/"
- name: Build related repos
env:
SIGMA_SRC: ${{ github.workspace }}/sigmakee
ONTOLOGYPORTAL_GIT: ${{ github.workspace }}
SIGMA_HOME: ${{ github.workspace }}/sigmakee-runtime
CATALINA_HOME: /usr/local/tomcat
SIGMA_CP: ${{ github.workspace }}/sigmakee/build/sigmakee.jar:${{ github.workspace }}/sigmakee/lib/*
working-directory: ./sigmakee
run: |
chmod +x scripts/build-related-repos.sh
bash scripts/build-related-repos.sh
build-sumo-ci-and-sigmakee:
runs-on: ubuntu-latest
needs: build-test-upload
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download artifact
uses: actions/download-artifact@v4.1.7
with:
name: sigma-base
- name: Download artifact
uses: actions/download-artifact@v4.1.7
with:
name: sigma-webapp
- name: Setup config
run: |
ls .
# Debug
#cat ./sigmakee-runtime/KBs/config.xml
sed -i "s|/__w/sigmakee/sigmakee|/root|g" ./sigmakee-runtime/KBs/config.xml
# Debug
#cat ./sigmakee-runtime/KBs/config.xml
- name: Set image account name
env:
DOCKER_ACCOUNT: ${{ secrets.DOCKERHUB_USERNAME }}
run: |
echo "IMAGE_ACCOUNT=${DOCKER_ACCOUNT:-$DEFAULT_DOCKER_ACCOUNT}" >> $GITHUB_ENV
- name: Build and push sumo-ci
uses: docker/build-push-action@v6
with:
context: .
file: docker/sumo-ci/Dockerfile
push: ${{ github.event_name == 'push' }}
tags: ${{ env.IMAGE_ACCOUNT }}/sumo-ci:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push sigmakee
uses: docker/build-push-action@v6
with:
context: .
file: docker/sigmakee/Dockerfile
push: ${{ github.event_name == 'push' }}
tags: ${{ env.IMAGE_ACCOUNT }}/sigmakee:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Docker Hub Description
if: github.event_name == 'push'
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.IMAGE_ACCOUNT }}/sigmakee