Skip to content

Commit eb4874b

Browse files
Restructure into self-contained per-project Lambdas
Split the repo into three self-contained projects (router, automator, moderator), each with its own src/, scripts/, tests/, pyproject.toml and uv.lock. Move automator's build files out of the repo root; consolidate tests per project so moderator's tests now run in CI. CI is now per-project with native path filters: test-{router,automator, moderator}.yml run only on their own changes, and deploy-{automator,router}.yml deploy after their tests pass on main. Moderator is parked (tests only, no deploy). Convert automator's un-mocked integration/test.py into mocked end-to-end reaction-routing tests (tests/test_reactions_e2e.py). Remove clutter (IMPLEMENTATION_SUMMARY, QUICK_REFERENCE, logs_output, setup_cicd_user, notebooks) and update docs.
1 parent fdd7167 commit eb4874b

53 files changed

Lines changed: 1096 additions & 1073 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1-
name: Deploy Lambda Function
1+
name: Deploy Automator
22

33
on:
44
workflow_run:
5-
workflows: ["Run Tests"]
5+
workflows: ["Test Automator"]
66
types:
77
- completed
88
workflow_dispatch:
99

10+
env:
11+
AWS_REGION: eu-west-1
12+
FUNCTION_NAME: automator-process-reaction
13+
1014
jobs:
1115
deploy:
1216
runs-on: ubuntu-latest
13-
# Only deploy when tests pass on main branch, or when manually triggered from main
17+
# Deploy only when Test Automator passed on main, or when manually run from main.
1418
if: (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
15-
19+
defaults:
20+
run:
21+
working-directory: automator
1622
steps:
1723
- name: Checkout code
1824
uses: actions/checkout@v4
19-
25+
2026
- name: Install uv
2127
uses: astral-sh/setup-uv@v3
2228
with:
@@ -27,17 +33,19 @@ jobs:
2733
with:
2834
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
2935
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
30-
aws-region: eu-west-1
31-
36+
aws-region: ${{ env.AWS_REGION }}
37+
3238
- name: Package Lambda function
33-
run: |
34-
bash package.sh
35-
39+
run: bash scripts/package.sh
40+
3641
- name: Deploy to AWS Lambda
37-
run: |
38-
bash deploy.sh
42+
run: bash scripts/deploy.sh
3943

4044
- name: Verify deployment
4145
run: |
42-
aws lambda get-function --function-name automator-process-reaction --region eu-west-1 --query 'Configuration.LastModified' --output text
43-
echo "✅ Lambda function updated successfully"
46+
aws lambda get-function \
47+
--function-name "$FUNCTION_NAME" \
48+
--region "$AWS_REGION" \
49+
--query 'Configuration.LastModified' \
50+
--output text
51+
echo "Automator Lambda function updated successfully"

.github/workflows/deploy-router.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: Deploy Router Lambda
1+
name: Deploy Router
22

33
on:
44
workflow_run:
5-
workflows: ["Run Tests"]
5+
workflows: ["Test Router"]
66
types:
77
- completed
88
workflow_dispatch:
@@ -14,8 +14,11 @@ env:
1414
jobs:
1515
deploy-router:
1616
runs-on: ubuntu-latest
17+
# Deploy only when Test Router passed on main, or when manually run from main.
1718
if: (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
18-
19+
defaults:
20+
run:
21+
working-directory: router
1922
steps:
2023
- name: Checkout code
2124
uses: actions/checkout@v4
@@ -28,12 +31,10 @@ jobs:
2831
aws-region: ${{ env.AWS_REGION }}
2932

3033
- name: Package router Lambda
31-
run: |
32-
bash router/package.sh
34+
run: bash scripts/package.sh
3335

3436
- name: Deploy router Lambda
35-
run: |
36-
bash router/deploy.sh
37+
run: bash scripts/deploy.sh
3738

3839
- name: Verify router deployment
3940
run: |
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test Automator
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'automator/**'
8+
- '.github/workflows/test-automator.yml'
9+
pull_request:
10+
branches: [ main ]
11+
paths:
12+
- 'automator/**'
13+
- '.github/workflows/test-automator.yml'
14+
workflow_dispatch:
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: automator
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v3
28+
with:
29+
python-version: '3.12'
30+
31+
- name: Install dependencies
32+
run: uv sync
33+
34+
- name: Run tests
35+
run: uv run python -m unittest discover tests -v
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test Moderator
2+
3+
# Moderator is parked (not deployed). Tests still run so it does not rot.
4+
on:
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- 'moderator/**'
9+
- '.github/workflows/test-moderator.yml'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- 'moderator/**'
14+
- '.github/workflows/test-moderator.yml'
15+
workflow_dispatch:
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
working-directory: moderator
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v3
29+
with:
30+
python-version: '3.12'
31+
32+
- name: Install dependencies
33+
run: uv sync
34+
35+
- name: Run tests
36+
run: uv run python -m unittest discover tests -v
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
1-
name: Run Tests
1+
name: Test Router
22

33
on:
44
push:
55
branches: [ main ]
6+
paths:
7+
- 'router/**'
8+
- '.github/workflows/test-router.yml'
69
pull_request:
710
branches: [ main ]
11+
paths:
12+
- 'router/**'
13+
- '.github/workflows/test-router.yml'
814
workflow_dispatch:
915

1016
jobs:
1117
test:
1218
runs-on: ubuntu-latest
13-
19+
defaults:
20+
run:
21+
working-directory: router
1422
steps:
1523
- name: Checkout code
1624
uses: actions/checkout@v4
17-
25+
1826
- name: Install uv
1927
uses: astral-sh/setup-uv@v3
2028
with:
2129
python-version: '3.12'
2230

2331
- name: Install dependencies
24-
run: |
25-
uv sync --all-extras
32+
run: uv sync
2633

2734
- name: Run tests
28-
run: |
29-
uv run python -m unittest discover tests -v
35+
run: uv run python -m unittest discover tests -v

IMPLEMENTATION_SUMMARY.md

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

Makefile

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

0 commit comments

Comments
 (0)