forked from TracecatHQ/tracecat
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (136 loc) · 4.44 KB
/
test-python.yml
File metadata and controls
156 lines (136 loc) · 4.44 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Run Python tests
on:
push:
branches: ["main"]
paths:
- tracecat/**
- registry/**
- tests/**
- packages/tracecat-ee/**
- packages/tracecat-registry/**
- pyproject.toml
- uv.lock
- Dockerfile
- docker-compose.yml
- docker-compose.dev.yml
- docker-compose.local.yml
- .github/workflows/test-python.yml
pull_request:
branches: ["main", "staging"]
paths:
- tracecat/**
- registry/**
- tests/**
- packages/tracecat-ee/**
- packages/tracecat-registry/**
- pyproject.toml
- uv.lock
- Dockerfile
- docker-compose.yml
- docker-compose.dev.yml
- docker-compose.local.yml
- .github/workflows/test-python.yml
workflow_dispatch:
inputs:
git-ref:
description: "Git Ref (optional)"
required: false
default: ""
permissions:
contents: read
packages: write
env:
UV_SYSTEM_PYTHON: 1
jobs:
test-custom-registry-install:
runs-on: blacksmith-4vcpu-ubuntu-2204
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git-ref || github.ref }}
- name: Install uv
uses: useblacksmith/setup-uv@v4
with:
version: "0.9.7"
- name: Set up Python 3.12
uses: useblacksmith/setup-python@v6
with:
python-version: "3.12"
- name: Clone custom registry starter
run: |
git clone https://github.com/TracecatHQ/custom-integrations-starter-kit
cd custom-integrations-starter-kit
- name: Install dependencies
run: uv sync --frozen
test-all:
runs-on: blacksmith-4vcpu-ubuntu-2204
timeout-minutes: 60
strategy:
matrix:
test_group:
- unit
- registry
- temporal
# - ee # TODO: re-enable this when we have tests
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git-ref || github.ref }}
- name: Install uv
uses: useblacksmith/setup-uv@v4
with:
version: "0.9.7"
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Set up Python 3.12
uses: useblacksmith/setup-python@v6
with:
python-version: "3.12"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run environment setup script
run: |
echo "y
localhost
n
test@tracecat.com" | bash env.sh
- name: Start core Docker services
env:
COMPOSE_BAKE: "true"
TRACECAT__UNSAFE_DISABLE_SM_MASKING: "true"
run: docker compose -f docker-compose.dev.yml up -d temporal api postgres_db caddy minio
- name: Install dependencies
run: uv sync --frozen
- name: Run tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
TRACECAT__SYSTEM_PATH: "/usr/local/bin:/usr/bin:/bin"
TRACECAT__EXECUTOR_BACKEND: "direct"
TRACECAT__WORKFLOW_RETURN_STRATEGY: "context"
TRACECAT__UNSAFE_DISABLE_SM_MASKING: "true"
run: |
if [ "${{ matrix.test_group }}" = "ee" ]; then
uv run pytest packages/tracecat-ee/tests/ -ra
elif [ "${{ matrix.test_group }}" = "temporal" ]; then
# Temporal tests run with compression enabled and parallelization
# Worker-specific task queues in conftest.py enable safe parallel execution
TRACECAT__CONTEXT_COMPRESSION_ENABLED=true \
TRACECAT__CONTEXT_COMPRESSION_THRESHOLD_KB=0 \
uv run pytest tests/temporal -n auto -ra -o faulthandler_timeout=300
else
uv run pytest tests/${{ matrix.test_group }} -n auto -ra -o faulthandler_timeout=300
fi
- name: Show Docker logs on failure
if: failure()
run: |
echo "=== Docker Service Status ==="
docker compose -f docker-compose.dev.yml ps
echo "=== Temporal Logs ==="
docker compose -f docker-compose.dev.yml logs temporal --tail=200
echo "=== API Logs ==="
docker compose -f docker-compose.dev.yml logs api --tail=200
echo "=== Postgres Logs ==="
docker compose -f docker-compose.dev.yml logs postgres_db --tail=200