Skip to content

Commit 996b713

Browse files
Merge pull request #22 from chrisgleissner/feature/github-action-build
Build with GitHub actions. Updated docs.
2 parents 28d6a37 + a9ea26f commit 996b713

File tree

4 files changed

+92
-56
lines changed

4 files changed

+92
-56
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
jdk-version: [8, 11]
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: JDK Setup
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '${{ matrix.jdk-version }}'
21+
distribution: 'adopt'
22+
cache: 'maven'
23+
24+
- name: Build
25+
run: mvn --batch-mode --update-snapshots package -Pjacoco
26+
27+
- name: Coveralls Report
28+
run: mvn coveralls:report --define repoToken=${{ secrets.COVERALLS_REPO_TOKEN }}

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 63 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,19 @@
22

33
[![Maven Central](https://img.shields.io/maven-central/v/com.github.chrisgleissner/spring-batch-rest-api)](https://search.maven.org/artifact/com.github.chrisgleissner/spring-batch-rest-api/)
44
[![Javadocs](https://www.javadoc.io/badge/com.github.chrisgleissner/spring-batch-rest-api.svg)](https://www.javadoc.io/doc/com.github.chrisgleissner/spring-batch-rest-api)
5-
[![Build Status](https://travis-ci.org/chrisgleissner/spring-batch-rest.svg?branch=master)](https://travis-ci.org/chrisgleissner/spring-batch-rest)
5+
![Build Status](https://github.com/chrisgleissner/spring-batch-rest/actions/workflows/build.yml/badge.svg)
66
[![Coverage Status](https://coveralls.io/repos/github/chrisgleissner/spring-batch-rest/badge.svg?branch=master)](https://coveralls.io/github/chrisgleissner/spring-batch-rest?branch=master)
77
[![Maintainability](https://api.codeclimate.com/v1/badges/2267ddd7cbbfc5e22b86/maintainability)](https://codeclimate.com/github/chrisgleissner/spring-batch-rest/maintainability)
88

99
REST API for <a href="https://spring.io/projects/spring-batch">Spring Batch</a> based on <a href="https://github.com/spring-projects/spring-boot">Spring Boot 2.2</a> and <a href="https://github.com/spring-projects/spring-hateoas">Spring HATOEAS</a>. It comes with an OpenAPI 3 documentation provided by <a href="https://github.com/springdoc/springdoc-openapi">Springdoc</a>.
1010

11-
Supports Java 8 and above. Tested on OpenJDK 8, 11, and 14.
11+
Supports Java 8 and above. Tested on OpenJDK 8 and 11.
1212

1313
## Features
1414
- Get information on jobs, job executions, and Quartz schedules
1515
- Start job execution (synchronous or asynchronous) with optional job property overrides. The job properties can
1616
either be obtained via a custom API or via standard Spring Batch job parameters, accessible from <a href="https://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/core/scope/StepScope.html">step-scoped beans</a>.
1717

18-
## Live Demo
19-
20-
Check out the <a href="https://spring-batch-rest.herokuapp.com/swagger-ui.html">live demo</a> of this project's Swagger UI. This demo is automatically updated whenever the repo's master branch changes. Please note that it may take up to 30s for this Heroku app to perform a cold start after it has not been used for a while.
21-
22-
Here's how to run a <a href="https://github.com/chrisgleissner/spring-batch-rest/tree/master/example/api/src/main/java/com/github/chrisgleissner/springbatchrest/example/core/PersonJobConfig.java">sample job<a>:
23-
* Click on `Spring Batch Job Executions`, then on `POST`. Now click on `Try it Out` on the right-hand side. Replace the contents of the `Example Value` input field with `{"name": "personJob"}` and press `Execute`.
24-
* The job has now been triggered. When it completes, you'll get a response body similar to:
25-
```
26-
{
27-
"jobExecution": {
28-
"id": 1,
29-
"jobId": 1,
30-
"jobName": "personJob",
31-
"startTime": "2018-12-23T18:19:13.185",
32-
"endTime": "2018-12-23T18:19:13.223",
33-
"exitCode": "COMPLETED",
34-
"exitDescription": "",
35-
"status": "COMPLETED",
36-
"exceptions": []
37-
},
38-
"_links": {
39-
"self": {
40-
"href": "https://spring-batch-rest.herokuapp.com/jobExecutions/1"
41-
}
42-
}
43-
}
44-
```
45-
* You can now view this and other recently completed jobs via the <a href="https://spring-batch-rest.herokuapp.com/jobExecutions?jobName=personJob&limitPerJob=3">job execution overview<a>:
46-
```
47-
{
48-
"_embedded": {
49-
"jobExecutionResourceList": [
50-
{
51-
"jobExecution": {
52-
"id": 1,
53-
"jobId": 1,
54-
"jobName": "personJob",
55-
...
56-
```
57-
5818
## Getting Started
5919

6020
To integrate the REST API in your Spring Boot project, first ensure you have an entry point to your application such as
@@ -110,7 +70,7 @@ implementation 'com.github.chrisgleissner:spring-batch-rest-quartz-api:1.5.1'
11070

11171
### See it in Action
11272

113-
To see `spring-batch-rest-api` in action, run
73+
To see `spring-batch-rest-api` in action, first install Java 8 or 11 as well as Maven, then run
11474
```text
11575
mvn install -Dmaven.test.skip; java -jar example/api/target/*.jar
11676
```
@@ -121,8 +81,67 @@ mvn install -Dmaven.test.skip; java -jar example/quartz-api/target/*.jar
12181
```
12282

12383
Once it's up, check the Swagger REST API docs at
124-
<a href="http://localhost:8080/swagger-ui.html">http://localhost:8080/swagger-ui.html</a>.
84+
[http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html).
12585

86+
### Sample Walkthrough
87+
88+
Here's how to run a [sample job](https://github.com/chrisgleissner/spring-batch-rest/tree/master/example/api/src/main/java/com/github/chrisgleissner/springbatchrest/example/core/PersonJobConfig.java), assuming
89+
you've started the API as described above:
90+
91+
* Click on `POST` to the left of `/jobExecutions`, then on `Try it Out` on the right-hand side. Replace the contents of the `Request body` with `{"name": "personJob"}`, then click `Execute`.
92+
* The job has now been triggered. When it completes, you'll get a response body similar to:
93+
```
94+
{
95+
"jobExecution": {
96+
"id": 0,
97+
"jobId": 0,
98+
"jobName": "personJob",
99+
"startTime": "2023-09-01T19:01:55.264",
100+
"endTime": "2023-09-01T19:01:55.317",
101+
"exitCode": "COMPLETED",
102+
"exitDescription": "",
103+
"status": "COMPLETED",
104+
"exceptions": []
105+
},
106+
"_links": {
107+
"self": {
108+
"href": "http://localhost:8080/jobExecutions/0"
109+
}
110+
}
111+
}
112+
```
113+
* You can now view this and other recently completed jobs by clicking on `GET` to the left of `/jobExecutions`, then on `Try it Out` followed by `Execute`. You should see something like:
114+
```
115+
{
116+
"_embedded": {
117+
"jobExecutionResourceList": [
118+
{
119+
"jobExecution": {
120+
"id": 0,
121+
"jobId": 0,
122+
"jobName": "personJob",
123+
"startTime": "2023-09-01T19:01:55.264",
124+
"endTime": "2023-09-01T19:01:55.317",
125+
"exitCode": "COMPLETED",
126+
"exitDescription": "",
127+
"status": "COMPLETED",
128+
"exceptions": []
129+
},
130+
"_links": {
131+
"self": {
132+
"href": "http://localhost:8080/jobExecutions/0"
133+
}
134+
}
135+
}
136+
]
137+
},
138+
"_links": {
139+
"self": {
140+
"href": "http://localhost:8080/jobExecutions?limitPerJob=3"
141+
}
142+
}
143+
}
144+
```
126145

127146
## REST Endpoints
128147

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
<plugin>
101101
<groupId>org.jacoco</groupId>
102102
<artifactId>jacoco-maven-plugin</artifactId>
103-
<version>0.8.5</version>
103+
<version>0.8.10</version>
104104
<executions>
105105
<execution>
106106
<goals>

0 commit comments

Comments
 (0)