cdcc919853
Deploy / Deploy Staging (push) Waiting to run
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Failing after 142h2m16s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 142h2m23s
- tests.yml: 添加集成测试步骤(单元测试后执行 pytest tests/integration) - ci-cd.yml: 添加集成测试步骤 - deploy.yml: 添加部署后冒烟测试(健康检查 + 登录API验证 + /docs端点检查) - requirements-dev.txt: 添加 pytest-timeout 依赖 - test_auth.py: 修复预期状态码(201→200),需要PG的测试添加skipif标记 - test_api.py: 修复预期状态码和错误消息格式,添加skipif标记 - test_projects.py: 修复 ListAssetLibrariesUseCase.execute() 调用签名 - InMemoryAssetRepository: 添加 find_by_library 别名匹配端口接口 集成测试结果: 101 passed, 19 skipped (需PG的认证测试) 无外部依赖的测试全部通过
114 lines
3.6 KiB
YAML
Executable File
114 lines
3.6 KiB
YAML
Executable File
name: Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: runtime-builder
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
python - <<'PY'
|
|
import io
|
|
import os
|
|
import tarfile
|
|
import urllib.request
|
|
|
|
url = f"{os.environ['GITHUB_API_URL']}/repos/{os.environ['GITHUB_REPOSITORY']}/archive/{os.environ['GITHUB_SHA']}.tar.gz"
|
|
request = urllib.request.Request(url, headers={"Authorization": f"token {os.environ['GITHUB_TOKEN']}"})
|
|
with urllib.request.urlopen(request, timeout=120) as response:
|
|
archive = response.read()
|
|
|
|
with tarfile.open(fileobj=io.BytesIO(archive), mode='r:gz') as tar:
|
|
root_prefix = tar.getmembers()[0].name.split('/', 1)[0] + '/'
|
|
for member in tar.getmembers():
|
|
name = member.name
|
|
if name == root_prefix[:-1]:
|
|
continue
|
|
if name.startswith(root_prefix):
|
|
member.name = name[len(root_prefix):]
|
|
if member.name:
|
|
tar.extract(member, '.')
|
|
PY
|
|
|
|
- name: Show Python version
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
python --version
|
|
python -m pip --version
|
|
|
|
- name: Install dependencies
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
python -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
|
python -m pip install -r requirements.txt -r requirements-dev.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
|
|
|
- name: Run unit tests
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
PYTHONPATH="$PWD/apps/api:$PWD" python -m pytest tests/unit -q
|
|
|
|
- name: Run integration tests
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
PYTHONPATH="$PWD/apps/api:$PWD" python -m pytest tests/integration -q --timeout=60 -x
|
|
|
|
lint:
|
|
runs-on: runtime-builder
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
python - <<'PY'
|
|
import io
|
|
import os
|
|
import tarfile
|
|
import urllib.request
|
|
|
|
url = f"{os.environ['GITHUB_API_URL']}/repos/{os.environ['GITHUB_REPOSITORY']}/archive/{os.environ['GITHUB_SHA']}.tar.gz"
|
|
request = urllib.request.Request(url, headers={"Authorization": f"token {os.environ['GITHUB_TOKEN']}"})
|
|
with urllib.request.urlopen(request, timeout=120) as response:
|
|
archive = response.read()
|
|
|
|
with tarfile.open(fileobj=io.BytesIO(archive), mode='r:gz') as tar:
|
|
root_prefix = tar.getmembers()[0].name.split('/', 1)[0] + '/'
|
|
for member in tar.getmembers():
|
|
name = member.name
|
|
if name == root_prefix[:-1]:
|
|
continue
|
|
if name.startswith(root_prefix):
|
|
member.name = name[len(root_prefix):]
|
|
if member.name:
|
|
tar.extract(member, '.')
|
|
PY
|
|
|
|
- name: Install dependencies
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
python -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
|
python -m pip install -r requirements.txt -r requirements-dev.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
|
|
|
|
- name: Run Black (check only)
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
python -m black --check alembic apps packages tests scripts
|
|
|
|
- name: Run Flake8
|
|
shell: sh
|
|
run: |
|
|
set -eu
|
|
python -m flake8 apps packages tests --count --statistics
|