diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index d55711f..55fefbf 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -4,36 +4,29 @@ on: [ push, pull_request, workflow_dispatch ] jobs: build-bld-project: + runs-on: ubuntu-latest + strategy: matrix: - 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 }} + java-version: [ 17, 20 ] steps: - name: Checkout source repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v4 + uses: actions/setup-java@v3 with: - distribution: "zulu" + distribution: 'zulu' java-version: ${{ matrix.java-version }} - - name: Download dependencies [examples] - working-directory: examples + - name: Grant execute permission for bld + run: chmod +x bld + + - name: Download the dependencies run: ./bld download - - name: Run tests with JaCoCo [examples] - working-directory: examples - run: ./bld compile jacoco - - - name: Download dependencies - run: ./bld download - - - name: Run tests + - name: Run tests with bld run: ./bld compile test \ No newline at end of file diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 508f6a5..f6122cd 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,14 +30,14 @@ jobs: steps: - name: Checkout source repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up JDK 17 - uses: actions/setup-java@v4 + uses: actions/setup-java@v3 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@v3 + uses: actions/upload-pages-artifact@v1 with: # Upload generated Javadocs repository - path: "build/javadoc/" + path: 'build/javadoc/' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/.gitignore b/.gitignore index aa3405d..ea86fe8 100644 --- a/.gitignore +++ b/.gitignore @@ -55,4 +55,3 @@ atlassian-ide-plugin.xml .idea/httpRequests local.properties -test-output diff --git a/.idea/bld.xml b/.idea/bld.xml deleted file mode 100644 index 6600cee..0000000 --- a/.idea/bld.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/copyright/Apache_License.xml b/.idea/copyright/Apache_License.xml index 4446c15..ade80da 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 deleted file mode 100644 index 81220b4..0000000 --- a/.idea/icon.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index a203de8..59ffe59 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 99cc0c0..9bd86aa 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 d4069f2..2ae5c4b 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 57ed5ef..b80486a 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 ba429d0..9e8368e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.bld/dist/bld-2.2.1.jar", + "${HOME}/.bld/dist/bld-1.9.0.jar", "lib/**/*.jar" ] } diff --git a/README.md b/README.md index e44b64e..5c547e3 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,41 @@ # [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/2.2.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) +[![bld](https://img.shields.io/badge/1.9.0-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 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 install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions). To run the tests with TestNG, add the following to your build file: ```java -@Override -public TestOperation testOperation() { - return new TestNgOperation() - .fromProject(this) - .packages("com.example"); +@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(); } ``` @@ -42,5 +53,6 @@ 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, 11, 0))); +scope(test).include(dependency("org.testng", "testng", version(7, 9, 0))); + ``` diff --git a/checkcliargs.sh b/checkcliargs.sh new file mode 100755 index 0000000..0bad85a --- /dev/null +++ b/checkcliargs.sh @@ -0,0 +1,12 @@ +#!/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 2641880..1039e40 100644 --- a/config/pmd.xml +++ b/config/pmd.xml @@ -7,9 +7,9 @@ + + - - @@ -24,8 +24,8 @@ - + @@ -35,9 +35,8 @@ - - + @@ -53,6 +52,8 @@ + + @@ -106,4 +107,4 @@ - + \ No newline at end of file diff --git a/examples/.idea/bld.xml b/examples/.idea/bld.xml deleted file mode 100644 index 6600cee..0000000 --- a/examples/.idea/bld.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/examples/.idea/libraries/bld.xml b/examples/.idea/libraries/bld.xml index a203de8..59ffe59 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 99cc0c0..9bd86aa 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 d4069f2..2ae5c4b 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 57ed5ef..b80486a 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 82dccc0..3b0e6ac 100644 --- a/examples/.idea/misc.xml +++ b/examples/.idea/misc.xml @@ -3,10 +3,6 @@ - - - -