Skip to content

Commit 6a11c44

Browse files
authored
Merge pull request #49 from iuriikogan/dev
dev
2 parents d56db24 + d9f771e commit 6a11c44

2 files changed

Lines changed: 102 additions & 0 deletions

File tree

.error.log.swp

-24 KB
Binary file not shown.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: 'Tests'
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [ "main" ]
7+
types: [closed]
8+
9+
jobs:
10+
unit-tests:
11+
if: github.event.pull_request.merged == true
12+
name: 'Unit Tests'
13+
runs-on: 'ubuntu-latest'
14+
steps:
15+
- name: 'Checkout'
16+
uses: actions/checkout@v4
17+
18+
- name: 'Set up Go'
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.25'
22+
cache: true
23+
24+
- name: 'Set up Node.js'
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
cache: 'npm'
29+
cache-dependency-path: 'web/package-lock.json'
30+
31+
- name: 'Install Web Dependencies'
32+
run: cd web && npm ci
33+
34+
- name: 'Run Go Unit Tests'
35+
run: make test-go
36+
37+
- name: 'Run Web Unit Tests'
38+
run: make test-web
39+
40+
integration-tests:
41+
if: github.event.pull_request.merged == true
42+
name: 'Integration Tests'
43+
runs-on: 'ubuntu-latest'
44+
steps:
45+
- name: 'Checkout'
46+
uses: actions/checkout@v4
47+
48+
- name: 'Set up Go'
49+
uses: actions/setup-go@v5
50+
with:
51+
go-version: '1.25'
52+
cache: true
53+
54+
- name: 'Run Go Integration Tests'
55+
run: go test -count=1 -tags=integration ./...
56+
57+
smoke-tests:
58+
if: github.event.pull_request.merged == true
59+
name: 'Smoke Tests'
60+
runs-on: 'ubuntu-latest'
61+
steps:
62+
- name: 'Checkout'
63+
uses: actions/checkout@v4
64+
65+
- name: 'Start Environment'
66+
env:
67+
PROJECT_ID: 'test-project'
68+
REGION: 'europe-west1'
69+
GEMINI_API_KEY: 'dummy-key'
70+
run: |
71+
# Use a mock credentials file for the test environment
72+
mkdir -p /home/runner/.config/gcloud
73+
echo '{"type": "service_account"}' > /home/runner/.config/gcloud/application_default_credentials.json
74+
make start
75+
76+
- name: 'Wait for Server to be listening'
77+
run: |
78+
echo "Waiting up to 2 minutes for the unified server on port 8080..."
79+
timeout 120 bash -c 'until curl -s http://localhost:8080/ > /dev/null; do echo "waiting..."; sleep 5; done'
80+
echo "Server connected successfully!"
81+
82+
- name: 'Check Server Health Endpoint'
83+
run: curl -f http://localhost:8080/health || curl -f http://localhost:8080/
84+
85+
- name: 'Check Worker Health'
86+
run: |
87+
echo "Checking worker service..."
88+
docker-compose exec -T worker curl -f http://localhost:8080/health
89+
90+
- name: 'Check Pub/Sub Topics & Subscriptions'
91+
run: |
92+
echo "Verifying Pub/Sub Emulator on port 8085..."
93+
# Wait up to 30 seconds for pubsub setup to complete
94+
timeout 30 bash -c 'until curl -s http://localhost:8085/v1/projects/test-project/topics | grep "scan-requests"; do sleep 2; done'
95+
96+
echo "Topics configured successfully. Checking subscriptions..."
97+
curl -s http://localhost:8085/v1/projects/test-project/subscriptions | grep "scan-requests-sub"
98+
echo "Pub/Sub resources confirmed!"
99+
100+
- name: 'Stop Environment'
101+
if: always()
102+
run: make stop

0 commit comments

Comments
 (0)