From 7a91a2912fd5174622e94cc95b29cebb3bd9ac1d Mon Sep 17 00:00:00 2001 From: Riccardo Maldini Date: Mon, 1 Feb 2021 12:44:42 +0100 Subject: [PATCH 1/6] Update Gradle wrapper to 6.8.1 Here are the highlights of this release: * Faster Kotlin DSL script compilation * Vendor selection for Java toolchains * Convenient execution of tasks in composite builds * Consistent dependency resolution --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index be52383e..28ff446a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From a3840a4b93777892fbd79307312b7ea37627e566 Mon Sep 17 00:00:00 2001 From: Riccardo Maldini Date: Mon, 1 Feb 2021 12:52:26 +0100 Subject: [PATCH 2/6] Add Jacoco plugin, configuration --- buildSrc/config/detekt.yml | 2 +- ...aquest.common-scala-conventions.gradle.kts | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/buildSrc/config/detekt.yml b/buildSrc/config/detekt.yml index 94d773a5..bc345e1d 100644 --- a/buildSrc/config/detekt.yml +++ b/buildSrc/config/detekt.yml @@ -31,6 +31,6 @@ performance: style: MagicNumber: - ignoreNumbers: ['-2', '-1', '0', '0.5', '1', '2', '3', '4', '10', '360.0'] + ignoreNumbers: ['-2', '-1', '0','0.6', '0.5', '1', '2', '3', '4', '10', '360.0'] ForbiddenComment: allowedPatterns: 'TODO:' \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/scalaquest.common-scala-conventions.gradle.kts b/buildSrc/src/main/kotlin/scalaquest.common-scala-conventions.gradle.kts index 51f7d053..6ed7616d 100644 --- a/buildSrc/src/main/kotlin/scalaquest.common-scala-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/scalaquest.common-scala-conventions.gradle.kts @@ -6,6 +6,9 @@ plugins { // Adds support for Scala scala + // Adds jacoco support + jacoco + // Support for semantic gis-sensitive semantic versioning id("org.danilopianini.git-sensitive-semantic-versioning") @@ -16,6 +19,30 @@ plugins { id("com.diffplug.spotless") } +tasks.jacocoTestCoverageVerification { + violationRules { + rule { + limit { + counter = "CLASS" + value = "COVEREDRATIO" + minimum = 0.6.toBigDecimal() + } + } + } +} + +tasks.test { + finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run +} + +tasks.jacocoTestReport { + dependsOn(tasks.test) // tests are required to run before generating the report + + reports { + xml.isEnabled = true + } +} + repositories { jcenter() } From d6c6ec6b7449c598ed7bcb193fbaf7d333ec67de Mon Sep 17 00:00:00 2001 From: Riccardo Maldini Date: Fri, 5 Feb 2021 19:57:14 +0100 Subject: [PATCH 3/6] Corrections for ci workflows --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++ .github/workflows/opt-in-ci.yml | 27 +++++++++---- .github/workflows/stable-branch-ci.yml | 53 ------------------------- 3 files changed, 74 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/stable-branch-ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..182d193a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +# Continuous Integration workflow, which aims to assure correctness and +# quality of the sources that converges into the stable branches (dev and main). + +on: + push: + branches: + - main + - dev + pull_request: + branches: + - main + - dev + +jobs: + ci: + name: Lint, build and test + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: true + matrix: + os: [ ubuntu-latest, macOS-latest, windows-latest ] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # The project uses by default Java 11 (LTS) with scala 2.13 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- + + # run it on the entire matrix would be overkill + - name: Lint sources + if: contains(runner.os, 'Linux') + run: ./gradlew spotlessCheck + + - name: Compile sources + run: ./gradlew assemble + + - name: Test sources + run: ./gradlew check diff --git a/.github/workflows/opt-in-ci.yml b/.github/workflows/opt-in-ci.yml index 5a5f986f..cbf15981 100644 --- a/.github/workflows/opt-in-ci.yml +++ b/.github/workflows/opt-in-ci.yml @@ -1,5 +1,9 @@ name: Opt-in CI +# A minimal version of the Continuous Integration workflow, triggerable on-demand +# from feature branches when needed, by the use of keyword [lint], [build] or [test] +# (or combination of them). + on: push: branches: @@ -7,21 +11,24 @@ on: - 'feature/*' jobs: - OptIn: - if: contains(github.event.head_commit.message, '[style]') || contains(github.event.head_commit.message, '[asm]') + build: + name: Lint, build and test + if: | + contains(github.event.head_commit.message, '[lint]') || + contains(github.event.head_commit.message, '[build]') || + contains(github.event.head_commit.message, '[test]') + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 - # The project uses java 11 (LTS) with scala 2.13 - name: Set up JDK 11 uses: actions/setup-java@v1 with: java-version: 11 - # Use cache if available for Gradle - name: Cache Gradle packages uses: actions/cache@v2 with: @@ -32,10 +39,14 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Syntax and Style Check with Spotless - if: contains(github.event.head_commit.message, '[style]') + - name: Lint sources + if: contains(github.event.head_commit.message, '[lint]') run: ./gradlew spotlessCheck - - name: Compile all Scala sources - if: contains(github.event.head_commit.message, '[asm]') + - name: Compile sources + if: contains(github.event.head_commit.message, '[build]') run: ./gradlew assemble + + - name: Test sources + if: contains(github.event.head_commit.message, '[test]') + run: ./gradlew check diff --git a/.github/workflows/stable-branch-ci.yml b/.github/workflows/stable-branch-ci.yml deleted file mode 100644 index 37ff6654..00000000 --- a/.github/workflows/stable-branch-ci.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Stable Branches CI - -on: - # Trigger the workflow on pushes and pull request, on stable branches - push: - branches: - - main - - dev - pull_request: - branches: - - main - - dev - -jobs: - StabilityCheck: - - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: [ ubuntu-latest, macOS-latest, windows-latest ] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # The project uses java 11 (LTS) with scala 2.13 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - # Use cache if available for Gradle - - name: Cache Gradle packages - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Syntax and Style Check with Spotless - # run it on the entire matrix would be overkill - if: contains(runner.os, 'Linux') - run: ./gradlew spotlessCheck - - - name: Compile all Scala sources - run: ./gradlew assemble - - - name: Tests and checks - run: ./gradlew check \ No newline at end of file From 06b33ba983a952eeffcae09b115819b679a8f8e1 Mon Sep 17 00:00:00 2001 From: Riccardo Maldini Date: Fri, 5 Feb 2021 22:16:50 +0100 Subject: [PATCH 4/6] Set up Scoverage plugin --- build.gradle.kts | 9 ++++++ buildSrc/build.gradle.kts | 1 + ...aquest.common-scala-conventions.gradle.kts | 28 ++----------------- ...scalaquest.examples-conventions.gradle.kts | 5 ++++ ...calaquest.libraries-conventions.gradle.kts | 5 ++++ core/build.gradle.kts | 3 +- gradle.properties | 1 - versions.properties | 22 +++++++++++++++ 8 files changed, 45 insertions(+), 29 deletions(-) delete mode 100644 gradle.properties diff --git a/build.gradle.kts b/build.gradle.kts index 919b1090..184e9578 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,13 @@ +plugins { + // Root-level plugin is necessary to run aggregateScoverage + id("org.scoverage") +} + subprojects { } buildscript { repositories { mavenCentral() }} + +repositories { + jcenter() +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 1749ead2..6d774117 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -26,6 +26,7 @@ dependencies { implementation("org.danilopianini:publish-on-central:_") implementation("com.github.maiflai:gradle-scalatest:_") implementation("com.diffplug.spotless:spotless-plugin-gradle:_") + implementation("gradle.plugin.org.scoverage:gradle-scoverage:_") // Makes Detekt configurable detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:_") diff --git a/buildSrc/src/main/kotlin/scalaquest.common-scala-conventions.gradle.kts b/buildSrc/src/main/kotlin/scalaquest.common-scala-conventions.gradle.kts index 6ed7616d..772fb278 100644 --- a/buildSrc/src/main/kotlin/scalaquest.common-scala-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/scalaquest.common-scala-conventions.gradle.kts @@ -6,8 +6,8 @@ plugins { // Adds support for Scala scala - // Adds jacoco support - jacoco + // Adds scoverage support + id("org.scoverage") // Support for semantic gis-sensitive semantic versioning id("org.danilopianini.git-sensitive-semantic-versioning") @@ -19,30 +19,6 @@ plugins { id("com.diffplug.spotless") } -tasks.jacocoTestCoverageVerification { - violationRules { - rule { - limit { - counter = "CLASS" - value = "COVEREDRATIO" - minimum = 0.6.toBigDecimal() - } - } - } -} - -tasks.test { - finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run -} - -tasks.jacocoTestReport { - dependsOn(tasks.test) // tests are required to run before generating the report - - reports { - xml.isEnabled = true - } -} - repositories { jcenter() } diff --git a/buildSrc/src/main/kotlin/scalaquest.examples-conventions.gradle.kts b/buildSrc/src/main/kotlin/scalaquest.examples-conventions.gradle.kts index 165f0550..19542edf 100644 --- a/buildSrc/src/main/kotlin/scalaquest.examples-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/scalaquest.examples-conventions.gradle.kts @@ -10,3 +10,8 @@ plugins { // Apply the application plugin to add support for building a CLI application in Java application } + +// examples do not need coverage checks +scoverage { + minimumRate.set(0.toBigDecimal()) +} diff --git a/buildSrc/src/main/kotlin/scalaquest.libraries-conventions.gradle.kts b/buildSrc/src/main/kotlin/scalaquest.libraries-conventions.gradle.kts index 76019e8c..6d3c169b 100644 --- a/buildSrc/src/main/kotlin/scalaquest.libraries-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/scalaquest.libraries-conventions.gradle.kts @@ -10,3 +10,8 @@ plugins { // Apply the java-library plugin for API and implementation separation. `java-library` } + +// todo libraries need 75% coverage at least. Temporarily set at 0 as cli test must be finished +scoverage { + minimumRate.set(0.toBigDecimal()) +} diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 16393b47..ed259090 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -7,5 +7,4 @@ dependencies { // prolog implementation("it.unibo.alice.tuprolog:tuprolog:3.3.0") - -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index af82e006..00000000 --- a/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -org.gradle.parallel=true \ No newline at end of file diff --git a/versions.properties b/versions.properties index 82c2f085..4c4e869c 100644 --- a/versions.properties +++ b/versions.properties @@ -18,12 +18,14 @@ version.com.github.julien-truffaut..monocle-core_2.13=2.0.3 ## # available=2.0.5 ## # available=2.1.0 ## # available=2.2.0-M1 +## # available=3.0.0-M0a version.com.github.julien-truffaut..monocle-macro_2.13=2.0.3 ## # available=2.0.4 ## # available=2.0.5 ## # available=2.1.0 ## # available=2.2.0-M1 +## # available=3.0.0-M0a version.com.github.maiflai..gradle-scalatest=0.30 @@ -99,6 +101,10 @@ version.com.vladsch.flexmark..flexmark-all=0.35.10 version.dev.zio..zio_2.13=1.0.3 ## # available=1.0.4 +## # available=1.0.4-1 +## # available=1.0.4-2 + +version.gradle.plugin.org.scoverage..gradle-scoverage=5.0.0 version.io.gitlab.arturbosch.detekt..detekt-formatting=1.15.0-RC1 @@ -110,6 +116,12 @@ version.org.danilopianini..git-sensitive-semantic-versioning=0.2.2 ## # available=0.2.3-dev02-5fe3322 ## # available=0.2.3-dev03-54802b0 ## # available=0.2.3-dev03-3a2bc63 +## # available=0.2.3-dev04-44b3aff +## # available=0.2.3-dev04-5538fbe +## # available=0.2.3-dev05-154bcf0 +## # available=0.2.3-dev05-4fe4749 +## # available=0.2.3-dev06-1d3780f +## # available=0.2.3-dev06-6b47ae5 ## # available=0.2.3 version.org.danilopianini..publish-on-central=0.3.0 @@ -150,7 +162,17 @@ version.org.danilopianini..publish-on-central=0.3.0 ## # available=0.4.1-dev06-037a4f5 ## # available=0.4.1-dev07-e22f0aa ## # available=0.4.1-dev07-4ada7d1 +## # available=0.4.1-dev08-f9cec07 +## # available=0.4.1-dev08-b195394 +## # available=0.4.1-dev09-c8c16e7 ## # available=0.4.1 +## # available=0.4.2-dev01-dddb9c4 +## # available=0.4.2-dev01-4682ff8 +## # available=0.4.2-dev02-84a27cb +## # available=0.4.2-dev02-de8ce8e +## # available=0.4.2-dev03-bf51b42 +## # available=0.4.2-dev04-6c767b1 +## # available=0.4.2 version.org.scala-lang..scala-library=2.13.3 ## # available=2.13.4 From ae54facd7cdec68edcbbca2b1ea01e64aefd116e Mon Sep 17 00:00:00 2001 From: Riccardo Maldini Date: Fri, 5 Feb 2021 22:19:20 +0100 Subject: [PATCH 5/6] Set up coverage theshold in CI --- .github/workflows/ci.yml | 3 +++ .github/workflows/opt-in-ci.yml | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 182d193a..446320df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,3 +53,6 @@ jobs: - name: Test sources run: ./gradlew check + + - name: Check coverage + run: ./gradlew checkScoverage \ No newline at end of file diff --git a/.github/workflows/opt-in-ci.yml b/.github/workflows/opt-in-ci.yml index cbf15981..c9d59221 100644 --- a/.github/workflows/opt-in-ci.yml +++ b/.github/workflows/opt-in-ci.yml @@ -47,6 +47,8 @@ jobs: if: contains(github.event.head_commit.message, '[build]') run: ./gradlew assemble - - name: Test sources + - name: Test sources and coverage check if: contains(github.event.head_commit.message, '[test]') - run: ./gradlew check + run: | + ./gradlew check + ./gradlew checkScoverage \ No newline at end of file From 74d3b9e63e024587233359fe6c76ff0e8ada88f1 Mon Sep 17 00:00:00 2001 From: Riccardo Maldini Date: Sat, 6 Feb 2021 10:44:34 +0100 Subject: [PATCH 6/6] Refresh versions --- versions.properties | 55 ++++++++++----------------------------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/versions.properties b/versions.properties index 8f638e37..8ae6cdb1 100644 --- a/versions.properties +++ b/versions.properties @@ -6,21 +6,18 @@ ## Please, don't put extra comments in that file yet, keeping them is not supported yet. plugin.io.gitlab.arturbosch.detekt=1.15.0 -## # available=1.15.0-RC2 ## # available=1.16.0-RC1 version.com.diffplug.spotless..spotless-plugin-gradle=5.8.2 ## # available=5.9.0 version.com.github.julien-truffaut..monocle-core_2.13=2.1.0 -## # available=2.0.4 -## # available=2.0.5 ## # available=2.2.0-M1 +## # available=3.0.0-M0a version.com.github.julien-truffaut..monocle-macro_2.13=2.1.0 -## # available=2.0.4 -## # available=2.0.5 ## # available=2.2.0-M1 +## # available=3.0.0-M0a version.com.github.maiflai..gradle-scalatest=0.30 @@ -95,6 +92,10 @@ version.com.vladsch.flexmark..flexmark-all=0.35.10 ## # available=0.62.2 version.dev.zio..zio_2.13=1.0.4 +## # available=1.0.4-1 +## # available=1.0.4-2 + +version.gradle.plugin.org.scoverage..gradle-scoverage=5.0.0 version.io.gitlab.arturbosch.detekt..detekt-formatting=1.15.0-RC1 @@ -106,47 +107,15 @@ version.org.danilopianini..git-sensitive-semantic-versioning=0.2.2 ## # available=0.2.3-dev02-5fe3322 ## # available=0.2.3-dev03-54802b0 ## # available=0.2.3-dev03-3a2bc63 +## # available=0.2.3-dev04-44b3aff +## # available=0.2.3-dev04-5538fbe +## # available=0.2.3-dev05-154bcf0 +## # available=0.2.3-dev05-4fe4749 +## # available=0.2.3-dev06-1d3780f +## # available=0.2.3-dev06-6b47ae5 ## # available=0.2.3 version.org.danilopianini..publish-on-central=0.4.2 -## # available=0.4.0-dev0c-41d440e -## # available=0.4.0-dev0i-57f094a -## # available=0.4.0-dev0k-ab8cad0 -## # available=0.4.0-dev0f-835bdb2 -## # available=0.4.0-dev0a-6b80e12 -## # available=0.4.0-dev0l-212cc26 -## # available=0.4.0-dev0f-73e6556 -## # available=0.4.0-dev0j-c377852 -## # available=0.4.0-dev01-5c4d45d -## # available=0.4.0-dev01-c97bafa -## # available=0.4.0-dev01-c7fc5c9 -## # available=0.4.0-dev02-70752ac -## # available=0.4.0-dev02-78cde9c -## # available=0.4.0-dev03-14dc1ee -## # available=0.4.0-dev03-1a0500f -## # available=0.4.0-dev04-9ca8353 -## # available=0.4.0-dev04-af81085 -## # available=0.4.0-dev05-057388d -## # available=0.4.0-dev05-a4e967d -## # available=0.4.0-dev06-0df5061 -## # available=0.4.0-dev07-49e672d -## # available=0.4.0-dev09-612d591 -## # available=0.4.0 -## # available=0.4.1-dev01-030476c -## # available=0.4.1-dev02-097aec0 -## # available=0.4.1-dev02-08c7590 -## # available=0.4.1-dev02-1fb8824 -## # available=0.4.1-dev03-246f752 -## # available=0.4.1-dev03-8533087 -## # available=0.4.1-dev04-30320b5 -## # available=0.4.1-dev04-2bb3a34 -## # available=0.4.1-dev05-817de0e -## # available=0.4.1-dev05-b46f15d -## # available=0.4.1-dev06-4f941de -## # available=0.4.1-dev06-037a4f5 -## # available=0.4.1-dev07-e22f0aa -## # available=0.4.1-dev07-4ada7d1 -## # available=0.4.1 version.org.scala-lang..scala-library=2.13.4