Merge remote-tracking branch 'origin/main'

This commit is contained in:
Andy Wyatt 2023-11-09 15:00:27 +00:00
commit 9def02d3ad
2 changed files with 48 additions and 1 deletions

47
.github/workflows/incremental-pr.yml vendored Normal file
View 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 }}

View file

@ -26,4 +26,4 @@ jobs:
distribution: 'adopt' distribution: 'adopt'
cache: maven cache: maven
- name: Build with Maven Wrapper - name: Build with Maven Wrapper
run: ./mvnw -B package run: ./mvnw -B install