Skip to content

Commit 93917a2

Browse files
authored
Merge pull request #34 from couchbase-examples/AV-68536-java-quickstart-using-spring-data
AV-68536: complete quickstart code for spring data
2 parents 7742bd3 + ee12529 commit 93917a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2260
-678
lines changed

.github/workflows/tests.yaml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,50 @@
11
name: Tests
2+
23
on:
34
push:
4-
workflow_dispatch:
5-
schedule:
6-
- cron: "0 0 * * 0"
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: "0 */6 * * *"
10+
711
jobs:
812
run_tests:
913
name: Run Tests
1014
runs-on: ubuntu-latest
15+
env:
16+
DB_CONN_STR: ${{ vars.DB_CONN_STR }}
17+
DB_USERNAME: ${{ vars.DB_USERNAME }}
18+
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
19+
strategy:
20+
matrix:
21+
java-version: ["17", "21"]
1122
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up JDK 17
14-
uses: actions/setup-java@v2
23+
- name: Update repositories
24+
run: |
25+
sudo apt update || echo "apt-update failed" # && apt -y upgrade
26+
27+
- name: Checkout ${{ github.event.repository.name }}
28+
uses: actions/checkout@v4
29+
30+
- name: Set up JDK ${{ matrix.java-version }}
31+
uses: actions/setup-java@v4
1532
with:
16-
java-version: 17
17-
distribution: 'adopt'
18-
cache: gradle
19-
- id: run
33+
java-version: ${{ matrix.java-version }}
34+
distribution: "adopt"
35+
cache: "gradle"
36+
37+
- name: Run Gradle Tests
38+
id: run
2039
run: |
21-
./gradlew --no-daemon test
40+
chmod +x gradlew
41+
./gradlew clean test --info --stacktrace
42+
2243
- name: Report Status
2344
if: always()
2445
uses: ravsamhq/notify-slack-action@v1
2546
with:
2647
status: ${{ job.status }}
27-
notify_when: 'failure'
48+
notify_when: "failure"
2849
env:
2950
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.gitignore

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1+
*.iml
2+
13
.gradle
2-
/build/
4+
build/
5+
target/
6+
out/
7+
.vscode/
8+
9+
# Default ignored files
10+
shelf/
11+
.idea/
12+
/workspace.xml
13+
.idea_modules/
14+
sonarlint/
315

416
# Ignore Gradle GUI config
517
gradle-app.setting

.gitpod.Dockerfile

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

.gitpod.yml

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

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Get latest java
2+
FROM eclipse-temurin:17-jdk-jammy AS build
3+
4+
# Set the working directory
5+
WORKDIR /app
6+
7+
# Copy the build.gradle and settings.gradle files
8+
COPY build.gradle .
9+
COPY settings.gradle .
10+
COPY gradlew .
11+
COPY gradle ./gradle
12+
13+
# Copy the src directory
14+
COPY src ./src
15+
16+
# Build the application without running the tests and with stacktrace
17+
RUN ./gradlew clean build -x test --stacktrace
18+
19+
# Expose port 8080
20+
EXPOSE 8080
21+
22+
# Run the application
23+
ENTRYPOINT ["java","-jar","/app/build/libs/java-springdata-quickstart-0.0.1-SNAPSHOT.jar"]
24+
25+
# Build the image
26+
# docker build -t java-springdata-quickstart .
27+
28+
# Run the container
29+
# docker run -d --name springdata-container -p 9440:8080 java-springdata-quickstart -e DB_CONN_STR=<connection_string> -e DB_USERNAME=<username> -e DB_PASSWORD=<password>

0 commit comments

Comments
 (0)