-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (108 loc) · 3.72 KB
/
pytest.yml
File metadata and controls
131 lines (108 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: PyTest
on:
# Run tests on PRs to verify code doesn't break before merge
pull_request:
types: [opened, synchronize]
branches: [main]
paths-ignore:
- "**.md"
- "**.sh"
- "**.xml"
- ".github/**"
- ".gitignore"
- "Dockerfile"
- "CODEOWNERS"
- "LICENSE"
# Run tests after merge and save coverage to Supabase as canonical source of truth
push:
branches: [main]
paths-ignore:
- "**.md"
- "**.sh"
- "**.xml"
- ".github/**"
- ".gitignore"
- "Dockerfile"
- "CODEOWNERS"
- "LICENSE"
# Allow manual trigger for debugging
workflow_dispatch:
# Cancel older runs when new commits are pushed to the same PR/branch
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
actions: write
checks: write
contents: read
issues: write
# metadata: read
pull-requests: write
statuses: write # commit statuses
# workflows: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync --frozen
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Check initial disk space
run: df -h
- name: Check memory usage
run: free -h
- name: Run pytest
env: # https://github.com/gitautoai/gitauto/settings/secrets/actions
# GitHub credentials https://github.com/settings/apps/gitauto-for-dev
GH_APP_ID: ${{ secrets.GH_APP_ID }}
GH_APP_NAME: ${{ secrets.GH_APP_NAME }}
GH_APP_USER_ID: ${{ secrets.GH_APP_USER_ID }}
GH_APP_USER_NAME: ${{ secrets.GH_APP_USER_NAME }}
GH_PRIVATE_KEY: ${{ secrets.GH_PRIVATE_KEY }}
GH_WEBHOOK_SECRET: ${{ secrets.GH_WEBHOOK_SECRET }}
# Anthropic credentials
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
# OpenAI credentials
OPENAI_API_KEY: ${{ secrets.STAGE_OPENAI_API_KEY }}
OPENAI_ORG_ID: ${{ secrets.STAGE_OPENAI_ORG_ID }}
# Resend credentials
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
# Sentry credentials
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
# Supabase credentials
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.STAGE_SUPABASE_SERVICE_ROLE_KEY }}
SUPABASE_URL: ${{ secrets.STAGE_SUPABASE_URL }}
# Stripe credentials
STRIPE_API_KEY: ${{ secrets.STAGE_STRIPE_API_KEY }}
# AWS credentials (SSM parameter validation in infrastructure tests)
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-west-1
# Environment variables
ENV: stage
PRODUCT_ID: ${{ secrets.STAGE_PRODUCT_ID }}
run: |
if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
uv run pytest --cov-branch --cov=./ --cov-report=lcov:coverage/lcov.info
else
uv run pytest
fi
- name: Check resources on failure
if: failure()
run: |
df -h
du -sh coverage/ .pytest_cache/ || true
- name: Upload coverage artifact
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/lcov.info