Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions .github/scripts/ci-checks.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@

#!/bin/sh

set -e

hatch run test:cov
echo SUCCESS: tests + coverage
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"

PACKAGES=(
"packages/aws-durable-execution-sdk-python"
"packages/aws-durable-execution-sdk-python-otel"
)

for package_dir in "${PACKAGES[@]}"; do
full_path="$REPO_ROOT/$package_dir"
if [ -d "$full_path" ]; then
echo "=========================================="
echo "Running checks for $package_dir"
echo "=========================================="
cd "$full_path"

hatch run test:cov
echo "SUCCESS: tests + coverage ($package_dir)"

# type checks
hatch run types:check
echo SUCCESS: typings
# type checks
hatch run types:check
echo "SUCCESS: typings ($package_dir)"

# static analysis
hatch fmt
echo SUCCESS: linting/fmt
# static analysis
hatch fmt
echo "SUCCESS: linting/fmt ($package_dir)"
else
echo "WARNING: $package_dir does not exist, skipping"
fi
done

# commit message validation
# commit message validation (run once from repo root)
cd "$REPO_ROOT"
hatch run python .github/scripts/lintcommit.py
40 changes: 36 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,42 @@ jobs:
run: |
python -m pip install hatch==1.16.5
- name: static analysis
run: hatch fmt --check
run: |
for pkg in packages/*/; do
if [ -f "$pkg/pyproject.toml" ]; then
echo "=== Checking format: $pkg ==="
cd "$pkg"
hatch fmt --check
cd "$GITHUB_WORKSPACE"
fi
done
- name: type checking
run: hatch run types:check
run: |
for pkg in packages/*/; do
if [ -f "$pkg/pyproject.toml" ]; then
echo "=== Type checking: $pkg ==="
cd "$pkg"
hatch run types:check
cd "$GITHUB_WORKSPACE"
fi
done
- name: Run tests + coverage
run: hatch run test:cov
run: |
for pkg in packages/*/; do
if [ -f "$pkg/pyproject.toml" ]; then
echo "=== Testing: $pkg ==="
cd "$pkg"
hatch run test:cov
cd "$GITHUB_WORKSPACE"
fi
done
- name: Build distribution
run: hatch build
run: |
for pkg in packages/*/; do
if [ -f "$pkg/pyproject.toml" ]; then
echo "=== Building: $pkg ==="
cd "$pkg"
hatch build
cd "$GITHUB_WORKSPACE"
fi
done
9 changes: 6 additions & 3 deletions .github/workflows/deploy-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
pull_request:
branches: [ "main", "development"]
paths:
- 'src/aws_durable_execution_sdk_python/**'
- 'examples/**'
- 'packages/aws-durable-execution-sdk-python/src/**'
- 'packages/aws-durable-execution-sdk-python/examples/**'
- '.github/workflows/deploy-examples.yml'
workflow_dispatch:

Expand All @@ -26,7 +26,7 @@ jobs:

- name: Get examples from catalog
id: get-examples
working-directory: ./examples
working-directory: ./packages/aws-durable-execution-sdk-python/examples
run: |
echo "examples=$(jq -c '.examples | map(select(.integration == true))' examples-catalog.json)" >> $GITHUB_OUTPUT

Expand Down Expand Up @@ -58,10 +58,12 @@ jobs:
- name: Install Hatch
run: pip install hatch
- name: Build examples
working-directory: ./packages/aws-durable-execution-sdk-python
run: hatch run examples:build

- name: Deploy Lambda function - ${{ matrix.example.name }}
id: deploy
working-directory: ./packages/aws-durable-execution-sdk-python
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
LAMBDA_ENDPOINT: "https://lambda.us-west-2.amazonaws.com"
Expand Down Expand Up @@ -99,6 +101,7 @@ jobs:
echo "QUALIFIED_FUNCTION_NAME=$QUALIFIED_FUNCTION_NAME" >> $GITHUB_OUTPUT

- name: Run Integration Tests - ${{ matrix.example.name }}
working-directory: ./packages/aws-durable-execution-sdk-python
env:
AWS_REGION: ${{ env.AWS_REGION }}
LAMBDA_ENDPOINT: "https://lambda.us-west-2.amazonaws.com"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:
run: python -m pip install hatch==1.16.5

- name: Setup and run tests
working-directory: language-sdk
working-directory: language-sdk/packages/aws-durable-execution-sdk-python
run: |
echo "Running SDK tests..."
hatch run -- test:pip install -e ../testing-sdk
hatch run -- test:pip install -e ../language-sdk
hatch run -- test:pip install -e ../../../testing-sdk
hatch run -- test:pip install -e .
hatch fmt --check
hatch run types:check
hatch run test:cov
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:

- name: Get integration examples
id: get-examples
working-directory: language-sdk/examples
working-directory: language-sdk/packages/aws-durable-execution-sdk-python/examples
run: |
echo "examples=$(jq -c '.examples | map(select(.integration == true)) | .[0:2]' examples-catalog.json)" >> $GITHUB_OUTPUT

Expand All @@ -97,15 +97,15 @@ jobs:
rm -rf /tmp/aws/

- name: Deploy and test examples
working-directory: language-sdk
working-directory: language-sdk/packages/aws-durable-execution-sdk-python
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
LAMBDA_ENDPOINT: "https://lambda.us-west-2.amazonaws.com"
INVOKE_ACCOUNT_ID: ${{ secrets.INVOKE_ACCOUNT_ID }}
KMS_KEY_ARN: ${{ secrets.KMS_KEY_ARN }}
run: |
echo "Building examples..."
hatch run -- examples:pip install -e ../testing-sdk
hatch run -- examples:pip install -e ../../../testing-sdk
hatch run examples:build

# Get first integration example for testing
Expand Down
47 changes: 27 additions & 20 deletions .github/workflows/pypi-publish.yml
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't actually tested this one but it looks quite reasonable. I had to work a little more closely with AI on this one.

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

# This workflow uses actions that are not certified by GitHub.
Expand All @@ -18,59 +18,66 @@ permissions:
jobs:
release-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- name: aws-durable-execution-sdk-python
path: packages/aws-durable-execution-sdk-python
- name: aws-durable-execution-sdk-python-otel
path: packages/aws-durable-execution-sdk-python-otel

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.11"
- name: Install Hatch
run: |
python -m pip install --upgrade hatch==1.16.5

- name: Install Hatch
run: python -m pip install --upgrade hatch==1.16.5

- name: Build release distributions
run: |
# NOTE: put your own distribution build steps here.
hatch build
working-directory: ${{ matrix.package.path }}
run: hatch build

- name: Upload distributions
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: release-dists
path: dist/
name: release-dists-${{ matrix.package.name }}
path: ${{ matrix.package.path }}/dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
strategy:
fail-fast: false
matrix:
package:
- name: aws-durable-execution-sdk-python
- name: aws-durable-execution-sdk-python-otel
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

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

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: release-dists
name: release-dists-${{ matrix.package.name }}
path: dist/

- name: Publish release distributions to PyPI
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
packages-dir: dist/

notify-release:
if: always() && contains(needs.pypi-publish.result, 'success')
needs: [pypi-publish]
uses: ./.github/workflows/notify-release.yml
with:
Expand Down
72 changes: 0 additions & 72 deletions .github/workflows/sync-package.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/update-sam-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
python-version: "3.13"

- name: Generate SAM template
run: python examples/scripts/generate_sam_template.py
run: python packages/aws-durable-execution-sdk-python/examples/scripts/generate_sam_template.py

- name: Commit and push changes
run: |
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/
*$py.class
*.egg-info/

*.coverage
/.coverage
/.coverage.*
/.cache
Expand All @@ -30,7 +31,7 @@ dist/

.kiro/

/examples/build/*
/examples/*.zip
examples/build/*
examples/*.zip

.env
Loading