Skip to content

Commit 3e0cdf9

Browse files
committed
add github workflow
1 parent 40c5912 commit 3e0cdf9

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/diffblue-cover.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This template is provided and maintained by Diffblue.
2+
# You can copy and paste this template into a new `diffblue-cover.yml` file.
3+
# This template is designed to be used with the Cover Pipeline for Github integration from Diffblue.
4+
# It will download the latest version of Diffblue Cover, build the associated project, and
5+
# automatically write Java unit tests for the project.
6+
7+
name: Automated Test Creation with Diffblue Cover
8+
9+
# Diffblue Cover runs on pull_request events for now.
10+
on: pull_request
11+
12+
jobs:
13+
RunDiffblueCoverAutomatedTestCreation:
14+
runs-on: ubuntu-latest
15+
16+
# Select the Cover CLI docker image to use with your CI tool.
17+
# Tag variations are produced for each supported JDK version.
18+
# Go to https://hub.docker.com/r/diffblue/cover-cli for details.
19+
# Note: To use the latest version of Diffblue Cover, use one of the latest-jdk<nn> tags.
20+
# To use a specific release version, use one of the yyyy.mm.dd-jdk<nn> tags
21+
container: diffblue/internal-cover-cli:202401-github-2024.01.01-snapshot-jdk17
22+
23+
steps:
24+
- name: Checkout project
25+
uses: actions/checkout@v4
26+
with:
27+
set-safe-directory: true
28+
fetch-depth: 0
29+
# Diffblue Cover requires the project to be built before creating any tests.
30+
# Either specify the build command here (one of the following), or provide
31+
# prebuilt artifacts via a job dependency.
32+
- name: Build Project
33+
run: mvn test-compile --batch-mode --no-transfer-progress
34+
35+
# Diffblue Cover commands and options to run.
36+
# dcover – the core Diffblue Cover command
37+
# ci – enable CI/CD integration via environment variables
38+
# activate - activate the license key
39+
# validate - remove non-compiling and failing tests
40+
# create - create new tests for your project
41+
# --maven – use the maven build tool
42+
# For detailed information on Cover CLI commands and options, see
43+
# https://docs.diffblue.com/features/cover-cli/commands-and-arguments
44+
45+
- name: Run Diffblue Cover
46+
env:
47+
DIFFBLUE_ACCESS_TOKEN: ${{ secrets.DIFFBLUE_TOKEN }}
48+
GITHUB_PR_NUMBER: ${{ github.event.number }}
49+
JVM_ARGS: -Xmx4g
50+
run: |
51+
export GITHUB_REPO_NAME=`echo $GITHUB_REPOSITORY | awk -F'/' '{print $2}'`
52+
git config --global --add safe.directory /__w/$GITHUB_REPO_NAME/$GITHUB_REPO_NAME
53+
dcover ci activate ${{ secrets.DIFFBLUE_LICENSE_KEY }} validate create
54+
55+
#############################################################################
56+
# SPECULATION: If we had a Docker based action then would it look like this?
57+
58+
- name: Run Diffblue Cover
59+
uses: diffblue/[email protected]
60+
with:
61+
license: ${{ secrets.DIFFBLUE_LICENSE }}
62+
token: ${{ secrets.DIFFBLUE_ACCESS_TOKEN }}
63+
commands: validate create
64+
65+
#############################################################################

0 commit comments

Comments
 (0)