Skip to content

Update buildAndTest.yml #488

Update buildAndTest.yml

Update buildAndTest.yml #488

Workflow file for this run

name: KLighD Build & Test execution
on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request_target: # enables builds of PRs to branch 'master' from forked repos, with the workflow being taken from the target revision, i.e. the 'master' branch
branches:
- master
workflow_dispatch: # enables manual triggering
jobs:
build:
# suppress triggering this job on 'synchronize' events of PR's (i.e. branch updates) within the same repo, as that is covered by 'push' already, but fire on updates of PRs coming from outside
if: github.event_name != 'pull_request_target' || github.event.action != 'synchronize' || github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id
runs-on: ubuntu-latest
steps:
# this provides some extremly helpful insight into the meta data of the current execution, see also https://docs.github.com/en/actions/learn-github-actions/contexts#github-context and https://stackoverflow.com/questions/70104600/complete-list-of-github-actions-contexts
# - name: Dump GitHub context
# run: echo '${{ toJSON(github) }}'
- uses: actions/checkout@v4
- uses: nelonoel/[email protected]
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: .m2
key: ${{ runner.os }}-m2-${{ hashFiles('.github/workflows/**/*.*', '**/pom.xml', '**/META-INF/MANIFEST.MF', 'build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform.target') }}
- name: Run mvn build headless
run: |
export DISPLAY=:0
#instead of
# Xvfb -screen 0 1280x1024x16 -ac :17 > /dev/null 2>&1 &
#use screen 0 with 1280x1024x8 that is default according to https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml
Xvfb -ac > /dev/null 2>&1 &
mvn -B -fae -Dmaven.repo.local=.m2 -Dmaven.test.failure.ignore=true -ntp -s mvn-local-settings.xml clean deploy
#print the folder structure up to depth 2 on the console as we have no other option of getting an inside into workspace folder
find . -maxdepth 2
- name: Archive P2 Repository
uses: actions/upload-artifact@v3
with:
name: KLighD P2 Repository
path: build/de.cau.cs.kieler.klighd.repository/target/repository/**/*
retention-days: 14
if-no-files-found: error
- name: Archive MVN Repository
if: ${{ !contains(github.ref, 'releases-') }}
uses: actions/upload-artifact@v3
with:
name: KLighD MVN Repository
path: klighd-snapshots/**/*
retention-days: 14
if-no-files-found: error
- name: Archive MVN Release Repository
if: ${{ contains(github.ref, 'releases-') }}
uses: actions/upload-artifact@v3
with:
name: KLighD MVN Repository
path: klighd/**/*
retention-days: 14
if-no-files-found: error
- name: Publish Test Report
id: test_report
if: ${{ !cancelled() }}
uses: scacap/action-surefire-report@v1
with:
report_paths: 'test/**/surefire-reports/*.xml'