Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/api-integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: API Integration Tests (Simulation)

on:
push:
branches:
- "**"
pull_request:
branches:
- "**"

jobs:
api-integration-tests:
runs-on: ubuntu-latest
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self hosted runner를 사용하지 않는 이유가 있을까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 돌리는 서버는 실제 서버와 분리시키는 게 좋다고 생각했습니다
컴퓨팅 자원 많이 먹거나 하는 테스트가 아녀서 별도 ci서버 들이기 전까지는 저렇게 해도 무방하지 않을까 싶었습니다.

timeout-minutes: 15
env:
KWS_INTEGRATION_REQUIRED: "true"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Download dependencies
run: go mod download

- name: Run simulated API integration tests
run: |
set -euo pipefail
go test -json -count=1 ./api ./structure -run 'TestVM.*|TestControlContext_.*' | tee /tmp/test-report.jsonl

- name: Fail if any tests were skipped
run: |
set -euo pipefail
python - <<'PY'
import json
from pathlib import Path

p = Path("/tmp/test-report.jsonl")
skipped = []
passed = []

for line in p.read_text().splitlines():
line = line.strip()
if not line:
continue
try:
e = json.loads(line)
except json.JSONDecodeError:
continue
if e.get("Action") == "skip" and e.get("Test"):
skipped.append(e["Test"])
if e.get("Action") == "pass" and e.get("Test"):
passed.append(e["Test"])

if not passed:
raise SystemExit("No tests were executed. Failing workflow.")
if skipped:
raise SystemExit("Skipped tests detected: " + ", ".join(sorted(set(skipped))))

print(f"Executed {len(set(passed))} tests with no skips.")
PY
18 changes: 16 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,22 @@ jobs:

- name: Deploy container locally
run: |
IMAGE=${{ secrets.DOCKER_HUB_USERNAME }}/control_deploy:latest
IMAGE=${{ secrets.DOCKER_HUB_USERNAME }}/control_dev:latest
docker stop CONTROL_DEPLOY || true
docker rm CONTROL_DEPLOY || true
docker run -d --name CONTROL_DEPLOY -p 8081:8081 $IMAGE
docker run -d --name CONTROL_DEPLOY -p 8083:8081 --restart=always \
--add-host host.docker.internal:host-gateway \
-e CORES="${{ secrets.CORES }}" \
-e DB_USER="${{ secrets.DB_USER }}" \
-e DB_PASSWORD="${{ secrets.DB_PASSWORD }}" \
-e DB_HOST="${{ secrets.DB_HOST }}" \
-e DB_NAME="${{ secrets.DB_NAME }}" \
-e GUAC_DB_USER="${{ secrets.GUAC_DB_USER }}" \
-e GUAC_DB_PASSWORD="${{ secrets.GUAC_DB_PASSWORD }}" \
-e GUAC_DB_HOST="${{ secrets.GUAC_DB_HOST }}" \
-e GUAC_DB_NAME="${{ secrets.GUAC_DB_NAME }}" \
-e REDIS_HOST="${{ secrets.REDIS_HOST }}" \
-e CMS_HOST="${{ secrets.CMS_HOST }}" \
-e GUAC_BASE_URL="${{ secrets.GUAC_BASE_URL }}" \
$IMAGE
docker system prune -af
Loading
Loading