Skip to content

Commit 61b9823

Browse files
AMS Java Lib Major Version 4 (#10)
* provide samples for AMS Java client lib v4 * move v3 samples to legacy folder * add Github Action workflows --------- Co-authored-by: Daniel Kuntze <daniel.kuntze@sap.com>
1 parent 7622e81 commit 61b9823

277 files changed

Lines changed: 11403 additions & 168 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This workflow builds and tests the CAP Bookshop Java sample
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
name: CAP Bookshop sample
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "**" ]
11+
workflow_dispatch: # Allow manual triggering
12+
13+
jobs:
14+
detect-changes:
15+
name: Detect Changes
16+
runs-on: ubuntu-latest
17+
outputs:
18+
should_run: ${{ steps.changed.outputs.any_modified }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Detect changed files
25+
id: changed
26+
uses: tj-actions/changed-files@v46
27+
with:
28+
files: |
29+
ams-cap-bookshop/pom.xml
30+
ams-cap-bookshop/**/pom.xml
31+
ams-cap-bookshop/srv/**
32+
ams-cap-bookshop/db/**
33+
ams-cap-bookshop/app/**
34+
ams-cap-bookshop/package.json
35+
ams-cap-bookshop/package-lock.json
36+
.github/workflows/build_and_test_cap.yml
37+
38+
maven:
39+
name: Build and Test
40+
needs: detect-changes
41+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.should_run == 'true' }}
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- name: Set up JDK 17
47+
uses: actions/setup-java@v4
48+
with:
49+
java-version: '17'
50+
distribution: 'temurin'
51+
cache: 'maven'
52+
cache-dependency-path: ams-cap-bookshop/pom.xml
53+
54+
- name: Use Node.js 20.x
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: 20.x
58+
cache: 'npm'
59+
cache-dependency-path: ams-cap-bookshop/package-lock.json
60+
61+
- name: Install CDS dependencies
62+
run: npm ci
63+
working-directory: ams-cap-bookshop
64+
65+
- name: Build and Test
66+
run: mvn clean test
67+
working-directory: ams-cap-bookshop
68+
69+
# This job ensures the workflow passes when no relevant changes are detected
70+
# Required for PR status checks to pass when the sample hasn't changed
71+
no-changes:
72+
name: No Changes Detected
73+
needs: detect-changes
74+
if: ${{ needs.detect-changes.outputs.should_run != 'true' }}
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: No relevant changes detected
78+
run: echo "No relevant changes detected for ams-cap-bookshop. Skipping build and test."
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This workflow builds and tests the Javalin Shopping sample
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
name: Javalin Shopping sample
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "**" ]
11+
workflow_dispatch: # Allow manual triggering
12+
13+
jobs:
14+
detect-changes:
15+
name: Detect Changes
16+
runs-on: ubuntu-latest
17+
outputs:
18+
should_run: ${{ steps.changed.outputs.any_modified }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Detect changed files
25+
id: changed
26+
uses: tj-actions/changed-files@v46
27+
with:
28+
files: |
29+
ams-javalin-shopping/pom.xml
30+
ams-javalin-shopping/src/**
31+
.github/workflows/build_and_test_javalin.yml
32+
33+
maven:
34+
name: Build and Test
35+
needs: detect-changes
36+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.should_run == 'true' }}
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Set up JDK 17
42+
uses: actions/setup-java@v4
43+
with:
44+
java-version: '17'
45+
distribution: 'temurin'
46+
cache: 'maven'
47+
cache-dependency-path: ams-javalin-shopping/pom.xml
48+
49+
- name: Build and Test
50+
run: mvn clean test
51+
working-directory: ams-javalin-shopping
52+
53+
# This job ensures the workflow passes when no relevant changes are detected
54+
# Required for PR status checks to pass when the sample hasn't changed
55+
no-changes:
56+
name: No Changes Detected
57+
needs: detect-changes
58+
if: ${{ needs.detect-changes.outputs.should_run != 'true' }}
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: No relevant changes detected
62+
run: echo "No relevant changes detected for ams-javalin-shopping. Skipping build and test."
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# This workflow builds and tests the Spring Boot Shopping sample
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
name: Spring Boot Shopping sample
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "**" ]
11+
workflow_dispatch: # Allow manual triggering
12+
13+
jobs:
14+
detect-changes:
15+
name: Detect Changes
16+
runs-on: ubuntu-latest
17+
outputs:
18+
should_run: ${{ steps.changed.outputs.any_modified }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Detect changed files
25+
id: changed
26+
uses: tj-actions/changed-files@v46
27+
with:
28+
files: |
29+
ams-spring-boot-shopping/pom.xml
30+
ams-spring-boot-shopping/src/**
31+
.github/workflows/build_and_test_spring_boot.yml
32+
33+
maven:
34+
name: Build and Test${{ matrix.spring_boot_version && format(' (Spring Boot {0})', matrix.spring_boot_version) || '' }}
35+
needs: detect-changes
36+
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.should_run == 'true' }}
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
include:
41+
- spring_boot_version: ''
42+
- spring_boot_version: '4.0.2'
43+
fail-fast: false
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- name: Set up JDK 17
48+
uses: actions/setup-java@v4
49+
with:
50+
java-version: '17'
51+
distribution: 'temurin'
52+
cache: 'maven'
53+
cache-dependency-path: ams-spring-boot-shopping/pom.xml
54+
55+
- name: Patch Spring Boot version in pom.xml
56+
if: matrix.spring_boot_version
57+
run: |
58+
# Replace the parent version in pom.xml
59+
sed -i.bak 's|<version>3\.5\.10</version><!-- spring-boot-starter-parent -->|<version>${{ matrix.spring_boot_version }}</version><!-- spring-boot-starter-parent -->|' pom.xml
60+
# Also replace the spring.boot.version property
61+
sed -i.bak 's|<spring.boot.version>3\.5\.10</spring.boot.version>|<spring.boot.version>${{ matrix.spring_boot_version }}</spring.boot.version>|' pom.xml
62+
echo "Patched pom.xml for Spring Boot ${{ matrix.spring_boot_version }}"
63+
cat pom.xml | head -30
64+
working-directory: ams-spring-boot-shopping
65+
66+
- name: Build and Test
67+
run: mvn clean test
68+
working-directory: ams-spring-boot-shopping
69+
70+
# This job ensures the workflow passes when no relevant changes are detected
71+
# Required for PR status checks to pass when the sample hasn't changed
72+
no-changes:
73+
name: No Changes Detected
74+
needs: detect-changes
75+
if: ${{ needs.detect-changes.outputs.should_run != 'true' }}
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: No relevant changes detected
79+
run: echo "No relevant changes detected for ams-spring-boot-shopping. Skipping build and test."

.pipeline/maven-settings.xml

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

0 commit comments

Comments
 (0)