build-foresight-maven-jacoco-sample #908
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
name: build-foresight-maven-jacoco-sample | |
on: | |
schedule: | |
- cron: "0 2 * * *" | |
workflow_dispatch: | |
env: | |
BRANCH_NAME: auto-upstream-merge | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Collect Workflow Telemetry | |
uses: runforesight/foresight-workflow-kit-action@v1 | |
with: | |
api_key: ${{ secrets.FORESIGHT_API_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ env.BRANCH_NAME }} | |
lfs: true | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Install XMLStartLet | |
run: sudo apt install xmlstarlet | |
- name: Add jacoco plugin to POM | |
run: | | |
echo "$(xmlstarlet edit --omit-decl -N x="http://maven.apache.org/POM/4.0.0" \ | |
-s '//x:build/x:plugins' -t elem -n 'plugin' \ | |
-s '//x:build/x:plugins/plugin[last()]' -t elem -n 'groupId' -v 'org.jacoco' \ | |
-s '//x:build/x:plugins/plugin[last()]' -t elem -n 'artifactId' -v 'jacoco-maven-plugin' \ | |
-s '//x:build/x:plugins/plugin[last()]' -t elem -n 'version' -v '0.8.8' \ | |
-s '//x:build/x:plugins/plugin[last()]' -t elem -n 'executions' \ | |
-s '//x:build/x:plugins/plugin[last()]/executions' -t elem -n 'execution' \ | |
-s '//x:build/x:plugins/plugin[last()]/executions/execution[last()]' -t elem -n 'goals'\ | |
-s '//x:build/x:plugins/plugin[last()]/executions/execution[last()]/goals' -t elem -n 'goal' -v 'prepare-agent' \ | |
-s '//x:build/x:plugins/plugin[last()]/executions' -t elem -n 'execution' \ | |
-s '//x:build/x:plugins/plugin[last()]/executions/execution[last()]' -t elem -n 'id' -v 'report' \ | |
-s '//x:build/x:plugins/plugin[last()]/executions/execution[last()]' -t elem -n 'phase' -v 'prepare-package' \ | |
-s '//x:build/x:plugins/plugin[last()]/executions/execution[last()]' -t elem -n 'goals' \ | |
-s '//x:build/x:plugins/plugin[last()]/executions/execution[last()]/goals' -t elem -n 'goal' -v 'report' \ | |
pom.xml | xmlstarlet format --indent-tab)" > pom.xml.tmp && mv pom.xml.tmp pom.xml | |
- name: Run maven | |
run: mvn clean install | |
- name: Analyze Test and/or Coverage Results | |
if: always() | |
uses: runforesight/foresight-test-kit-action@v1 | |
with: | |
api_key: ${{ secrets.FORESIGHT_API_KEY }} | |
test_framework: junit | |
test_path: "./target/surefire-reports/**" | |
coverage_format: jacoco/xml | |
coverage_path: "./target/site/jacoco/*.xml" |