Skip to content

dummy feature to show CI #88

dummy feature to show CI

dummy feature to show CI #88

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# we can build and run tests in a single step or do it in multiple steps...
# the "package" phase on maven implicitly will download dependencies, build classes, run unit tests, and package classes
name: CI with Maven
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, synchronize]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17', '21' ]
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Build and run unit tests
run: mvn -B package --file pom.xml
- name: Run integration tests
run: mvn -B integration-test verify --file pom.xml
- name: Add code coverage information to PR
id: jacoco-pr
uses: madrapps/jacoco-report@v1.7.1
if: github.event_name == 'pull_request'
with:
paths: |
${{ github.workspace }}/**/target/site/jacoco-merged-test-coverage-report/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 80
min-coverage-changed-files: 80
- name: Push results to Xray on Jira Cloud
if: always()
env:
XRAYCLOUD_CLIENT_ID: ${{ secrets.XRAYCLOUD_CLIENT_ID }}
XRAYCLOUD_CLIENT_SECRET: ${{ secrets.XRAYCLOUD_CLIENT_SECRET }}
XRAYCLOUD_TEST_PLAN_KEY: ${{ vars.XRAYCLOUD_TEST_PLAN_KEY }}
REVISON: ${{ github.ref_name}}
TEST_ENVIRONMENT: java${{ matrix.java }}
run: mvn -Dxray.clientId=${{ env.XRAYCLOUD_CLIENT_ID }} -Dxray.clientSecret=${{ env.XRAYCLOUD_CLIENT_SECRET }} -Dxray.testEnvironment=${{ env.TEST_ENVIRONMENT }} -Dxray.testPlanKey=${{ env.XRAYCLOUD_TEST_PLAN_KEY }} -Dxray.revision=${{ env.REVISON }} xray:import-results
- name: add link to Test Plan having the Test Executions (one per Java version) on the build summary
run: |
echo "| Link |" >> $GITHUB_STEP_SUMMARY
echo "| --- |" >> $GITHUB_STEP_SUMMARY
echo "| Test Plan: [${{ vars.XRAYCLOUD_TEST_PLAN_KEY }}](${{ vars.JIRACLOUD_BASE_URL }}/browse/${{ vars.XRAYCLOUD_TEST_PLAN_KEY }}) | " >> $GITHUB_STEP_SUMMARY
- name: add link to Test Plan on the PR
uses: mshick/add-pr-comment@v2
if: github.event_name == 'pull_request'
with:
message: |
Test Plan: [${{ vars.XRAYCLOUD_TEST_PLAN_KEY }}](${{ vars.JIRACLOUD_BASE_URL }}/browse/${{ vars.XRAYCLOUD_TEST_PLAN_KEY }})