-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : initial commit of keyset pagination
- Loading branch information
1 parent
893d3cd
commit 35abaa9
Showing
54 changed files
with
2,336 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: boot-data-keyset-pagination | ||
|
||
on: | ||
push: | ||
paths: | ||
- "jpa/boot-data-keyset-pagination/**" | ||
branches: [main] | ||
pull_request: | ||
paths: | ||
- "jpa/boot-data-keyset-pagination/**" | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
build: | ||
name: Run Unit & Integration Tests | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: "jpa/boot-data-keyset-pagination" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/[email protected] | ||
with: | ||
java-version: 21 | ||
distribution: "zulu" | ||
cache: "maven" | ||
- name: Start up redis via Docker Compose | ||
run: | | ||
cd docker | ||
docker compose up -d redis | ||
sleep 5 | ||
docker ps -a | ||
- name: Build and analyze | ||
run: ./mvnw clean verify | ||
- name: Codecov | ||
uses: codecov/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
jpa/boot-data-keyset-pagination/.github/workflows/maven.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: CI Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
distribution: [ 'temurin' ] | ||
java: [ '17' ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Java 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: ${{ matrix.distribution }} | ||
cache: 'maven' | ||
|
||
- name: Grant execute permission for mvnw | ||
run: chmod +x mvnw | ||
|
||
- name: Build with Maven | ||
run: ./mvnw clean verify | ||
|
||
- if: ${{ github.ref == 'refs/heads/main' }} | ||
name: SonarQube Scan | ||
run: ./mvnw compile sonar:sonar -Dsonar.login=${{ secrets.SONAR_TOKEN }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- if: ${{ github.ref == 'refs/heads/main' }} | ||
name: Build and Publish Docker Image | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=${{ secrets.DOCKER_USERNAME }}/boot-data-keyset-pagination | ||
docker push ${{ secrets.DOCKER_USERNAME }}/boot-data-keyset-pagination |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Misc ### | ||
*.log | ||
.DS_Store |
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
jpa/boot-data-keyset-pagination/.mvn/wrapper/maven-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"generator-springboot": { | ||
"appName": "boot-data-keyset-pagination", | ||
"packageName": "com.example.keysetpagination", | ||
"databaseType": "postgresql", | ||
"dbMigrationTool": "liquibase", | ||
"dbMigrationFormat": "xml", | ||
"features": [], | ||
"buildTool": "maven", | ||
"packageFolder": "com/example/keysetpagination", | ||
"liquibaseMigrationCounter": 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM eclipse-temurin:17.0.8_7-jre-focal as builder | ||
WORKDIR application | ||
ARG JAR_FILE=target/boot-data-keyset-pagination-0.0.1-SNAPSHOT.jar | ||
COPY ${JAR_FILE} application.jar | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
# the second stage of our build will copy the extracted layers | ||
FROM eclipse-temurin:17.0.8_7-jre-focal | ||
WORKDIR application | ||
COPY --from=builder application/dependencies/ ./ | ||
COPY --from=builder application/spring-boot-loader/ ./ | ||
COPY --from=builder application/snapshot-dependencies/ ./ | ||
COPY --from=builder application/application/ ./ | ||
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pipeline { | ||
agent any | ||
|
||
triggers { | ||
pollSCM('* * * * *') | ||
} | ||
|
||
environment { | ||
APPLICATION_NAME = 'boot-data-keyset-pagination' | ||
} | ||
|
||
stages { | ||
stage('Build') { | ||
steps { | ||
sh './mvnw clean verify' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# boot-data-keyset-pagination | ||
|
||
### Format code | ||
|
||
```shell | ||
$ ./mvnw spotless:apply | ||
``` | ||
|
||
### Run tests | ||
|
||
```shell | ||
$ ./mvnw clean verify | ||
``` | ||
|
||
### Run locally | ||
|
||
```shell | ||
$ docker-compose -f docker/docker-compose.yml up -d | ||
$ ./mvnw spring-boot:run -Dspring-boot.run.profiles=local | ||
``` | ||
|
||
### Using Testcontainers at Development Time | ||
You can run `TestApplication.java` from your IDE directly. | ||
You can also run the application using Maven as follows: | ||
|
||
```shell | ||
./mvnw spring-boot:test-run | ||
``` | ||
|
||
|
||
### Useful Links | ||
* Swagger UI: http://localhost:8080/swagger-ui.html | ||
* Actuator Endpoint: http://localhost:8080/actuator |
17 changes: 17 additions & 0 deletions
17
jpa/boot-data-keyset-pagination/docker/docker-compose-app.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3.8' | ||
services: | ||
|
||
boot-data-keyset-pagination: | ||
build: .. | ||
ports: | ||
- "18080:8080" | ||
- "18787:8787" | ||
restart: always | ||
depends_on: | ||
- postgresqldb | ||
environment: | ||
- SPRING_PROFILES_ACTIVE=docker | ||
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver | ||
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgresqldb:5432/appdb | ||
- SPRING_DATASOURCE_USERNAME=appuser | ||
- SPRING_DATASOURCE_PASSWORD=secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: '3.8' | ||
services: | ||
|
||
postgresqldb: | ||
image: postgres:16.0-alpine | ||
environment: | ||
- POSTGRES_USER=appuser | ||
- POSTGRES_PASSWORD=secret | ||
- POSTGRES_DB=appdb | ||
ports: | ||
- "5432:5432" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lombok.addLombokGeneratedAnnotation = true |
Oops, something went wrong.