Skip to content

Commit 0e30701

Browse files
SilanHehsilan
andauthored
feat(sdk): monorepo repository to add new otel plugin package (#397)
Co-authored-by: hsilan <hsilan@amazon.com>
1 parent c9b6ea2 commit 0e30701

206 files changed

Lines changed: 1189 additions & 524 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.

.github/scripts/ci-checks.sh

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,62 @@
1-
21
#!/bin/sh
32

43
set -e
54

6-
hatch run test:cov
7-
echo SUCCESS: tests + coverage
5+
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
6+
cd "$REPO_ROOT"
7+
8+
# --- Core SDK checks ---
9+
echo "=========================================="
10+
echo "Running checks for aws-durable-execution-sdk-python"
11+
echo "=========================================="
12+
13+
hatch run dev-core:cov
14+
echo "SUCCESS: tests + coverage (core)"
15+
16+
hatch run dev-core:typecheck
17+
echo "SUCCESS: typings (core)"
18+
19+
# --- OTel SDK checks ---
20+
echo "=========================================="
21+
echo "Running checks for aws-durable-execution-sdk-python-otel"
22+
echo "=========================================="
23+
24+
hatch run dev-otel:cov
25+
echo "SUCCESS: tests + coverage (otel)"
26+
27+
hatch run dev-otel:typecheck
28+
echo "SUCCESS: typings (otel)"
29+
30+
# --- Examples checks ---
31+
echo "=========================================="
32+
echo "Running checks for examples"
33+
echo "=========================================="
34+
35+
hatch run dev-examples:test
36+
echo "SUCCESS: tests (examples)"
37+
38+
# --- Formatting / linting (per package) ---
39+
PACKAGES=(
40+
"packages/aws-durable-execution-sdk-python"
41+
"packages/aws-durable-execution-sdk-python-otel"
42+
"packages/aws-durable-execution-sdk-python-examples"
43+
)
844

9-
# type checks
10-
hatch run types:check
11-
echo SUCCESS: typings
45+
for package_dir in "${PACKAGES[@]}"; do
46+
full_path="$REPO_ROOT/$package_dir"
47+
if [ -d "$full_path" ]; then
48+
echo "=========================================="
49+
echo "Running formatting/linting for $package_dir"
50+
echo "=========================================="
51+
cd "$full_path"
52+
hatch fmt
53+
echo "SUCCESS: linting/fmt ($package_dir)"
54+
else
55+
echo "WARNING: $package_dir does not exist, skipping fmt"
56+
fi
57+
done
1258

13-
# static analysis
14-
hatch fmt
15-
echo SUCCESS: linting/fmt
59+
cd "$REPO_ROOT"
1660

17-
# commit message validation
61+
# --- Commit message validation ---
1862
hatch run python .github/scripts/lintcommit.py

.github/scripts/lintcommit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def lint_range(git_range: str, *, skip_dirty_check: bool = False) -> LintResult:
164164
status = subprocess.run(
165165
["git", "status", "--porcelain"],
166166
capture_output=True,
167-
text=True,
167+
text=True, check=False,
168168
)
169169
if status.stdout.strip():
170170
return LintResult(
@@ -178,7 +178,7 @@ def lint_range(git_range: str, *, skip_dirty_check: bool = False) -> LintResult:
178178
result = subprocess.run(
179179
["git", "log", "--no-merges", git_range, "-z", "--format=%H%n%B"],
180180
capture_output=True,
181-
text=True,
181+
text=True, check=False,
182182
)
183183
if result.returncode != 0:
184184
return LintResult(git_error=result.stderr.strip())

.github/scripts/tests/test_lintcommit.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
1111

1212
import pytest
13-
1413
from lintcommit import lint_range, validate_message, validate_subject
1514

16-
1715
# region validate_subject: valid subjects
1816

1917

.github/workflows/ci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,26 @@ jobs:
4343
run: |
4444
python -m pip install hatch==1.16.5
4545
- name: static analysis
46-
run: hatch fmt --check
46+
run: |
47+
for pkg in packages/*/; do
48+
if [ -f "$pkg/pyproject.toml" ]; then
49+
echo "=== Checking format: $pkg ==="
50+
cd "$pkg"
51+
hatch fmt --check
52+
cd "$GITHUB_WORKSPACE"
53+
fi
54+
done
4755
- name: type checking
4856
run: hatch run types:check
4957
- name: Run tests + coverage
5058
run: hatch run test:cov
5159
- name: Build distribution
52-
run: hatch build
60+
run: |
61+
for pkg in packages/*/; do
62+
if [ -f "$pkg/pyproject.toml" ]; then
63+
echo "=== Building: $pkg ==="
64+
cd "$pkg"
65+
hatch build
66+
cd "$GITHUB_WORKSPACE"
67+
fi
68+
done

.github/workflows/deploy-examples.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
pull_request:
55
branches: [ "main", "development"]
66
paths:
7-
- 'src/aws_durable_execution_sdk_python/**'
8-
- 'examples/**'
7+
- 'packages/aws-durable-execution-sdk-python/src/**'
8+
- 'packages/aws-durable-execution-sdk-python-examples/**'
99
- '.github/workflows/deploy-examples.yml'
1010
workflow_dispatch:
1111

@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Get examples from catalog
2828
id: get-examples
29-
working-directory: ./examples
29+
working-directory: ./packages/aws-durable-execution-sdk-python-examples
3030
run: |
3131
echo "examples=$(jq -c '.examples | map(select(.integration == true))' examples-catalog.json)" >> $GITHUB_OUTPUT
3232
@@ -58,10 +58,14 @@ jobs:
5858
- name: Install Hatch
5959
run: pip install hatch
6060
- name: Build examples
61-
run: hatch run examples:build
61+
working-directory: ./packages/aws-durable-execution-sdk-python-examples
62+
run: |
63+
hatch run -- examples:pip install -e ../aws-durable-execution-sdk-python
64+
hatch run examples:build
6265
6366
- name: Deploy Lambda function - ${{ matrix.example.name }}
6467
id: deploy
68+
working-directory: ./packages/aws-durable-execution-sdk-python-examples
6569
env:
6670
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
6771
LAMBDA_ENDPOINT: "https://lambda.us-west-2.amazonaws.com"
@@ -115,7 +119,7 @@ jobs:
115119
TEST_NAME="test_$(echo "${{ matrix.example.name }}" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')"
116120
echo "Test name: ${TEST_NAME}"
117121
118-
# Run integration tests
122+
# Run integration tests from repo root
119123
hatch run test:examples-integration
120124
121125
# Wait for function to be ready

.github/workflows/integration-tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2727
with:
2828
repository: aws/aws-durable-execution-sdk-python-testing
29-
path: testing-sdk
29+
path: language-sdk/packages/testing-sdk
3030

3131
- name: Set up Python ${{ matrix.python-version }}
3232
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
@@ -40,13 +40,13 @@ jobs:
4040
working-directory: language-sdk
4141
run: |
4242
echo "Running SDK tests..."
43-
hatch run -- test:pip install -e ../testing-sdk
44-
hatch run -- test:pip install -e ../language-sdk
45-
hatch fmt --check
43+
hatch run -- test:pip install -e packages/testing-sdk
4644
hatch run types:check
4745
hatch run test:cov
48-
hatch run test:examples
49-
hatch build
46+
47+
- name: Verify package build
48+
working-directory: language-sdk/packages/aws-durable-execution-sdk-python
49+
run: hatch build
5050

5151
e2e-tests:
5252
needs: integration-tests
@@ -65,7 +65,7 @@ jobs:
6565
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6666
with:
6767
repository: aws/aws-durable-execution-sdk-python-testing
68-
path: testing-sdk
68+
path: language-sdk/packages/testing-sdk
6969

7070
- name: Set up Python 3.13
7171
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
@@ -84,7 +84,7 @@ jobs:
8484

8585
- name: Get integration examples
8686
id: get-examples
87-
working-directory: language-sdk/examples
87+
working-directory: language-sdk/packages/aws-durable-execution-sdk-python-examples
8888
run: |
8989
echo "examples=$(jq -c '.examples | map(select(.integration == true)) | .[0:2]' examples-catalog.json)" >> $GITHUB_OUTPUT
9090
@@ -97,7 +97,7 @@ jobs:
9797
rm -rf /tmp/aws/
9898
9999
- name: Deploy and test examples
100-
working-directory: language-sdk
100+
working-directory: language-sdk/packages/aws-durable-execution-sdk-python-examples
101101
env:
102102
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
103103
LAMBDA_ENDPOINT: "https://lambda.us-west-2.amazonaws.com"

.github/workflows/pypi-publish.yml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will upload a Python Package to PyPI when a release is created
1+
# This workflow will upload Python Packages to PyPI when a release is created
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
33

44
# This workflow uses actions that are not certified by GitHub.
@@ -18,59 +18,67 @@ permissions:
1818
jobs:
1919
release-build:
2020
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
package:
25+
- name: aws-durable-execution-sdk-python
26+
path: packages/aws-durable-execution-sdk-python
27+
- name: aws-durable-execution-sdk-python-otel
28+
path: packages/aws-durable-execution-sdk-python-otel
2129

2230
steps:
2331
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24-
32+
with:
33+
ref: ${{ github.event.release.tag_name }}
2534
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2635
with:
2736
python-version: "3.11"
28-
- name: Install Hatch
29-
run: |
30-
python -m pip install --upgrade hatch==1.16.5
37+
38+
- name: Install Hatch
39+
run: python -m pip install --upgrade hatch==1.16.5
40+
3141
- name: Build release distributions
32-
run: |
33-
# NOTE: put your own distribution build steps here.
34-
hatch build
42+
working-directory: ${{ matrix.package.path }}
43+
run: hatch build
3544

3645
- name: Upload distributions
3746
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3847
with:
39-
name: release-dists
40-
path: dist/
48+
name: release-dists-${{ matrix.package.name }}
49+
path: ${{ matrix.package.path }}/dist/
4150

4251
pypi-publish:
4352
runs-on: ubuntu-latest
4453
needs:
4554
- release-build
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
package:
59+
- name: aws-durable-execution-sdk-python
60+
- name: aws-durable-execution-sdk-python-otel
4661
permissions:
47-
# IMPORTANT: this permission is mandatory for trusted publishing
4862
id-token: write
4963

50-
# Dedicated environments with protections for publishing are strongly recommended.
51-
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
5264
environment:
5365
name: pypi
54-
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
55-
# url: https://pypi.org/p/aws-durable-execution-sdk-python
56-
#
57-
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
58-
# ALTERNATIVE: exactly, uncomment the following line instead:
59-
url: https://pypi.org/project/aws-durable-execution-sdk-python/${{ github.event.release.name }}
66+
url: https://pypi.org/project/${{ matrix.package.name }}/${{ github.event.release.name }}
6067

6168
steps:
6269
- name: Retrieve release distributions
6370
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
6471
with:
65-
name: release-dists
72+
name: release-dists-${{ matrix.package.name }}
6673
path: dist/
6774

68-
- name: Publish release distributions to PyPI
75+
- name: Publish to PyPI
6976
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
7077
with:
7178
packages-dir: dist/
7279

7380
notify-release:
81+
if: always() && contains(needs.pypi-publish.result, 'success')
7482
needs: [pypi-publish]
7583
uses: ./.github/workflows/notify-release.yml
7684
with:

.github/workflows/sync-package.yml

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

0 commit comments

Comments
 (0)