chore: 落地 Gitea Actions CI 门禁
This commit is contained in:
1 parent
ec6b0dee3e
commit
82381a5e93
2 files changed
+114
-8
No files matched your search
+84
-8
@@ -9,15 +9,91 @@ concurrency:
|
|||||||
group: ci-${{ github.ref }}
|
group: ci-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_VERSION: "24"
|
||||||
|
PNPM_VERSION: "9.15.0"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
smoke:
|
static:
|
||||||
name: Runner smoke
|
name: Static checks
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 40
|
||||||
steps:
|
steps:
|
||||||
- name: Check runner environment
|
- uses: actions/checkout@v4
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: ${{ env.PNPM_VERSION }}
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: pnpm
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
- run: pnpm check
|
||||||
|
- run: pnpm test:api-routes
|
||||||
|
- 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
|
||||||
|
timeout-minutes: 60
|
||||||
|
needs: [static]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: ${{ env.PNPM_VERSION }}
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: pnpm
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
- run: pnpm build
|
||||||
|
- run: pnpm build:admin:preview
|
||||||
|
- run: pnpm validate:template-release
|
||||||
|
|
||||||
|
api:
|
||||||
|
name: API integration
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 45
|
||||||
|
needs: [static]
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: personal_brand
|
||||||
|
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@postgres: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: ${{ env.PNPM_VERSION }}
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: pnpm
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
- name: Prepare API test env
|
||||||
|
working-directory: apps/api
|
||||||
run: |
|
run: |
|
||||||
uname -a
|
cat > .env <<EOF
|
||||||
node -v
|
DATABASE_URL=$DATABASE_URL
|
||||||
git --version
|
DEFAULT_BRAND_ID=$DEFAULT_BRAND_ID
|
||||||
pwd
|
SESSION_SECRET=$SESSION_SECRET
|
||||||
|
SEED_ADMIN_PASSWORD=$SEED_ADMIN_PASSWORD
|
||||||
|
EOF
|
||||||
|
- run: pnpm --filter @personal-brand/api test:integration
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
# CI(Gitea Actions)
|
||||||
|
|
||||||
|
远端仓库是 Gitea,CI 由 `.gitea/workflows/ci.yml` 定义,运行在 `oracle_arm` 主机上的 self-hosted runner。
|
||||||
|
|
||||||
|
## Runner
|
||||||
|
|
||||||
|
- 程序:`gitea-runner` v5.2.0(linux/arm64),位于 `/home/ubuntu/gitea-runner`
|
||||||
|
- 服务:systemd user unit `gitea-runner.service`
|
||||||
|
- 标签:`ubuntu-latest`、`oracle-arm`
|
||||||
|
- 执行模式:Docker,单并发,任务容器限制 `--cpus=1.5 --memory=4g`
|
||||||
|
- 作用域:仅 `que01/persionalBrand` 仓库
|
||||||
|
|
||||||
|
查看状态:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh oracle_arm 'systemctl --user status gitea-runner.service'
|
||||||
|
ssh oracle_arm 'journalctl --user -u gitea-runner -n 100 --no-pager'
|
||||||
|
```
|
||||||
|
|
||||||
|
## 当前门禁
|
||||||
|
|
||||||
|
- `static`:格式、lint、typecheck、模板检查、路由与模板 preview 覆盖
|
||||||
|
- `build`:生产构建、Admin preview 构建、模板 release 校验
|
||||||
|
- `api`:PostgreSQL service container 上的 API integration
|
||||||
|
|
||||||
|
浏览器回归仍作为发布前本地门禁执行,避免在 2 核生产主机上运行 Playwright 抢占资源。
|
||||||
|
|
||||||
|
## 注意
|
||||||
|
|
||||||
|
Runner 与生产 API 共用 `oracle_arm` 主机。任务容器已限制 CPU 与内存;如果 CI 期间生产延迟明显,应暂停 runner 或迁移到独立主机。
|
||||||
Reference in new issue
Block a user