forked from baron/baron-sso
125 lines
3.4 KiB
YAML
125 lines
3.4 KiB
YAML
name: Code Check
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
run_lint:
|
|
description: "Run linters for Go and Flutter"
|
|
required: true
|
|
type: boolean
|
|
default: true
|
|
run_backend_tests:
|
|
description: "Run backend Go tests"
|
|
required: true
|
|
type: boolean
|
|
default: true
|
|
run_frontend_tests:
|
|
description: "Run frontend Flutter tests"
|
|
required: true
|
|
type: boolean
|
|
default: true
|
|
|
|
jobs:
|
|
lint:
|
|
if: ${{ inputs.run_lint == true }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# 리포지토리에서 소스 코드를 체크아웃합니다.
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Go 언어 환경을 설정합니다.
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
|
|
# Go 백엔드 코드의 정적 분석을 수행합니다.
|
|
- name: Lint Go backend
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: v1.59
|
|
working-directory: backend
|
|
|
|
# Flutter SDK 환경을 설정합니다.
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: 'stable'
|
|
|
|
# Flutter/Dart 프론트엔드 코드의 정적 분석을 수행합니다.
|
|
- name: Analyze Flutter frontend
|
|
run: |
|
|
cd frontend
|
|
flutter pub get
|
|
flutter analyze
|
|
|
|
backend-tests:
|
|
needs: lint
|
|
if: ${{ inputs.run_backend_tests == true }}
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
# 통합 테스트에 사용될 Redis 서비스 컨테이너입니다.
|
|
# 운영 환경과 일치하도록 포트를 6399로 설정합니다.
|
|
redis:
|
|
image: redis:7-alpine
|
|
command: redis-server --port 6399
|
|
options: >
|
|
--health-cmd "redis-cli -p 6399 ping" --health-interval 10s --health-timeout 5s --health-retries 5
|
|
ports:
|
|
- 6399:6399
|
|
# 통합 테스트에 사용될 ClickHouse 서비스 컨테이너입니다.
|
|
clickhouse:
|
|
image: clickhouse/clickhouse-server:24.6
|
|
ports:
|
|
- 9000:9000
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:8123/ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
env:
|
|
REDIS_ADDR: localhost:6399
|
|
CLICKHOUSE_HOST: localhost
|
|
CLICKHOUSE_PORT_NATIVE: 9000
|
|
|
|
steps:
|
|
# 리포지토리에서 소스 코드를 체크아웃합니다.
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Go 언어 환경을 설정합니다.
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
|
|
# 백엔드 디렉토리의 모든 Go 테스트를 실행합니다.
|
|
- name: Run backend tests
|
|
run: |
|
|
cd backend
|
|
go test -v ./...
|
|
|
|
frontend-tests:
|
|
needs: lint
|
|
if: ${{ inputs.run_frontend_tests == true }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# 리포지토리에서 소스 코드를 체크아웃합니다.
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Flutter SDK 환경을 설정합니다.
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: 'stable'
|
|
|
|
# 프론트엔드 디렉토리의 모든 위젯 테스트를 실행합니다.
|
|
- name: Run frontend tests
|
|
run: |
|
|
cd frontend
|
|
flutter pub get
|
|
flutter test
|