Skip to content

Create maven-publish.yml #102

Create maven-publish.yml

Create maven-publish.yml #102

Workflow file for this run

# This is the main CI workflow it verify that SEPA builds and it conformates to the defined tests
name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
tags:
- "v*"
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 13
uses: actions/setup-java@v2
with:
java-version: '13'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: mvn --batch-mode --update-snapshots compile
test:
runs-on: ubuntu-latest
needs: build
services:
blazegraph:
image: nawer/blazegraph:2.1.5
ports:
- 9999:9999
steps:
- uses: actions/checkout@v2
- name: Set up JDK 13
uses: actions/setup-java@v2
with:
java-version: '13'
distribution: 'adopt'
cache: maven
- name: wait for blazegraph
uses: nev7n/wait_for_response@v1
with:
url: 'http://localhost:9999/blazegraph/namespace/kb/sparql'
responseCode: 200
timeout: 20000
interval: 500
- name: package engine and launch
run: |
mvn package
cd engine/target
mv endpoints/endpoint-blazegraph.jpar endpoint.jpar
echo launching engine with this configuration
echo SPARQL ENDPOINT
cat endpoint.jpar
echo ENGINE PROPERTIES
cat engine.jpar
echo LOG4J
cat log4j2-debug.xml
java -Dlog4j.configurationFile=./log4j2-debug.xml -jar engine-1.0.0-SNAPSHOT.jar -engine engine.jpar -endpoint endpoint.jpar > log.txt &
shell: bash
- name: wait for SEPA engine
uses: nev7n/wait_for_response@v1
with:
url: 'http://localhost:8000/echo'
responseCode: 200
timeout: 20000
interval: 500
- name: verify
run: mvn verify -e -Dlog4j2.level=trace
- name: publish Engine log
uses: actions/upload-artifact@v2
if: always()
with:
name: engine-log
path: engine/target/log.txt
publish:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs:
- build
- test
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '13'
distribution: 'adopt'
cache: maven
- name: Publish package
run: mvn clean deploy -Dmaven.test.skip=true -Drevision=${{github.ref_name}} -DrepositoryId=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-docker:
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags/v')
needs:
- build
- test
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: vaimee/sepa:${{github.ref_name}},vaimee/sepa:latest