Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/scripts/lintcommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def lint_range(git_range: str, *, skip_dirty_check: bool = False) -> LintResult:
status = subprocess.run(
["git", "status", "--porcelain"],
capture_output=True,
text=True,
text=True, check=False,
)
if status.stdout.strip():
return LintResult(
Expand All @@ -178,7 +178,7 @@ def lint_range(git_range: str, *, skip_dirty_check: bool = False) -> LintResult:
result = subprocess.run(
["git", "log", "--no-merges", git_range, "-z", "--format=%H%n%B"],
capture_output=True,
text=True,
text=True, check=False,
)
if result.returncode != 0:
return LintResult(git_error=result.stderr.strip())
Expand Down
2 changes: 0 additions & 2 deletions .github/scripts/tests/test_lintcommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))

import pytest

from lintcommit import lint_range, validate_message, validate_subject


# region validate_subject: valid subjects


Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/tests/test_parse_sdk_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test():
for input_text, expected in test_cases:
result = parse_sdk_branch(input_text)
# Assert is expected in test functions
assert result == expected, ( # noqa: S101
assert result == expected, (
f"Expected '{expected}' but got '{result}' for input: {input_text[:50]}..."
)

Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,26 @@ 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
- name: Run tests + coverage
run: hatch run test:cov
- 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
Comment thread
SilanHe marked this conversation as resolved.
cd "$GITHUB_WORKSPACE"
fi
done
14 changes: 9 additions & 5 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/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/examples
run: |
echo "examples=$(jq -c '.examples | map(select(.integration == true))' examples-catalog.json)" >> $GITHUB_OUTPUT

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

- name: Deploy Lambda function - ${{ matrix.example.name }}
id: deploy
working-directory: ./packages/examples
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
LAMBDA_ENDPOINT: "https://lambda.us-west-2.amazonaws.com"
Expand Down Expand Up @@ -115,7 +119,7 @@ jobs:
TEST_NAME="test_$(echo "${{ matrix.example.name }}" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')"
echo "Test name: ${TEST_NAME}"

# Run integration tests
# Run integration tests from repo root
hatch run test:examples-integration

# Wait for function to be ready
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ jobs:
run: |
echo "Running SDK tests..."
hatch run -- test:pip install -e ../testing-sdk
hatch run -- test:pip install -e ../language-sdk
hatch fmt --check
hatch run types:check
hatch run test:cov
hatch run test:examples
hatch build

- name: Verify package build
working-directory: language-sdk/packages/aws-durable-execution-sdk-python
run: hatch build

e2e-tests:
needs: integration-tests
Expand Down Expand Up @@ -84,7 +85,7 @@ jobs:

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

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

- name: Deploy and test examples
working-directory: language-sdk
working-directory: language-sdk/packages/examples
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
50 changes: 29 additions & 21 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,67 @@ 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

with:
ref: ${{ github.event.release.target_commitish }}
- 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.

4 changes: 2 additions & 2 deletions .github/workflows/update-sam-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Update SAM Template
on:
pull_request:
paths:
- "examples/**"
- "packages/examples/**"

permissions:
contents: write
Expand All @@ -27,7 +27,7 @@ jobs:
python-version: "3.13"

- name: Generate SAM template
run: python examples/scripts/generate_sam_template.py
run: python packages/examples/scripts/generate_sam_template.py

- name: Commit and push changes
run: |
Expand Down
Loading