pc - add dependency for liquibase, latest version #57
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 workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: "14-backend-pitest: Java Mutation Testing (Pitest)" | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: [src/**, pom.xml, lombok.config] | |
push: | |
branches: [ main ] | |
paths: [src/**, pom.xml, lombok.config] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Figure out branch name | |
id: get-branch-name | |
run: | | |
GITHUB_HEAD_REF="${GITHUB_HEAD_REF}" | |
echo GITHUB_HEAD_REF=${GITHUB_HEAD_REF} | |
GITHUB_REF_CLEANED=${GITHUB_REF/refs\/heads\//} | |
echo GITHUB_REF_CLEANED=${GITHUB_REF_CLEANED} | |
GITHUB_REF_CLEANED=${GITHUB_REF_CLEANED//\//-} | |
echo GITHUB_REF_CLEANED=${GITHUB_REF_CLEANED} | |
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_CLEANED}}" | |
echo "branch_name=${BRANCH}" | |
echo "branch_name=${BRANCH}" >> "$GITHUB_ENV" | |
- name: Set up Java (version from .java-version file) | |
uses: actions/setup-java@v3 | |
with: | |
distribution: semeru # See: https://github.com/actions/setup-java#supported-distributions | |
java-version-file: ./.java-version | |
- name: Build with Maven | |
run: mvn -B test | |
# Note that we DO NOT download history in this job; | |
# this job is intended as a "reset" of the history each time the | |
# main branch changes | |
- name: Pitest | |
run: mvn pitest:mutationCoverage -DmutationThreshold=100 | |
- name: Upload Pitest History to Artifacts | |
if: always() # always upload artifacts, even if tests fail | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pitest-${{env.branch_name}}-history.bin | |
path: target/pit-history/history.bin | |
- name: Upload Pitest to Artifacts | |
if: always() # always upload artifacts, even if tests fail | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pitest | |
path: target/pit-reports/* | |
- name: Get PR number | |
id: get-pr-num | |
run: | | |
echo "GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH}" | |
pr_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") | |
echo "pr_number=${pr_number}" | |
echo "pr_number=${pr_number}" >> "$GITHUB_ENV" | |
- name: Set path for github pages deploy when there is a PR num | |
if: ${{ env.pr_number != 'null' }} | |
run: | | |
prefix="prs/${pr_number}/" | |
echo "prefix=${prefix}" | |
echo "prefix=${prefix}" >> "$GITHUB_ENV" | |
- name: Set path for github pages deploy when there is NOT a PR num | |
if: ${{ env.pr_number == 'null' }} | |
run: | | |
prefix="" | |
echo "prefix=${prefix}" | |
echo "prefix=${prefix}" >> "$GITHUB_ENV" | |
- name: Deploy 🚀 | |
if: always() # always upload artifacts, even if tests fail | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: target/pit-reports # The folder where the files we want to publish are located | |
clean: true # Automatically remove deleted files from the deploy branch | |
target-folder: ${{env.prefix}}pitest # The folder that we serve our files from |