This commit is contained in:
1 parent
060bad2df0
commit
ec6b0dee3e
2 files changed
+23
-198
No files matched your search
@@ -0,0 +1,23 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
smoke:
|
||||
name: Runner smoke
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Check runner environment
|
||||
run: |
|
||||
uname -a
|
||||
node -v
|
||||
git --version
|
||||
pwd
|
||||
@@ -1,198 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
static:
|
||||
name: Static checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.15.0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm check
|
||||
- run: pnpm test:api-routes
|
||||
- run: pnpm audit --prod --registry=https://registry.npmjs.org
|
||||
- run: pnpm validate:templates
|
||||
- run: pnpm template:compatibility
|
||||
- run: pnpm --filter @personal-brand/api exec tsx --test test/template-preview-matrix.test.ts
|
||||
- run: pnpm template:conformance
|
||||
- run: pnpm template:doctor
|
||||
|
||||
build:
|
||||
name: Production build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [static]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.15.0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm build
|
||||
- run: pnpm build:admin:preview
|
||||
- run: pnpm validate:template-release
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: admin-dist
|
||||
path: apps/admin/dist
|
||||
retention-days: 7
|
||||
|
||||
api:
|
||||
name: API integration
|
||||
runs-on: ubuntu-latest
|
||||
needs: [static]
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: personal_brand
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U postgres -d personal_brand"
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 12
|
||||
env:
|
||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/personal_brand
|
||||
DEFAULT_BRAND_ID: 00000000-0000-0000-0000-000000000001
|
||||
SESSION_SECRET: ci-integration-session-secret-0123456789abcdef
|
||||
SEED_ADMIN_PASSWORD: ci-integration-admin-password
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.15.0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- name: Prepare API test env
|
||||
working-directory: apps/api
|
||||
run: |
|
||||
cat > .env <<EOF
|
||||
DATABASE_URL=$DATABASE_URL
|
||||
DEFAULT_BRAND_ID=$DEFAULT_BRAND_ID
|
||||
SESSION_SECRET=$SESSION_SECRET
|
||||
SEED_ADMIN_PASSWORD=$SEED_ADMIN_PASSWORD
|
||||
EOF
|
||||
- run: pnpm --filter @personal-brand/api test:integration
|
||||
|
||||
taro:
|
||||
name: Taro builds
|
||||
runs-on: ubuntu-latest
|
||||
needs: [static]
|
||||
strategy:
|
||||
matrix:
|
||||
template: [acheng-campus-food, atelier-solopreneur, linjing-editorial]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.15.0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: TEMPLATE_KEY=acheng-campus-food pnpm --filter @personal-brand/taro build:h5
|
||||
env:
|
||||
TEMPLATE_KEY: ${{ matrix.template }}
|
||||
- run: TEMPLATE_KEY=acheng-campus-food pnpm --filter @personal-brand/taro build:weapp
|
||||
env:
|
||||
TEMPLATE_KEY: ${{ matrix.template }}
|
||||
|
||||
browser:
|
||||
name: Browser regression
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build, taro]
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: personal_brand
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U postgres -d personal_brand"
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 12
|
||||
env:
|
||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/personal_brand
|
||||
DEFAULT_BRAND_ID: 00000000-0000-0000-0000-000000000001
|
||||
SESSION_SECRET: ci-integration-session-secret-0123456789abcdef
|
||||
SEED_ADMIN_PASSWORD: ci-integration-admin-password
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9.15.0
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm --filter @personal-brand/taro exec playwright install --with-deps chromium
|
||||
- name: Prepare API test env
|
||||
working-directory: apps/api
|
||||
run: |
|
||||
cat > .env <<EOF
|
||||
DATABASE_URL=$DATABASE_URL
|
||||
DEFAULT_BRAND_ID=$DEFAULT_BRAND_ID
|
||||
SESSION_SECRET=$SESSION_SECRET
|
||||
SEED_ADMIN_PASSWORD=$SEED_ADMIN_PASSWORD
|
||||
EOF
|
||||
- run: pnpm --filter @personal-brand/api db:migrate:deploy
|
||||
- run: pnpm --filter @personal-brand/api db:seed
|
||||
- run: pnpm --filter @personal-brand/api test:integration
|
||||
- name: Start API
|
||||
run: pnpm --filter @personal-brand/api start > /tmp/api.log 2>&1 &
|
||||
env:
|
||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/personal_brand
|
||||
DEFAULT_BRAND_ID: 00000000-0000-0000-0000-000000000001
|
||||
SESSION_SECRET: browser-ci-session-secret-0123456789abcdef
|
||||
NODE_ENV: development
|
||||
- name: Start mini program preview
|
||||
run: pnpm --filter @personal-brand/taro dev:h5 > /tmp/taro.log 2>&1 &
|
||||
env:
|
||||
API_BASE_URL: http://localhost:3001
|
||||
BRAND_SLUG: default-brand
|
||||
TEMPLATE_KEY: acheng-campus-food
|
||||
- name: Start admin
|
||||
run: pnpm --filter @personal-brand/admin dev > /tmp/admin.log 2>&1 &
|
||||
env:
|
||||
VITE_API_BASE_URL: /api
|
||||
VITE_DEV_API_TARGET: http://localhost:3001
|
||||
VITE_TEMPLATE_PREVIEW_URL: http://localhost:3002
|
||||
- name: Wait for services
|
||||
run: |
|
||||
curl --retry 30 --retry-delay 1 --retry-connrefused -fsS http://localhost:3001/health
|
||||
curl --retry 30 --retry-delay 1 --retry-connrefused -fsS http://localhost:3002
|
||||
curl --retry 30 --retry-delay 1 --retry-connrefused -fsS http://localhost:3000
|
||||
- run: pnpm --filter @personal-brand/taro exec playwright test --config=playwright.config.ts --reporter=line
|
||||
env:
|
||||
ADMIN_URL: http://localhost:3000
|
||||
Reference in new issue
Block a user