Skip to content

Commit 84799f0

Browse files
committed
Refactor example build commands
1 parent 3cdbc1f commit 84799f0

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

.github/workflows/bld.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- name: Compile and run tests [example]
3131
working-directory: example
32-
run: ./bld compile test
32+
run: ./bld compile test-cli
3333

3434
- name: Download dependencies
3535
run: ./bld download

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For more information, please refer to the [extensions](https://github.com/rife2/
2121
To display JUnit failure reports, add the following to your `build` file:
2222

2323
```java
24-
@BuildCommand(summary = "Test the project with JUnit and run the reporter")
24+
@BuildCommand(summary = "Runs the JUnit reporter")
2525
public void reporter() throws Exception {
2626
new JUnitReporterOperation()
2727
.fromProject(this)
@@ -34,12 +34,7 @@ public void test() throws Exception {
3434
var op = testOperation().fromProject(this);
3535
// Set the reports directory
3636
op.testToolOptions().reportsDir(new File("build/test-results/test/"));
37-
38-
try {
39-
op.execute();
40-
} catch (ExitStatusException ignore) {
41-
// Ignore to allow the reporter to run
42-
}
37+
op.execute();
4338
}
4439
```
4540

@@ -50,10 +45,11 @@ for all available configuration options.
5045

5146
### Failures Summary
5247

53-
To display a summary of all failures, run the following command:
48+
To display a summary of all failures after running the tests, run the following command:
5449

5550
```console
56-
./bld compile test reporter
51+
./bld compile test
52+
./bld reporter
5753
```
5854

5955
The summary will look something like:

example/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
## Compile then test the project with JUnit and run the reporter
1+
## Compile and test the project, then run the reporter
22

33
```console
4-
./bld compile test reporter
4+
./bld compile test
5+
./bld reporter
56
```
67

78
## Display the first group of test failures
@@ -10,7 +11,7 @@
1011
./bld reporter --index=1
1112
```
1213

13-
## Display the first failure in the firt group of test failures
14+
## Display the first failure in the first group of test failures
1415

1516
```console
1617
./bld reporter --i=1.2

example/src/bld/java/com/example/ExampleBuild.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static void main(String[] args) {
3030
new ExampleBuild().start(args);
3131
}
3232

33-
@BuildCommand(summary = "Test the project with JUnit and run the reporter")
33+
@BuildCommand(summary = "Runs the JUnit reporter")
3434
public void reporter() throws Exception {
3535
new JUnitReporterOperation()
3636
.fromProject(this)
@@ -43,6 +43,14 @@ public void test() throws Exception {
4343
var op = testOperation().fromProject(this);
4444
// Set the reports directory
4545
op.testToolOptions().reportsDir(new File("build/test-results/test/"));
46+
op.execute();
47+
}
48+
49+
@BuildCommand(value = "test-ci", summary = "Tests the project on CI")
50+
public void testCi() throws Exception {
51+
var op = testOperation().fromProject(this);
52+
// Set the reports directory
53+
op.testToolOptions().reportsDir(new File("build/test-results/test/"));
4654

4755
try {
4856
op.execute();

0 commit comments

Comments
 (0)