mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 07:45:49 +00:00
Create incremental-pr.yml
incremental-pr.yml added to workflows
This commit is contained in:
parent
923e2b7aa3
commit
563f2ffdb9
1 changed files with 47 additions and 0 deletions
47
.github/workflows/incremental-pr.yml
vendored
Normal file
47
.github/workflows/incremental-pr.yml
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
name: Diffblue write incremental tests for a Java PR
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
paths:
|
||||
- '**.java'
|
||||
concurrency:
|
||||
# Only allow one run of the workflow per branch to run at a time
|
||||
group: $
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
Test:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
JVM_ARGS: -Xmx8192m
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3.5.3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0
|
||||
- name: Setup Git Credentials
|
||||
uses: fregante/setup-git-user@v2
|
||||
- name: Generate patch file from latest changes
|
||||
run: |
|
||||
git diff ${{ github.event.pull_request.base.sha }}...HEAD > "$GITHUB_WORKSPACE/changes.patch"
|
||||
cat "$GITHUB_WORKSPACE/changes.patch"
|
||||
- name: Download Diffblue Cover
|
||||
run: |
|
||||
mkdir -p "$RUNNER_TEMP/dcover"
|
||||
cd "$RUNNER_TEMP/dcover"
|
||||
curl --silent --show-error --location --output "diffblue-cover-cli.zip" "${{ secrets.DIFFBLUE_COVER_URL }}"
|
||||
unzip -q "diffblue-cover-cli.zip"
|
||||
rm -f "diffblue-cover-cli.zip"
|
||||
echo "$RUNNER_TEMP/dcover" >> "$GITHUB_PATH"
|
||||
- name: Compile project
|
||||
run: mvn --batch-mode --no-transfer-progress clean compile
|
||||
- name: Create unit tests based on diff
|
||||
run: dcover create --batch --patch-only "$GITHUB_WORKSPACE/changes.patch"
|
||||
- name: Add the new tests
|
||||
run: |
|
||||
git add -f "*/*DiffblueTest.java"
|
||||
git commit -am "Incremental Diffblue Test"
|
||||
git push origin HEAD:${{ github.head_ref }}
|
Loading…
Reference in a new issue