diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index 55fefbf..d55711f 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -4,29 +4,36 @@ on: [ push, pull_request, workflow_dispatch ] jobs: build-bld-project: - runs-on: ubuntu-latest - strategy: matrix: - java-version: [ 17, 20 ] + java-version: [ 17, 21, 24 ] + kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ] + os: [ ubuntu-latest, windows-latest, macos-latest ] + + runs-on: ${{ matrix.os }} steps: - name: Checkout source repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: - distribution: 'zulu' + distribution: "zulu" java-version: ${{ matrix.java-version }} - - name: Grant execute permission for bld - run: chmod +x bld - - - name: Download the dependencies + - name: Download dependencies [examples] + working-directory: examples run: ./bld download - - name: Run tests with bld + - name: Run tests with JaCoCo [examples] + working-directory: examples + run: ./bld compile jacoco + + - name: Download dependencies + run: ./bld download + + - name: Run tests run: ./bld compile test \ No newline at end of file diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index f6122cd..508f6a5 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,14 +30,14 @@ jobs: steps: - name: Checkout source repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: - distribution: 'zulu' + distribution: "zulu" java-version: 17 - name: Build Javadocs @@ -47,11 +47,11 @@ jobs: uses: actions/configure-pages@v3 - name: Upload artifact - uses: actions/upload-pages-artifact@v1 + uses: actions/upload-pages-artifact@v3 with: # Upload generated Javadocs repository - path: 'build/javadoc/' + path: "build/javadoc/" - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v1 \ No newline at end of file + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index ea86fe8..aa3405d 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ atlassian-ide-plugin.xml .idea/httpRequests local.properties +test-output diff --git a/.idea/bld.xml b/.idea/bld.xml new file mode 100644 index 0000000..6600cee --- /dev/null +++ b/.idea/bld.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/copyright/Apache_License.xml b/.idea/copyright/Apache_License.xml index ade80da..4446c15 100644 --- a/.idea/copyright/Apache_License.xml +++ b/.idea/copyright/Apache_License.xml @@ -1,6 +1,6 @@ - - + \ No newline at end of file diff --git a/.idea/icon.svg b/.idea/icon.svg new file mode 100644 index 0000000..81220b4 --- /dev/null +++ b/.idea/icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index 59ffe59..a203de8 100644 --- a/.idea/libraries/bld.xml +++ b/.idea/libraries/bld.xml @@ -2,12 +2,12 @@ - + - + diff --git a/.idea/libraries/compile.xml b/.idea/libraries/compile.xml index 9bd86aa..99cc0c0 100644 --- a/.idea/libraries/compile.xml +++ b/.idea/libraries/compile.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/.idea/libraries/runtime.xml b/.idea/libraries/runtime.xml index 2ae5c4b..d4069f2 100644 --- a/.idea/libraries/runtime.xml +++ b/.idea/libraries/runtime.xml @@ -8,7 +8,7 @@ - - + + \ No newline at end of file diff --git a/.idea/libraries/test.xml b/.idea/libraries/test.xml index b80486a..57ed5ef 100644 --- a/.idea/libraries/test.xml +++ b/.idea/libraries/test.xml @@ -8,7 +8,7 @@ - - + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 9e8368e..ba429d0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.bld/dist/bld-1.9.0.jar", + "${HOME}/.bld/dist/bld-2.2.1.jar", "lib/**/*.jar" ] } diff --git a/README.md b/README.md index 5c547e3..e44b64e 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,30 @@ # [bld](https://rife2.com/bld) Extension to Run Tests with [TestNG](https://testng.org/) - [![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) -[![bld](https://img.shields.io/badge/1.9.0-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) +[![bld](https://img.shields.io/badge/2.2.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) [![Release](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/releases/com/uwyn/rife2/bld-testng/maven-metadata.xml?color=blue)](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-testng) [![Snapshot](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/snapshots/com/uwyn/rife2/bld-testng/maven-metadata.xml?label=snapshot)](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-testng) [![GitHub CI](https://github.com/rife2/bld-testng/actions/workflows/bld.yml/badge.svg)](https://github.com/rife2/bld-testng/actions/workflows/bld.yml) -To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions). +To install the latest version, add the following to the `lib/bld/bld-wrapper.properties` file: + +```properties +bld.extension-testng=com.uwyn.rife2:bld-testng +``` + +For more information, please refer to the [extensions](https://github.com/rife2/bld/wiki/Extensions) documentation. + +## Test with TestNG To run the tests with TestNG, add the following to your build file: ```java -@BuildCommand(summary = "Tests the project with TestNG") -public void testng() throws Exception { - new TestNgOperation() - .fromProject(this) - .packages("com.example") - .execute(); -} -``` - -```console -./bld compile testng -``` - -You could also override the default `test` command: - -```java -@BuildCommand(summary = "Tests the project with TestNG") -public void test throws Exception { - new TestNgOperation() - .fromProject(this) - .suites("src/test/resources/testng.xml") - .verbose(2) - .execute(); +@Override +public TestOperation testOperation() { + return new TestNgOperation() + .fromProject(this) + .packages("com.example"); } ``` @@ -53,6 +42,5 @@ Don't forget to add a TestNG `test` dependency to your build file, as it is not ```java repositories = List.of(MAVEN_CENTRAL); -scope(test).include(dependency("org.testng", "testng", version(7, 9, 0))); - +scope(test).include(dependency("org.testng", "testng", version(7, 11, 0))); ``` diff --git a/checkcliargs.sh b/checkcliargs.sh deleted file mode 100755 index 0bad85a..0000000 --- a/checkcliargs.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -MAIN="org.testng.TestNG" -TMPNEW=/tmp/checkcliargs-new -TMPOLD=/tmp/checkcliargs-old - -java -cp "lib/test/*" $MAIN >$TMPNEW -java -cp "examples/lib/test/*" $MAIN >$TMPOLD - -diff $TMPOLD $TMPNEW - -rm -rf $TMPNEW $TMPOLD diff --git a/config/pmd.xml b/config/pmd.xml index 1039e40..2641880 100644 --- a/config/pmd.xml +++ b/config/pmd.xml @@ -7,9 +7,9 @@ - - + + @@ -24,8 +24,8 @@ - + @@ -35,8 +35,9 @@ - + + @@ -52,8 +53,6 @@ - - @@ -107,4 +106,4 @@ - \ No newline at end of file + diff --git a/examples/.idea/bld.xml b/examples/.idea/bld.xml new file mode 100644 index 0000000..6600cee --- /dev/null +++ b/examples/.idea/bld.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/examples/.idea/libraries/bld.xml b/examples/.idea/libraries/bld.xml index 59ffe59..a203de8 100644 --- a/examples/.idea/libraries/bld.xml +++ b/examples/.idea/libraries/bld.xml @@ -2,12 +2,12 @@ - + - + diff --git a/examples/.idea/libraries/compile.xml b/examples/.idea/libraries/compile.xml index 9bd86aa..99cc0c0 100644 --- a/examples/.idea/libraries/compile.xml +++ b/examples/.idea/libraries/compile.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/examples/.idea/libraries/runtime.xml b/examples/.idea/libraries/runtime.xml index 2ae5c4b..d4069f2 100644 --- a/examples/.idea/libraries/runtime.xml +++ b/examples/.idea/libraries/runtime.xml @@ -8,7 +8,7 @@ - - + + \ No newline at end of file diff --git a/examples/.idea/libraries/test.xml b/examples/.idea/libraries/test.xml index b80486a..57ed5ef 100644 --- a/examples/.idea/libraries/test.xml +++ b/examples/.idea/libraries/test.xml @@ -8,7 +8,7 @@ - - + + \ No newline at end of file diff --git a/examples/.idea/misc.xml b/examples/.idea/misc.xml index 3b0e6ac..82dccc0 100644 --- a/examples/.idea/misc.xml +++ b/examples/.idea/misc.xml @@ -3,6 +3,10 @@ + + + +