-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (169 loc) · 6.16 KB
/
e2e.yml
File metadata and controls
196 lines (169 loc) · 6.16 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: E2E Tests
on:
push:
branches: [main]
paths:
- 'drift/**'
- '.github/workflows/e2e.yml'
pull_request:
branches: [main]
paths:
- 'drift/**'
- '.github/workflows/e2e.yml'
workflow_dispatch: {}
jobs:
discover:
name: Discover Tests
runs-on: ubuntu-latest
outputs:
e2e_matrix: ${{ steps.set-matrix.outputs.e2e_matrix }}
stack_matrix: ${{ steps.set-matrix.outputs.stack_matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Find all test directories
id: set-matrix
run: |
# Find all e2e-tests directories (single instrumentation)
E2E_TESTS=$(find drift/instrumentation -type d -name "e2e-tests" \
| sed 's|drift/instrumentation/||' | sed 's|/e2e-tests||' | sort \
| jq -R -s -c 'split("\n") | map(select(length > 0))')
# Find all stack-tests directories (multi-instrumentation)
STACK_TESTS=$(find drift/stack-tests -mindepth 1 -maxdepth 1 -type d 2>/dev/null \
| xargs -I {} basename {} | sort \
| jq -R -s -c 'split("\n") | map(select(length > 0))') || echo "[]"
echo "Found e2e-tests: $E2E_TESTS"
echo "Found stack-tests: $STACK_TESTS"
echo "e2e_matrix=$E2E_TESTS" >> $GITHUB_OUTPUT
echo "stack_matrix=$STACK_TESTS" >> $GITHUB_OUTPUT
e2e:
name: E2E - ${{ matrix.library }}
needs: discover
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
max-parallel: 6
matrix:
library: ${{ fromJSON(needs.discover.outputs.e2e_matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Setup Python
run: uv python install 3.9
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Install SDK dependencies
run: uv sync --all-extras
- name: Build SDK
run: uv build
- name: Verify SDK build
run: |
ls -la dist/ || (echo "dist folder not found!" && exit 1)
test -f dist/*.whl || (echo "SDK build incomplete!" && exit 1)
- name: Get latest Tusk CLI version
id: tusk-version
run: |
VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/Use-Tusk/tusk-drift-cli/releases/latest" \
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Latest Tusk CLI version: $VERSION"
- name: Build base image
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
run: |
docker build \
--build-arg TUSK_CLI_VERSION=${{ steps.tusk-version.outputs.version }} \
-t python-e2e-base:latest \
-f drift/instrumentation/e2e_common/Dockerfile.base \
.
- name: Run E2E tests for ${{ matrix.library }}
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
TUSK_CLI_VERSION: ${{ steps.tusk-version.outputs.version }}
run: |
chmod +x ./drift/instrumentation/${{ matrix.library }}/e2e-tests/run.sh
cd ./drift/instrumentation/${{ matrix.library }}/e2e-tests && ./run.sh 8000
- name: Cleanup Docker resources
if: always()
run: |
# Stop all running containers
docker ps -aq | xargs -r docker stop || true
docker ps -aq | xargs -r docker rm || true
# Clean up volumes
docker volume prune -f || true
# Clean up networks
docker network prune -f || true
stack:
name: Stack - ${{ matrix.test }}
needs: discover
if: ${{ needs.discover.outputs.stack_matrix != '[]' && needs.discover.outputs.stack_matrix != '' }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
max-parallel: 3
matrix:
test: ${{ fromJSON(needs.discover.outputs.stack_matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Setup Python
run: uv python install 3.9
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Install SDK dependencies
run: uv sync --all-extras
- name: Build SDK
run: uv build
- name: Verify SDK build
run: |
ls -la dist/ || (echo "dist folder not found!" && exit 1)
test -f dist/*.whl || (echo "SDK build incomplete!" && exit 1)
- name: Get latest Tusk CLI version
id: tusk-version
run: |
VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/Use-Tusk/tusk-drift-cli/releases/latest" \
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Latest Tusk CLI version: $VERSION"
- name: Build base image
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
run: |
docker build \
--build-arg TUSK_CLI_VERSION=${{ steps.tusk-version.outputs.version }} \
-t python-e2e-base:latest \
-f drift/instrumentation/e2e_common/Dockerfile.base \
.
- name: Run stack tests for ${{ matrix.test }}
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
TUSK_CLI_VERSION: ${{ steps.tusk-version.outputs.version }}
run: |
chmod +x ./drift/stack-tests/${{ matrix.test }}/run.sh
cd ./drift/stack-tests/${{ matrix.test }} && ./run.sh 8000
- name: Cleanup Docker resources
if: always()
run: |
# Stop all running containers
docker ps -aq | xargs -r docker stop || true
docker ps -aq | xargs -r docker rm || true
# Clean up volumes
docker volume prune -f || true
# Clean up networks
docker network prune -f || true