Skip to content

Commit 2caf3ff

Browse files
authored
Build and test demo apps from PR GH action (#374)
1 parent e95aa02 commit 2caf3ff

2 files changed

Lines changed: 108 additions & 1 deletion

File tree

.github/workflows/on_pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ on:
1313

1414
jobs:
1515
test:
16-
uses: ./.github/workflows/test.yml
16+
uses: ./.github/workflows/test.yml
17+
test-demo-apps:
18+
uses: ./.github/workflows/test_demo_apps.yml
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Test Demo Apps
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
version: ${{ steps.version.outputs.version }}
12+
steps:
13+
- name: Checkout java-transact
14+
uses: actions/checkout@v6
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v5
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
24+
- name: Setup Gradle
25+
uses: gradle/actions/setup-gradle@v5
26+
27+
- name: Remove local DBOS Maven artifacts
28+
run: rm -rf ~/.m2/repository/dev/dbos
29+
30+
- name: Publish to Maven Local
31+
run: ./gradlew publishToMavenLocal
32+
33+
- name: Get version
34+
id: version
35+
run: echo "version=$(./gradlew properties -q | grep '^version:' | awk '{print $2}')" >> $GITHUB_OUTPUT
36+
37+
- name: Upload Maven Local artifacts
38+
uses: actions/upload-artifact@v7
39+
with:
40+
name: dbos-maven-local
41+
path: ~/.m2/repository/dev/dbos
42+
43+
test-demo-apps:
44+
needs: publish
45+
runs-on: ubuntu-latest
46+
47+
env:
48+
PGPASSWORD: dbos
49+
PGUSER: postgres
50+
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
include:
55+
- app: java/dbos-starter
56+
build_file: app/build.gradle.kts
57+
- app: java/widget-store
58+
build_file: build.gradle.kts
59+
- app: kotlin/dbos-starter
60+
build_file: app/build.gradle.kts
61+
62+
services:
63+
postgres:
64+
image: postgres:16
65+
env:
66+
POSTGRES_PASSWORD: dbos
67+
POSTGRES_USER: postgres
68+
POSTGRES_DB: postgres
69+
ports:
70+
- 5432:5432
71+
options: >-
72+
--health-cmd pg_isready
73+
--health-interval 10s
74+
--health-timeout 5s
75+
--health-retries 5
76+
77+
steps:
78+
- name: Set up JDK 17
79+
uses: actions/setup-java@v5
80+
with:
81+
java-version: '17'
82+
distribution: 'temurin'
83+
84+
- name: Checkout dbos-demo-apps
85+
uses: actions/checkout@v6
86+
with:
87+
repository: dbos-inc/dbos-demo-apps
88+
path: dbos-demo-apps
89+
90+
- name: Download Maven Local artifacts
91+
uses: actions/download-artifact@v7
92+
with:
93+
name: dbos-maven-local
94+
path: ~/.m2/repository/dev/dbos
95+
96+
- name: Patch ${{ matrix.app }}
97+
working-directory: dbos-demo-apps/${{ matrix.app }}
98+
run: |
99+
VERSION="${{ needs.publish.outputs.version }}"
100+
sed -i "s|dev\.dbos:\([^:]*\):[^\"']*|dev.dbos:\1:${VERSION}|g" "${{ matrix.build_file }}"
101+
sed -i 's/repositories {/repositories { mavenLocal();/' "${{ matrix.build_file }}"
102+
103+
- name: Build and test ${{ matrix.app }}
104+
working-directory: dbos-demo-apps/${{ matrix.app }}
105+
run: ./gradlew build

0 commit comments

Comments
 (0)