diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..0636dfc --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 9cf4cae..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -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 <- - --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 < /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