|
| 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