diff --git a/.github/workflows/jgiven_align_gh_pages.yml b/.github/workflows/jgiven_align_gh_pages.yml new file mode 100644 index 0000000000..f8bb28c26b --- /dev/null +++ b/.github/workflows/jgiven_align_gh_pages.yml @@ -0,0 +1,18 @@ +name: Align gh-pages branch +on: + push: + branches: + - 'master' + +jobs: + build: + name: Rebase gh-pages + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Checkout gh-pages + run: git checkout -f gh-pages + - name: Rebase on master + run: git rebase origin/master + - name: Replace version on origin + run: git push --force-with-lease diff --git a/.github/workflows/jgiven_examples_build.yml b/.github/workflows/jgiven_examples_build.yml index 10dd578f5c..a7221aa2cf 100644 --- a/.github/workflows/jgiven_examples_build.yml +++ b/.github/workflows/jgiven_examples_build.yml @@ -16,23 +16,35 @@ jobs: uses: android-actions/setup-android@v2 - name: Grant execute permission for bash script run: chmod +x scripts/local_release_with_version.sh - - name: Load the bash script + - name: Produce a local release with version 1.1-t run: source scripts/local_release_with_version.sh - name: Test Kotlin Example Project - run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/kotlin/build.gradle 1.1-t + run: > + source scripts/source_files/helper_functions.sh + && runGradleTestOnGivenProject example-projects/kotlin/build.gradle 1.1-t - name: Test JUnit5 Example Project - run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/junit5/build.gradle 1.1-t + run: > + source scripts/source_files/helper_functions.sh + && runGradleTestOnGivenProject example-projects/junit5/build.gradle 1.1-t - uses: olafurpg/setup-scala@v13 - name: Test Scala Example Project run: source scripts/source_files/helper_functions.sh && runScalaTest - name: Test Selenium Example Project - run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/selenium/build.gradle 1.1-t + run: > + source scripts/source_files/helper_functions.sh + && runGradleTestOnGivenProject example-projects/selenium/build.gradle 1.1-t - name: Test Spock Example Project - run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/spock/build.gradle 1.1-t + run: > + source scripts/source_files/helper_functions.sh + && runGradleTestOnGivenProject example-projects/spock/build.gradle 1.1-t - name: Test Spring-Boot Example Project - run: source scripts/source_files/helper_functions.sh && runGradleTestOnGivenProject example-projects/spring-boot/build.gradle 1.1-t + run: > + source scripts/source_files/helper_functions.sh + && runGradleTestOnGivenProject example-projects/spring-boot/build.gradle 1.1-t - name: Test Maven Example Project - run: source scripts/source_files/helper_functions.sh && runMavenTestOnGivenProject example-projects/maven/pom.xml 1.1-t + run: > + source scripts/source_files/helper_functions.sh + && runMavenTestOnGivenProject example-projects/maven/pom.xml 1.1-t - name: Upload test results html files continue-on-error: true if: ${{failure()}} diff --git a/build.gradle b/build.gradle index 81910711e9..b23002086d 100644 --- a/build.gradle +++ b/build.gradle @@ -58,8 +58,6 @@ subprojects { junitDataproviderVersion = '1.13.1' // set default junit version if not set via command line junitVersion = rootProject.hasProperty('junitVersion') ? rootProject.junitVersion : '4.13.2' - junit5Version = '5.8.2' - junit5PlatformRunnerVersion = '1.8.2' junitParamsVersion = '1.1.1' testngVersion = '7.5' assertjVersion = '3.22.0' @@ -69,7 +67,7 @@ subprojects { gsonVersion = '2.8.8' guavaVersion = '30.1.1-jre' guavaAndroidVersion = '28.1-android' - springVersion = '5.3.9' + springVersion = '5.3.19' jacocoVersion = '0.8.5' quickcheckVersion = '0.6' hsqldbVersion = '2.3.2' diff --git a/docs/installation.adoc b/docs/installation.adoc index bb5599cf17..c22e900ed6 100644 --- a/docs/installation.adoc +++ b/docs/installation.adoc @@ -13,7 +13,7 @@ to use different dependencies. If you are using JUnit, you must depend on the `jgiven-junit` artifact. Note that `jgiven-junit` does not directly depend on JUnit, thus you also must have a dependency to JUnit itself. -JGiven requires at least JUnit 4.9, while the recommended version is 4.12. +JGiven requires at least JUnit 4.9, while the recommended version is 4.13.2. ==== Maven Dependency [source,maven,subs="verbatim,attributes"] diff --git a/example-projects/junit5/build.gradle b/example-projects/junit5/build.gradle index 01baa71690..9e0a4a7aa3 100644 --- a/example-projects/junit5/build.gradle +++ b/example-projects/junit5/build.gradle @@ -26,7 +26,6 @@ compileJava { } ext { - junit5Version = '5.8.2' jgivenVersion = version } @@ -40,8 +39,8 @@ repositories { dependencies { testImplementation "com.tngtech.jgiven:jgiven-junit5:${jgivenVersion}" - testImplementation "org.junit.jupiter:junit-jupiter-api:${junit5Version}" - testImplementation "org.junit.jupiter:junit-jupiter-engine:${junit5Version}" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' } test { diff --git a/example-projects/kotlin/build.gradle b/example-projects/kotlin/build.gradle index 9b0390e5e1..07b79fd949 100644 --- a/example-projects/kotlin/build.gradle +++ b/example-projects/kotlin/build.gradle @@ -1,11 +1,21 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + } + dependencies { + classpath "com.tngtech.jgiven:jgiven-gradle-plugin:${version}" + } +} + plugins { id "org.jetbrains.kotlin.jvm" version "1.6.21" - id "com.tngtech.jgiven.gradle-plugin" version "1.2.1" } apply plugin: 'java' apply plugin: 'idea' apply plugin: 'eclipse' +apply plugin: 'com.tngtech.jgiven.gradle-plugin' compileJava { sourceCompatibility = 1.8 @@ -15,7 +25,6 @@ compileJava { } ext { - junit5Version = '5.7.2' jgivenVersion = version } @@ -27,8 +36,8 @@ repositories { dependencies { testImplementation 'com.tngtech.jgiven:jgiven-junit5:' + jgivenVersion testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' - testImplementation 'org.junit.jupiter:junit-jupiter-api:' + junit5Version - testImplementation 'org.junit.jupiter:junit-jupiter-engine:' + junit5Version + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' } test { diff --git a/jgiven-spring-junit5/build.gradle b/jgiven-spring-junit5/build.gradle index 7f5baa9626..46069ad79c 100644 --- a/jgiven-spring-junit5/build.gradle +++ b/jgiven-spring-junit5/build.gradle @@ -9,11 +9,11 @@ dependencies { api project(':jgiven-junit5') compileOnly "org.springframework:spring-context:$springVersion" compileOnly "org.springframework:spring-test:$springVersion" - compileOnly "org.junit.jupiter:junit-jupiter-api:$junit5Version" + compileOnly 'org.junit.jupiter:junit-jupiter-api:5.8.2' testImplementation project(':jgiven-html5-report') - testImplementation "org.junit.jupiter:junit-jupiter-engine:$junit5Version" - testImplementation "org.junit.platform:junit-platform-runner:$junit5PlatformRunnerVersion" - testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5Version" + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testImplementation 'org.junit.platform:junit-platform-runner:1.8.2' + testImplementation "org.junit.jupiter:junit-jupiter-params:5.8.2" testImplementation "org.springframework:spring-tx:$springVersion" testImplementation "org.springframework:spring-context:$springVersion" testImplementation "org.springframework:spring-test:$springVersion" diff --git a/renovate.json b/renovate.json index 510e832f14..978923cef0 100644 --- a/renovate.json +++ b/renovate.json @@ -26,18 +26,17 @@ ], "groupName": "junit5" }, - { - "packagePatterns": [ - "powermock" - ], - "groupName": "powermock" - }, { "matchUpdateTypes": ["minor", "patch"], "matchCurrentVersion": "!/^0/", "automerge": true } ], + "maven":{ + "fileMatch": [ + "jgiven-maven-plugin/src/main/maven/pom.xml" + ] + }, "schedule": [ "after 10pm every weekday", "before 5am every weekday", diff --git a/scripts/source_files/helper_functions.sh b/scripts/source_files/helper_functions.sh index 851b3d5a40..de11486dce 100644 --- a/scripts/source_files/helper_functions.sh +++ b/scripts/source_files/helper_functions.sh @@ -7,7 +7,7 @@ function update_version(){ local target_file="$2" local version_property="version" local version_matcher="${version_property}=.*" - if grep -E "${version_matcher}" "${target_file}" ;then + if grep -E "${version_matcher}" "${target_file}">/dev/null ;then sed -i -e "s/${version_matcher}/${version_property}=${target_version}/" "${target_file}" || return 12 else printf "Could not find version property to replace in file %s\n" "${target_file}" @@ -22,7 +22,7 @@ function update_maven_version() { local target_file="$2" local version_property="jgiven.version" local version_matcher="<${version_property}>.*<\/${version_property}>" - if grep -E "${version_matcher}" "${target_file}" ;then + if grep -E -q "${version_matcher}" "${target_file}" ;then sed -i -e "s/${version_matcher}/<${version_property}>${target_version}<\/${version_property}>/" "${target_file}" || return 12 else printf "Could not find version property to replace in file %s\n" "${target_file}" @@ -38,7 +38,7 @@ function update_scala_version() { local target_file="$2" local version_property="jgivenVersion" local version_matcher="${version_property} = .*" - if grep -E "${version_matcher}" "${target_file}" ;then + if grep -E "${version_matcher}" "${target_file}" >/dev/null ;then sed -i -e "s/${version_matcher}/${version_property} = \"${target_version}\"/" "${target_file}" || return 22 else printf "Could not find version property to replace in file %s\n" "${target_file}" @@ -51,7 +51,7 @@ function updateAllVersionInformation() { [ $# -eq 1 ] || return 31 local VERSION="$1" - echo Updating version in gradle.properties... + printf "Updating version in gradle.properties..." for file in "gradle.properties" \ "example-projects/junit5/gradle.properties" \ "example-projects/spock/gradle.properties" \ @@ -63,12 +63,17 @@ function updateAllVersionInformation() { do update_version "${VERSION}" "${file}" || exit $? done + printf "Done.\n" + printf "Updating version in scala files..." update_scala_version "${VERSION}" "example-projects/scala/build.sbt" || exit $? + printf "Done.\n" + printf "Updating version in maven files..." for file in "example-projects/java11/pom.xml" "example-projects/maven/pom.xml"; do update_maven_version "${VERSION}" "${file}" done + printf "Done.\n" } function runGradleTestOnGivenProject() { diff --git a/scripts/tests/test_helper_functions.sh b/scripts/tests/test_helper_functions.sh index 52a4ebffc6..cd6cd54756 100644 --- a/scripts/tests/test_helper_functions.sh +++ b/scripts/tests/test_helper_functions.sh @@ -40,11 +40,10 @@ test_update_version_replaces_version_in_pom(){ test_update_version_fails_if_property_not_in_file() { local test_file="properties.tmp" - trap "rm -f '${test_file}';exit" SIGTERM SIGINT + trap "rm -f '${test_file}';exit" SIGTERM SIGINT EXIT echo 'venison=0.x' > "${test_file}" update_version '1.0' "${test_file}" local output_variable=$? - rm -f "${test_file}" return $( [ ${output_variable} -ge 1 ]; echo $?) }