Skip to content

Commit 59f2ab2

Browse files
ci: Split GitHub Actions into separate workflows (#7)
* docs: Remove Benefits of create-with-session section from README The create-with-session command and its 'new' alias are already in upstream/main, so the benefits section is no longer needed. * ci: Split GitHub Actions into three separate workflows - **lint.yml**: Run linter (ruff) and type checking (mypy) on every push and PR - **tests.yml**: Run basic tests that don't require email sending on every push and PR - **email-tests.yml**: Run tests that require Postmark email sending only on manual trigger Benefits: - Linting runs fast on every PR without waiting for long test runs - Basic API tests run on every PR without requiring Postmark secrets - Email sending tests only run when manually triggered by maintainer with secrets - Uses pytest markers ("flow") to separate tests by dependencies This fixes the issue where PRs from forks fail due to missing Postmark secrets. * fix: Remove mypy from lint workflow (not installed) mypy is not available in the project, so remove it from lint workflow. Ruff provides sufficient linting capabilities. * fix: Add @pytest.mark.flow to tests that require Postmark credentials - test_email_sender_initialization() creates PostmarkEmailSender without session - test_wait_for_email_async() sends test email using PostmarkEmailSender - test_wait_for_email_filtered_async() sends test emails using PostmarkEmailSender These tests now properly excluded from basic tests workflow via -m "not flow" --------- Co-authored-by: clawdbot-silly-waddle <clawdbot-silly-waddle@users.noreply.github.com>
1 parent 4099081 commit 59f2ab2

6 files changed

Lines changed: 89 additions & 40 deletions

File tree

.github/workflows/email-tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Email Tests (Requires Postmark Credentials)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v4
15+
16+
- name: Set up Python
17+
run: uv python install 3.12
18+
19+
- name: Install dependencies
20+
run: uv sync --group dev
21+
22+
- name: Check Postmark credentials
23+
env:
24+
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
25+
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
26+
run: |
27+
if [ -z "$POSTMARK_API_TOKEN" ]; then
28+
echo "Error: POSTMARK_API_TOKEN is not set in repository secrets"
29+
echo "This workflow requires Postmark credentials to run email tests"
30+
echo "Please add POSTMARK_API_TOKEN and SENDER_EMAIL to repository secrets"
31+
exit 1
32+
fi
33+
if [ -z "$SENDER_EMAIL" ]; then
34+
echo "Error: SENDER_EMAIL is not set in repository secrets"
35+
exit 1
36+
fi
37+
echo "Postmark credentials are properly configured"
38+
39+
- name: Run email sending tests
40+
env:
41+
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
42+
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
43+
run: uv run pytest tests/ -v -m "flow"
44+
45+
- name: Run async email sending tests
46+
env:
47+
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
48+
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
49+
run: uv run pytest tests/test_tacomail_async.py -v -m "flow"

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint and Type Check
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v4
18+
19+
- name: Set up Python
20+
run: uv python install 3.12
21+
22+
- name: Install dependencies
23+
run: uv sync --group dev
24+
25+
- name: Run linter
26+
run: uv run ruff check .

.github/workflows/tests.yml

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests
1+
name: Basic Tests
22

33
on:
44
push:
@@ -9,39 +9,21 @@ on:
99
jobs:
1010
test:
1111
runs-on: ubuntu-latest
12-
12+
1313
steps:
1414
- uses: actions/checkout@v4
15-
15+
1616
- name: Install uv
1717
uses: astral-sh/setup-uv@v4
18-
18+
1919
- name: Set up Python
2020
run: uv python install 3.12
21-
21+
2222
- name: Install dependencies
2323
run: uv sync --group dev
24-
25-
- name: Run linter
26-
run: uv run ruff check .
27-
28-
- name: Check Postmark credentials
29-
env:
30-
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
31-
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
32-
run: |
33-
if [ -z "$POSTMARK_API_TOKEN" ]; then
34-
echo "Error: POSTMARK_API_TOKEN is not set in repository secrets"
35-
exit 1
36-
fi
37-
if [ -z "$SENDER_EMAIL" ]; then
38-
echo "Error: SENDER_EMAIL is not set in repository secrets"
39-
exit 1
40-
fi
41-
echo "Postmark credentials are properly configured"
42-
43-
- name: Run tests
44-
env:
45-
POSTMARK_API_TOKEN: ${{ secrets.POSTMARK_API_TOKEN }}
46-
SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }}
47-
run: uv run pytest tests/ -v
24+
25+
- name: Run basic tests (no email sending required)
26+
run: uv run pytest tests/ -v -m "not flow"
27+
28+
- name: Run async basic tests
29+
run: uv run pytest tests/test_tacomail_async.py -v -m "not flow"

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,6 @@ To receive emails, you can use either approach:
170170
2.`tacomail create-session <email>` - Create session (REQUIRED)
171171
3.`tacomail wait <email>` - Monitor inbox for incoming emails
172172

173-
### Benefits of create-with-session
174-
175-
The `create-with-session` command (and its short alias `new`) provides several advantages:
176-
177-
- **⚡ Faster workflow**: One command instead of two
178-
- **🎯 Reduced errors**: No need to copy-paste email between commands
179-
- **📋 Complete information**: Shows both email and session details at once
180-
- **🔄 Works in both modes**: Supports both sync and async clients
181-
- **🎨 Better UX**: Clear next steps displayed after creation
182-
- **⚙️ Flexible options**: Still supports domain and username customization
183-
184173
### Common Workflows
185174

186175
**Workflow 1: Quick setup for testing**

tests/test_tacomail.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def test_fetch_empty_inbox(client: TacomailClient):
6666
assert len(emails) == 0
6767

6868

69+
@pytest.mark.flow
6970
def test_email_sender_initialization():
7071
sender = PostmarkEmailSender()
7172
assert sender.api_token is not None

tests/test_tacomail_async.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def test_delete_session_async(
4949
await client.delete_session(username, domain)
5050

5151

52+
@pytest.mark.flow
5253
@pytest.mark.asyncio
5354
async def test_wait_for_email_async(
5455
client_generator: AsyncGenerator[AsyncTacomailClient, None],
@@ -81,6 +82,7 @@ async def test_wait_for_email_async(
8182
assert received_email.body.text.strip() == test_body
8283

8384

85+
@pytest.mark.flow
8486
@pytest.mark.asyncio
8587
async def test_wait_for_email_filtered_async(
8688
client_generator: AsyncGenerator[AsyncTacomailClient, None],

0 commit comments

Comments
 (0)