Skip to content

Commit 198403d

Browse files
Github Actions
1 parent e8bcb5b commit 198403d

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

.github/workflows/action.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Build and E2E Checks
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Verify tools
16+
run: |
17+
make --version
18+
docker --version
19+
docker compose version
20+
21+
- name: Copy environment file
22+
run: cp .env.example .env
23+
24+
- name: Create var directories
25+
run: make var
26+
27+
- name: Install Composer dependencies
28+
run: make composer
29+
30+
- name: Build and start services
31+
run: make start
32+
33+
- name: Wait for services to be ready
34+
run: |
35+
echo "Waiting for services to start..."
36+
sleep 30
37+
docker compose ps
38+
39+
- name: Run migrations
40+
run: docker compose exec -T php php bin/app.php migrate --force
41+
42+
- name: Refresh caches
43+
run: make refresh-caches
44+
45+
- name: Cleanup
46+
if: always()
47+
run: make down
48+
49+
test:
50+
runs-on: ubuntu-latest
51+
needs: build
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Copy environment file
56+
run: cp .env.example .env
57+
58+
- name: Create var directories
59+
run: make var
60+
61+
- name: Install Composer dependencies
62+
run: make composer
63+
64+
- name: Start services
65+
run: make start
66+
67+
- name: Wait for services to be ready
68+
run: |
69+
echo "Waiting for services to start..."
70+
sleep 30
71+
docker compose ps
72+
73+
- name: Run migrations
74+
run: docker compose exec -T php php bin/app.php migrate --force
75+
76+
- name: Refresh caches
77+
run: make refresh-caches
78+
79+
- name: Install curl and jq
80+
run: sudo apt-get update && sudo apt-get install -y curl jq
81+
82+
- name: Test API endpoints
83+
run: |
84+
echo "Testing API endpoints..."
85+
86+
# Test health endpoint
87+
curl -f http://localhost/health && echo "✓ Health endpoint works"
88+
89+
# Test create user
90+
curl -s -X POST http://localhost/users \
91+
-H "Content-Type: application/json" \
92+
&& echo "✓ Create event works"
93+
94+
# Test create event
95+
curl -s -X POST http://localhost/events \
96+
-H "Content-Type: application/json" \
97+
-d "{\"user_id\":1,\"event_type\":\"click\",\"timestamp\":\"2025-06-10T12:00:00Z\",\"metadata\":{\"page\":\"/test\"}}" \
98+
&& echo "✓ Create event works"
99+
100+
# Test get events
101+
curl -f "http://localhost/events?page=1&limit=10" && echo "✓ Get events works"
102+
103+
# Test get user events
104+
curl -f "http://localhost/users/events?user_id=$USER_ID&limit=10" && echo "✓ Get user events works"
105+
106+
# Test get total events
107+
curl -f "http://localhost/events/total" && echo "✓ Get total events count works"
108+
109+
- name: Cleanup
110+
if: always()
111+
run: make down

0 commit comments

Comments
 (0)