Skip to content

refactor(ui): 移除未使用的日历、轮播和OTP输入组件及相关依赖 #35

refactor(ui): 移除未使用的日历、轮播和OTP输入组件及相关依赖

refactor(ui): 移除未使用的日历、轮播和OTP输入组件及相关依赖 #35

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '22.x'
PNPM_VERSION: '9'
jobs:
setup:
name: Setup Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
lint:
name: Lint (${{ matrix.package }})
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: [backend, console, management]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run lint
run: pnpm --filter ${{ matrix.package }} lint
type-check:
name: Type Check (${{ matrix.package }})
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: [backend, console, management]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate Prisma client (backend only)
if: matrix.package == 'backend'
run: pnpm --filter backend prisma:generate
- name: Run type-check
run: pnpm --filter ${{ matrix.package }} type-check
test:
name: Test (${{ matrix.package }})
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: [backend, console, management]
services:
mysql:
image: mysql:9.1
env:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: ulticode_test
MYSQL_USER: ulticode
MYSQL_PASSWORD: ulticode
ports:
- 23306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -u root -p$$MYSQL_ROOT_PASSWORD"
--health-interval=10s
--health-timeout=5s
--health-retries=10
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
DATABASE_URL: mysql://ulticode:ulticode@localhost:23306/ulticode_test
JWT_SECRET: test-jwt-secret-key-for-ci-minimum-32-characters
REDIS_HOST: localhost
REDIS_PORT: 6379
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate Prisma client (backend only)
if: matrix.package == 'backend'
run: pnpm --filter backend prisma:generate
- name: Run database migrations (backend only)
if: matrix.package == 'backend'
run: pnpm --filter backend prisma:migrate
env:
DATABASE_URL: mysql://ulticode:ulticode@localhost:23306/ulticode_test
- name: Run tests
run: pnpm --filter ${{ matrix.package }} test
build:
name: Build (${{ matrix.package }})
needs: [lint, type-check, test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: [backend, console, management]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate Prisma client (backend only)
if: matrix.package == 'backend'
run: pnpm --filter backend prisma:generate
- name: Build
run: pnpm --filter ${{ matrix.package }} build
docker:
name: Build & Push Docker Image (${{ matrix.package }})
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
package: [backend, console, management]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/ulticode-${{ matrix.package }}
tags: |
type=sha,prefix=
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.package }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max