Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.
Merged
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
70 changes: 0 additions & 70 deletions .github/workflows/baguni.api.automation.test.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1 @@
name: Baguni Automation Api-Test CI/CD

on:
schedule:
# 매 1시간마다 (UTC 기준, 0분에 실행)
- cron: '0 */1 * * *'
workflow_dispatch: # 수동으로 workflow 실행 시 필요

jobs:
deploy:
runs-on: ubuntu-latest
env:
api-endpoint: https://api.staging.minlife.me

steps:
# 저장소 Checkout
- name: Checkout source code
uses: actions/checkout@v4

# 서버가 완전히 기동될 때까지 대기하는 단계 (항상 서버가 떠있어야 테스트 가능)
- name: Wait for API Server to be Ready
run: |
echo "🔍 Checking API server status..."
attempt=0
max_attempts=10

while true; do
http_status=$(curl -o /dev/null -s -w "%{http_code}" ${{ env.api-endpoint }})

if [ "$http_status" -ne 502 ]; then
echo "✅ API Server responded Continuing..."
break
fi

attempt=$((attempt+1))
if [ $attempt -ge $max_attempts ]; then
echo "❌ API Server is still returning 502 after $max_attempts attempts. Exiting..."
exit 1
fi

echo "⏳ API Server still returning 502 (Bad Gateway), retrying in 5 seconds... (Attempt: $attempt)"
sleep 5
done

# Node 설치
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20

# Newman, InfluxDB reporter 설치
- name: Install newman and InfluxDB reporter
run: |
npm install -g newman
npm install -g git+https://github.com/sangwonsheep/newman-reporter-influxdb.git

# Newman API 테스트 실행 결과 InfluxDB에 적재
- name: Run Postman collection
run: |
newman run ${{ secrets.POSTMAN_COLLECTION_URL }} \
-r influxdb \
--reporter-influxdb-org ${{ secrets.INFLUXDB_ORG }} \
--reporter-influxdb-name ${{ secrets.INFLUXDB_BUCKET }} \
--reporter-influxdb-username ${{ secrets.INFLUXDB_USERNAME }} \
--reporter-influxdb-password ${{ secrets.INFLUXDB_PASSWORD }} \
--reporter-influxdb-token ${{ secrets.INFLUXDB_TOKEN }} \
--reporter-influxdb-version 2 \
--reporter-influxdb-measurement newman_metrics \
--reporter-influxdb-server influxdb.minlife.me \
--reporter-influxdb-mode https \
--reporter-influxdb-port 443