Merge branch 'master' of https://github.com/arces-wot/sepa.git #139
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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@v4 | |
- name: Set up JDK 23 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '23' | |
distribution: 'adopt' | |
cache: maven | |
- name: Build with Maven | |
run: mvn --batch-mode --update-snapshots compile | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 23 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '23' | |
distribution: 'adopt' | |
cache: maven | |
- name: package engine and launch | |
run: | | |
mvn package | |
cd engine/target | |
java -Dlog4j.configurationFile=./log4j2-debug.xml -jar engine-1.0.0-SNAPSHOT.jar > 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@v4 | |
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@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '23' | |
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@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v4 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: vaimee/sepa:${{github.ref_name}},vaimee/sepa:latest |