diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 339e804..7b3f71b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: Build & test on: push: - branches-ignore: [ main ] + branches: [ develop ] pull_request: branches: [ develop ] workflow_dispatch: @@ -70,12 +70,36 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Maven deploy snapshot + if: github.event_name != 'pull_request' run: mvn deploy -DskipTests env: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: Get project version + if: github.event_name != 'pull_request' + id: project_version + run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT + + - name: Trigger utPLSQL-cli snapshot build + if: github.event_name != 'pull_request' + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.CLI_REPO_TOKEN }} + repository: utPLSQL/utPLSQL-cli + event-type: utPLSQL-java-api-build + client-payload: '{"api_version": "${{ steps.project_version.outputs.version }}"}' + + - name: Trigger utPLSQL-maven-plugin snapshot build + if: github.event_name != 'pull_request' + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.CLI_REPO_TOKEN }} + repository: utPLSQL/utPLSQL-maven-plugin + event-type: utPLSQL-java-api-build + client-payload: '{"api_version": "${{ steps.project_version.outputs.version }}"}' + - name: Publish unit test results uses: EnricoMi/publish-unit-test-result-action@v2 if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a72eb9..19ea48f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,8 +7,13 @@ on: description: 'Release version (e.g. 3.2.3)' required: true next_snapshot: - description: 'Next snapshot version (e.g. 3.2.4) without the "-SNAPSHOT" word' - required: true + description: 'Next development version (default: auto-increment patch,e.g. 3.2.4) without the "-SNAPSHOT" word' + required: false + +permissions: + contents: write + id-token: write + attestations: write defaults: run: @@ -75,8 +80,7 @@ jobs: ${{ runner.os }}-maven- - name: Set release version - run: | - mvn versions:set -DnewVersion=${{ inputs.release_version }} -DgenerateBackupPoms=false + run: mvn versions:set -DnewVersion=${{ inputs.release_version }} -DgenerateBackupPoms=false - name: Build and test release run: mvn clean verify -Prelease @@ -93,18 +97,21 @@ jobs: - name: Commit and tag release version run: | - git add -u - git commit -m "chore(release): release ${{ inputs.release_version }} [skip ci]" + git add pom.xml + git commit -m "Release ${{ inputs.release_version }} [skip ci]" git tag -a "v${{ inputs.release_version }}" -m "Release ${{ inputs.release_version }}" - - name: Set next snapshot version - run: | - mvn versions:set -DnewVersion=${{ inputs.next_snapshot }}-SNAPSHOT -DgenerateBackupPoms=false - - - name: Commit next snapshot version + - name: Calculate and set next development version run: | - git add -u - git commit -m "chore(release): bump to ${{ inputs.next_snapshot }}-SNAPSHOT [skip ci]" + if [[ -n "${{ inputs.next_snapshot }}" ]]; then + NEXT="${{ inputs.next_snapshot }}-SNAPSHOT" + else + IFS='.' read -r major minor patch <<< "${{ inputs.release_version }}" + NEXT="${major}.${minor}.$((patch + 1))-SNAPSHOT" + fi + mvn -B versions:set -DnewVersion="$NEXT" -DgenerateBackupPoms=false + git add pom.xml + git commit -m "Prepare next development version $NEXT [skip ci]" - name: Push commits and tag run: | diff --git a/README.md b/README.md index 3f11520..3e83c92 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ +[![latest-release](https://img.shields.io/github/release/utPLSQL/utPLSQL-java-api.svg)](https://github.com/utPLSQL/utPLSQL-java-api/releases) +[![license](https://img.shields.io/github/license/utPLSQL/utPLSQL-java-api.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![Build status](https://github.com/utPLSQL/utPLSQL-java-api/actions/workflows/build.yml/badge.svg)](https://github.com/utPLSQL/utPLSQL-java-api/actions/workflows/build.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=utPLSQL_utPLSQL-java-api&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=utPLSQL_utPLSQL-java-api) # utPLSQL-java-api This is a collection of classes, that makes it easy to access the [utPLSQL v3](https://github.com/utPLSQL/utPLSQL/) database objects using Java. @@ -17,13 +20,13 @@ This is a Maven Library project, you can add on your Java project as a dependenc org.utplsql utplsql-java-api - 3.1.16 + 3.2.3 ``` ## Compatibility -The latest Java-API is always compatible with all database frameworks of the same major version. -For example API-3.0.4 is compatible with database framework 3.0.0-3.1.* but not with database framework 2.x. +The latest Java-API is always compatible with database frameworks of the same minor version. +For example API-3.2.3 is compatible with database framework 3.2 but not with database framework 3.0 or 3.3 It is although recommended to always use the latest release of the API to build your tools for utPLSQL. diff --git a/pom.xml b/pom.xml index b978e2d..e54d0fa 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.utplsql utplsql-java-api - 3.2.2 + 3.2.5-SNAPSHOT utPLSQL Java API Java API for running Unit Tests with utPLSQL v3+. @@ -12,13 +12,16 @@ UTF-8 - 11 - 11 + 17 + 5.12.2 23.7.0.25.01 utplsql https://sonarcloud.io + + 1.0.1 + ${project.build.directory}/coverage-html-download @@ -117,6 +120,49 @@ + + com.googlecode.maven-download-plugin + download-maven-plugin + 1.8.1 + + + download-coverage-html-assets + generate-resources + + wget + + + https://github.com/utPLSQL/utPLSQL-coverage-html/archive/refs/tags/${coverage.html.version}.zip + ${coverage.html.download.dir} + coverage-html.zip + true + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + copy-coverage-html-assets + process-resources + + copy-resources + + + ${project.build.outputDirectory}/CoverageHTMLReporter + + + ${coverage.html.download.dir}/utPLSQL-coverage-html-${coverage.html.version}/assets + false + + + + + + org.apache.maven.plugins maven-compiler-plugin @@ -239,11 +285,12 @@ org.sonatype.central central-publishing-maven-plugin - 0.7.0 + 0.10.0 true central true + published diff --git a/scripts/sql/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pkb b/scripts/sql/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pkb index 115bc15..e3623d5 100644 --- a/scripts/sql/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pkb +++ b/scripts/sql/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pkb @@ -122,5 +122,16 @@ CREATE OR REPLACE PACKAGE BODY TEST_PKG_TEST_ME AS UT.EXPECT(VEXPECTED).TO_(EQUAL(VACTUAL)); END; + + PROCEDURE TEST_THAT_FAILS IS + BEGIN + UT.FAIL('Tis test is meant to fail to demonstrate failure'); + END; + + PROCEDURE TEST_THAT_RAISES_EXCEPTION IS + l_num number; + BEGIN + l_num := 1/0; + END; END; / diff --git a/scripts/sql/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pks b/scripts/sql/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pks index 8a2b852..757cd5c 100644 --- a/scripts/sql/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pks +++ b/scripts/sql/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pks @@ -84,5 +84,10 @@ CREATE OR REPLACE PACKAGE TEST_PKG_TEST_ME AS -- %tags(cursor) PROCEDURE TEST_PR_TEST_ME_CURSOR; + -- %test( This is a failing test) + PROCEDURE TEST_THAT_FAILS; + + -- %test( This is a test that raises an exception) + PROCEDURE TEST_THAT_RAISES_EXCEPTION; END; / diff --git a/src/test/java/org/utplsql/api/ReporterInspectorIT.java b/src/test/java/org/utplsql/api/ReporterInspectorIT.java index 4f3f13d..96dc885 100644 --- a/src/test/java/org/utplsql/api/ReporterInspectorIT.java +++ b/src/test/java/org/utplsql/api/ReporterInspectorIT.java @@ -32,7 +32,6 @@ void testGetReporterInfo() throws SQLException, InvalidVersionException { assertEquals(infos.get(CoreReporters.UT_COVERAGE_HTML_REPORTER.name()).getType(), ReporterInfo.Type.SQL_WITH_JAVA); assertEquals(infos.get(CoreReporters.UT_COVERAGE_SONAR_REPORTER.name()).getType(), ReporterInfo.Type.SQL); - assertEquals(infos.get(CoreReporters.UT_COVERALLS_REPORTER.name()).getType(), ReporterInfo.Type.SQL); assertEquals(infos.get(CoreReporters.UT_DOCUMENTATION_REPORTER.name()).getType(), ReporterInfo.Type.SQL_WITH_JAVA); assertEquals(infos.get(CoreReporters.UT_SONAR_TEST_REPORTER.name()).getType(), ReporterInfo.Type.SQL); assertEquals(infos.get(CoreReporters.UT_TEAMCITY_REPORTER.name()).getType(), ReporterInfo.Type.SQL); diff --git a/src/test/java/org/utplsql/api/TestRunnerIT.java b/src/test/java/org/utplsql/api/TestRunnerIT.java index 4ceb184..00b5c13 100644 --- a/src/test/java/org/utplsql/api/TestRunnerIT.java +++ b/src/test/java/org/utplsql/api/TestRunnerIT.java @@ -1,6 +1,5 @@ package org.utplsql.api; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.function.Executable; import org.utplsql.api.compatibility.CompatibilityProxy; @@ -54,7 +53,6 @@ void runWithManyReporters() throws SQLException { .addReporter(CoreReporters.UT_DOCUMENTATION_REPORTER.name()) .addReporter(CoreReporters.UT_COVERAGE_HTML_REPORTER.name()) .addReporter(CoreReporters.UT_COVERAGE_SONAR_REPORTER.name()) - .addReporter(CoreReporters.UT_COVERALLS_REPORTER.name()) .addReporter(CoreReporters.UT_SONAR_TEST_REPORTER.name()) .addReporter(CoreReporters.UT_TEAMCITY_REPORTER.name()) .addReporter(CoreReporters.UT_JUNIT_REPORTER.name()) @@ -65,7 +63,6 @@ void runWithManyReporters() throws SQLException { /** * This can only be tested on frameworks >= 3.0.3 */ - @Disabled @Test void failOnErrors() throws SQLException, InvalidVersionException { Connection conn = getConnection(); @@ -82,8 +79,6 @@ void failOnErrors() throws SQLException, InvalidVersionException { @Test void runWithRandomExecutionOrder() throws SQLException { - CompatibilityProxy proxy = new CompatibilityProxy(getConnection()); - new TestRunner() .randomTestOrder(true) .randomTestOrderSeed(123) diff --git a/src/test/java/org/utplsql/api/reporter/CoverageHTMLReporterAssetTest.java b/src/test/java/org/utplsql/api/reporter/CoverageHTMLReporterAssetTest.java index b94cc32..b6e5297 100644 --- a/src/test/java/org/utplsql/api/reporter/CoverageHTMLReporterAssetTest.java +++ b/src/test/java/org/utplsql/api/reporter/CoverageHTMLReporterAssetTest.java @@ -1,6 +1,5 @@ package org.utplsql.api.reporter; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -25,7 +24,6 @@ private void testFileExists(Path filePath) { assertTrue(f.exists(), () -> "File " + f + " does not exist"); } - @Disabled("No idea why this ever worked") @Test void writeReporterAssetsTo() throws RuntimeException {