Skip to content

Commit 868b1b4

Browse files
committed
Prepare samples repo for connector sync
Java pgjdbc changes: - Rename package from org.example to software.amazon.dsql.examples - Switch from Maven to Gradle build system (matching connector) - Add gradle wrapper for standalone builds - Update workflow to use Gradle Python asyncpg changes: - Add new python/asyncpg folder with examples from connector - Add integration test workflow for asyncpg This aligns the samples repo structure with the connector repos to enable automated syncing of examples.
1 parent 02dc4d3 commit 868b1b4

26 files changed

Lines changed: 831 additions & 119 deletions

.github/workflows/java-pgjdbc-integ-tests.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
java-version: '17'
4141
distribution: 'corretto'
4242
architecture: x64
43-
cache: maven
43+
cache: gradle
4444

4545
- name: Configure AWS Credentials
4646
uses: aws-actions/configure-aws-credentials@v4
@@ -54,8 +54,4 @@ jobs:
5454
CLUSTER_ENDPOINT: ${{ secrets.JAVA_PGJDBC_CLUSTER_ENDPOINT }}
5555
CLUSTER_USER: admin
5656
REGION: ${{ secrets.JAVA_PGJDBC_CLUSTER_REGION }}
57-
run: |
58-
mvn validate
59-
mvn initialize
60-
mvn compile
61-
mvn test
57+
run: ./gradlew test
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Python asyncpg integration tests
2+
3+
permissions: {}
4+
5+
on:
6+
push:
7+
branches: [ main ]
8+
paths:
9+
- 'python/asyncpg/**'
10+
- '.github/workflows/python-asyncpg-integ-tests.yml'
11+
pull_request:
12+
branches: [ main ]
13+
paths:
14+
- 'python/asyncpg/**'
15+
- '.github/workflows/python-asyncpg-integ-tests.yml'
16+
# Give us a button to allow running the workflow on demand for testing.
17+
workflow_dispatch:
18+
inputs:
19+
tags:
20+
description: 'Manual Workflow Run'
21+
required: false
22+
type: string
23+
24+
jobs:
25+
python-asyncpg-integ-test:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
id-token: write # required by aws-actions/configure-aws-credentials
29+
concurrency:
30+
# Ensure only 1 job uses the workflow cluster at a time.
31+
group: ${{ github.workflow }}
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.10'
41+
42+
- name: Cache pip packages
43+
uses: actions/cache@v4
44+
with:
45+
path: ~/.cache/pip
46+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
47+
restore-keys: |
48+
${{ runner.os }}-pip-
49+
50+
- name: Configure AWS Credentials
51+
uses: aws-actions/configure-aws-credentials@v4
52+
with:
53+
role-to-assume: ${{ secrets.PYTHON_IAM_ROLE }}
54+
aws-region: us-east-1
55+
56+
- name: Configure and run integration for asyncpg - admin
57+
working-directory: ./python/asyncpg
58+
env:
59+
CLUSTER_USER: "admin"
60+
CLUSTER_ENDPOINT: ${{ secrets.PYTHON_ASYNCPG_CLUSTER_ENDPOINT }}
61+
REGION: ${{ secrets.PYTHON_ASYNCPG_CLUSTER_REGION }}
62+
run: |
63+
python3 -m venv .venv
64+
source .venv/bin/activate
65+
pip install --upgrade pip
66+
pip install --force-reinstall -r requirements.txt
67+
python3 -c "import boto3; print(boto3.__version__)"
68+
pip list
69+
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
70+
wget https://www.amazontrust.com/repository/AmazonRootCA1.pem -O root.pem
71+
pytest

java/pgjdbc/build.gradle.kts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
14
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
25

36
plugins {
@@ -6,18 +9,22 @@ plugins {
69
}
710

811
application {
9-
mainClass = "org.example.Example"
12+
mainClass = "software.amazon.dsql.examples.ExamplePreferred"
1013
}
1114

12-
group = "org.example"
15+
group = "software.amazon.dsql.examples"
1316
version = "1.0-SNAPSHOT"
1417

1518
repositories {
1619
mavenCentral()
1720
}
1821

1922
dependencies {
23+
implementation("com.zaxxer:HikariCP:5.1.0")
2024
implementation("software.amazon.dsql:aurora-dsql-jdbc-connector:1.2.0")
25+
// AWS SDK dependencies for SDK-only example (ExampleWithNoConnector)
26+
implementation("software.amazon.awssdk:dsql:2.31.32")
27+
implementation("org.postgresql:postgresql:42.7.7")
2128

2229
testImplementation(platform("org.junit:junit-bom:5.10.0"))
2330
testImplementation("org.junit.jupiter:junit-jupiter")
@@ -41,4 +48,4 @@ tasks.withType<Test> {
4148

4249
tasks.withType<JavaExec> {
4350
this.enableAssertions = true
44-
}
51+
}
44.4 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

java/pgjdbc/gradlew

Lines changed: 248 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)