Skip to content

CI Pipeline

CI Pipeline #36

Workflow file for this run

name: CI Pipeline
on:
push:
branches: [ main ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Verify with Maven
run: mvn -B verify --file pom.xml
- name: Package JAR with Maven
run: mvn -B -Dmaven.test.skip=true package --file pom.xml
- name: Report
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Reports
path: abecto-*/target/surefire-reports/*.xml
reporter: java-junit
fail-on-error: false
- name: Store Artifacts
uses: actions/upload-artifact@v4
with:
name: executable-jar
path: abecto-core/target/abecto.jar
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: CHANGELOG.md
sparse-checkout-cone-mode: false
- name: Create Release Notes
run: |
first=$(($(grep -n -m 2 "^## \[" CHANGELOG.md | grep -o "^[[:digit:]]*" | tail -n 1) + 1))
last=$(($(grep -n -m 3 "^## \[" CHANGELOG.md | grep -o "^[[:digit:]]*" | tail -n 1) - 1))
head -$last CHANGELOG.md | tail +$first > RELEASE_NOTES.md
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: executable-jar
- name: Release
uses: softprops/action-gh-release@v2
with:
name: ABox Evaluation and Comparison Tool for Ontologies (ABECTO) ${{ github.ref_name }}
body_path: RELEASE_NOTES.md
files: abecto.jar
build-and-push-docker:
if: startsWith(github.ref, 'refs/tags/v')
needs: build-and-test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}