Verify / verify (push) Failing after 2m44s
Gitea 对 actions/upload-artifact@v4 报 GHESNotSupportedError(v4 artifact 协议 为 GitHub 专有),此前测试全绿仍被该步骤标红;上传失败不再影响 CI 结论, 浏览器产物在 Gitea 上暂不可下载,迁到 GitHub 托管时该步骤自动生效
68 lines
2.6 KiB
YAML
68 lines
2.6 KiB
YAML
name: Verify
|
||
on: [push, pull_request]
|
||
permissions:
|
||
contents: read
|
||
jobs:
|
||
verify:
|
||
runs-on: ubuntu-latest
|
||
services:
|
||
postgres:
|
||
image: postgres:17
|
||
env:
|
||
POSTGRES_PASSWORD: ci-only-password
|
||
POSTGRES_DB: traceiq
|
||
ports: ['5432:5432']
|
||
options: >-
|
||
--health-cmd pg_isready --health-interval 5s
|
||
--health-timeout 5s --health-retries 10
|
||
env:
|
||
# Gitea act_runner 的 job 跑在容器里,与服务容器同网络:主机名必须用服务名
|
||
# postgres(GitHub 托管 runner 的 localhost 语义在这里连不通,勿改回)。
|
||
DATABASE_URL: postgresql://postgres:ci-only-password@postgres:5432/traceiq
|
||
E2E_PASSWORD: CI-Test-Only-SecurePassword882!
|
||
PYTHONPATH: .
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- uses: astral-sh/setup-uv@v6
|
||
with:
|
||
version: '0.10.12'
|
||
- uses: actions/setup-node@v4
|
||
with:
|
||
node-version: '22'
|
||
cache: npm
|
||
- run: uv sync --frozen --python 3.12
|
||
- run: npm ci --registry=https://registry.npmjs.org
|
||
- run: uv run ruff check server finance tests scripts
|
||
- run: uv run ruff format --check server finance tests scripts
|
||
- run: uv run python manage.py makemigrations --check --dry-run
|
||
- run: uv run pytest --cov=finance --cov-report=term-missing --cov-fail-under=85
|
||
- run: npm run build
|
||
- run: npm audit --omit=dev --registry=https://registry.npmjs.org
|
||
- run: uv run pip-audit
|
||
- run: uv run python manage.py migrate --noinput
|
||
- run: uv run python manage.py collectstatic --noinput
|
||
- run: uv run python manage.py bootstrap --username admin --organization CI
|
||
env:
|
||
BOOTSTRAP_PASSWORD: ${{ env.E2E_PASSWORD }}
|
||
- run: npx playwright install --with-deps chromium
|
||
- name: Browser regression
|
||
shell: bash
|
||
run: |
|
||
uv run python manage.py runserver 127.0.0.1:8000 --noreload > /tmp/web.log 2>&1 &
|
||
web=$!
|
||
uv run python manage.py import_worker > /tmp/worker.log 2>&1 &
|
||
worker=$!
|
||
trap 'kill "$web" "$worker"' EXIT
|
||
for i in {1..30}; do curl -fsS http://127.0.0.1:8000/api/health && break; sleep 1; done
|
||
npm run test:e2e
|
||
# Gitea 不支持 upload-artifact@v4 的 artifact 协议(GHESNotSupportedError),
|
||
# 上传失败不该把已经全绿的测试标红;迁到 GitHub 托管时此步骤自动生效。
|
||
- uses: actions/upload-artifact@v4
|
||
if: always()
|
||
continue-on-error: true
|
||
with:
|
||
name: browser-results
|
||
path: |
|
||
playwright-report
|
||
test-results
|