diff --git a/.github/ci/README.md b/.github/ci/README.md new file mode 100644 index 000000000000..ebea0229f09d --- /dev/null +++ b/.github/ci/README.md @@ -0,0 +1,20 @@ +# 按改动范围运行 CI + +主 CI、安全扫描、VIP 入账和多机验收先运行 `changes`。它比较 PR 的 merge base 与 head(production push 比较 before/head),仅启动相关 job。后端改动仍执行完整后端单元、集成和 lint;前端改动仍执行完整前端关键测试、类型检查和 lint。主前端固定 GitHub runner,Node 堆上限 6 GiB。 + +范围在 `scopes.json` 中维护,包含源码、依赖锁文件及检查使用的辅助脚本。Markdown/RST 文档不计入应用源码指纹。job 命令、runner、环境变量、权限或依赖配置变化仍会触发对应检查;仅修改触发规则、归档工作流和本选择器时由 `CI selection rules` 验证。修改某个检查的依赖范围时应同时补充范围用例,不能为了转绿漏掉依赖。 + +对于同一 PR 的后续提交,选择器查询原 PR 最近 30 次对应工作流,只有相关 Git 文件对象和 job 定义完全一致、且对应 job 确实成功时才复用。production 合并则检查实际父提交的已成功 job。失败、取消、跳过、未完成以及其他 PR/fork 的记录不能复用。未显式 checkout PR head 的旧任务可能测试了另一棵合并树,也不复用;当前两项多机验收采用这一保守限制,只按范围跳过。每次决策在 job summary 记录原因和旧 run/SHA;复用表示旧证据适用于相同输入,不声称新 head 已重新测试。查询失败或取不到旧提交时,受影响检查正常运行。 + +手动 `workflow_dispatch`、`v*` tag 以及安全扫描的每周 schedule 强制执行对应工作流的全部检查,不复用旧结果。安全数据库随时间变化,因此每周安全扫描始终保留。选择器仅使用 `contents: read`、`actions: read`,不创建虚假的成功 check。 + +专用回归保留功能路径;共享提示 ID、类型登记和通用翻译由主前端检查覆盖,避免一处文案变更触发多个功能的后端/截图验收。历史 feature 分支 push 入口移除,有 PR 时自动按路径运行;需要独立验收可手动触发。 + +验证选择器只需: + +```bash +python3 -m pip install PyYAML==6.0.3 +python3 -m unittest discover -s .github/ci -p 'test_*.py' -v +``` + +它使用临时 Git 仓库和模拟 GitHub 返回值,覆盖删除、重命名、依赖变更、检查命令变更、旧成功复用、失败/API 异常回退及手动全量,不运行 Go/前端应用测试。 diff --git a/.github/ci/scopes.json b/.github/ci/scopes.json new file mode 100644 index 000000000000..62203d670e40 --- /dev/null +++ b/.github/ci/scopes.json @@ -0,0 +1,64 @@ +{ + "backend-ci.yml": { + "shell": [ + "deploy/*.sh", + "deploy/tests/*.sh", + "deploy/docker-compose*", + "deploy/Dockerfile*", + "Dockerfile*", + ".dockerignore" + ], + "test": [ + "backend/**", + "Makefile", + ".github/scripts/ci-ubuntu-mirrors.sh", + "deploy/tests/docker-compose-simple-mode-env-test.sh", + "deploy/tests/docker-compose-trusted-proxies-env-test.sh", + "deploy/docker-compose*" + ], + "frontend": [ + "frontend/**", + "Makefile" + ], + "golangci-lint": [ + "backend/**", + "Makefile", + ".github/scripts/ci-ubuntu-mirrors.sh" + ], + "release-helpers": [ + ".github/release-tools/**", + ".goreleaser*", + "deploy/**" + ], + "prism-adapter": [ + "prism-adapter/**" + ] + }, + "security-scan.yml": { + "backend-security": [ + "backend/**" + ], + "frontend-security": [ + "frontend/package.json", + "frontend/pnpm-lock.yaml", + ".github/audit-exceptions.yml", + "tools/check_pnpm_audit_exceptions.py" + ] + }, + "multihost-caddy.yml": { + "real-proxy-responses": [ + "deploy/traffic/**" + ] + }, + "multihost-fullapp.yml": { + "isolated-real-applications": [ + "backend/**", + "deploy/traffic/**" + ] + }, + "vip-auto-credit.yml": { + "postgres-repository": [ + "backend/**" + ] + } +} diff --git a/.github/ci/select_jobs.py b/.github/ci/select_jobs.py new file mode 100644 index 000000000000..7b4e08b92496 --- /dev/null +++ b/.github/ci/select_jobs.py @@ -0,0 +1,196 @@ +"""Select affected CI jobs and reuse successful checks of identical inputs.""" +import argparse +import fnmatch +import functools +import hashlib +import json +import os +from pathlib import Path +import re +import subprocess +import urllib.parse +import urllib.request + +import yaml + +ROOT = Path(__file__).resolve().parents[2] + + +def git(*args): + return subprocess.check_output(['git', *args], cwd=ROOT) + + +def commit(sha): + if not re.fullmatch(r'[0-9a-f]{40}', sha): + raise ValueError('expected an immutable commit SHA') + try: + git('cat-file', '-e', sha + '^{commit}') + except subprocess.CalledProcessError: + git('fetch', '--no-tags', '--depth=1', 'origin', sha) + return sha + + +def matches(path, patterns): + # Patterns intentionally use fnmatch semantics: * also matches slashes. + return any(fnmatch.fnmatchcase(path, pattern) for pattern in patterns) + + +@functools.lru_cache(maxsize=32) +def tree(sha): + return dict(entry.split(b'\t', 1)[::-1] for entry in + git('ls-tree', '-rz', '--full-tree', sha).split(b'\0') if entry) + + +def source_snapshot(sha, patterns): + return {path: blob for path, blob in tree(sha).items() + if not path.decode().endswith(('.md', '.rst')) + and matches(path.decode(), patterns)} + + +@functools.lru_cache(maxsize=32) +def workflow_at(sha, filename): + return yaml.safe_load(git('show', sha + ':.github/workflows/' + filename)) + + +def definition(sha, filename, job): + workflow = workflow_at(sha, filename) + # The selection gate does not change the commands being verified. + spec = {k: v for k, v in workflow['jobs'][job].items() if k not in ('needs', 'if')} + return {'job': spec, 'env': workflow.get('env'), 'defaults': workflow.get('defaults'), + 'permissions': workflow.get('permissions')} + + +def checks_candidate(sha, filename, job): + # Default checkout on pull_request tests the synthetic merge tree, whose + # base can change independently. Only reuse explicitly pinned head checks. + steps = workflow_at(sha, filename)['jobs'][job].get('steps', []) + checkouts = [step for step in steps if step.get('uses', '').startswith('actions/checkout@')] + expected = '${{ github.event.pull_request.head.sha || github.sha }}' + return bool(checkouts) and all(step.get('with', {}).get('ref') == expected for step in checkouts) + + +def fingerprint(sha, filename, job, patterns): + spec = definition(sha, filename, job) + # actions:read only permits evidence lookup, not test/runtime behavior. + if isinstance(spec['permissions'], dict): + spec['permissions'] = {k: v for k, v in spec['permissions'].items() if k != 'actions'} + payload = {'files': {p.decode(): b.decode() for p, b in source_snapshot(sha, patterns).items()}, + 'definition': spec, 'patterns': patterns} + return hashlib.sha256(json.dumps(payload, sort_keys=True).encode()).hexdigest() + + +def affected(base, head, filename, job, patterns): + try: + return fingerprint(base, filename, job, patterns) != fingerprint(head, filename, job, patterns) + except (KeyError, subprocess.CalledProcessError): + return True # New job/workflow or missing old source requires a check. + + +class Evidence: + def __init__(self, repo, token): + self.repo = repo + self.token = token + + def get(self, path, query=None): + url = 'https://api.github.com/repos/' + self.repo + '/' + path + if query: + url += '?' + urllib.parse.urlencode(query) + request = urllib.request.Request(url, headers={ + 'Authorization': 'Bearer ' + self.token, + 'Accept': 'application/vnd.github+json', 'X-GitHub-Api-Version': '2022-11-28', + }) + with urllib.request.urlopen(request, timeout=15) as response: + return json.load(response) + + def candidates(self, filename, event, event_name, head): + # Same PR only. For a production merge, inspect its actual parents. + if event_name == 'pull_request': + pr = event['pull_request'] + rows = self.get('actions/workflows/' + filename + '/runs', { + 'event': 'pull_request', 'branch': pr['head']['ref'], 'per_page': 30, + })['workflow_runs'] + return [r for r in rows if r['head_sha'] != head + and r.get('head_repository', {}).get('full_name') == pr['head']['repo']['full_name'] + and any(p['number'] == pr['number'] for p in r.get('pull_requests', []))] + parents = git('show', '-s', '--format=%P', head).decode().split() + rows = [] + for parent in parents: + rows += self.get('actions/workflows/' + filename + '/runs', { + 'head_sha': parent, 'per_page': 30, + })['workflow_runs'] + return [r for r in rows if r['event'] in ('pull_request', 'push')] + + @functools.lru_cache(maxsize=30) + def successful_jobs(self, run_id): + jobs = [] + for page in range(1, 6): + batch = self.get(f'actions/runs/{run_id}/jobs', {'per_page': 100, 'page': page})['jobs'] + jobs += batch + if len(batch) < 100: + break + return {j['name'] for j in jobs if j['status'] == 'completed' and j['conclusion'] == 'success'} + + +def select(filename, scopes, event_name, event, head, evidence=None, force=False): + if force or event_name in ('workflow_dispatch', 'schedule') or os.environ.get('GITHUB_REF', '').startswith('refs/tags/'): + return {job: (True, 'explicit full verification') for job in scopes} + if event_name == 'pull_request': + base = commit(event['pull_request']['base']['sha']) + base = git('merge-base', base, head).decode().strip() + else: + base = event.get('before', '') + if not base or set(base) == {'0'}: + return {job: (True, 'no comparison base') for job in scopes} + base = commit(base) + selected = {job: (affected(base, head, filename, job, patterns), 'inputs changed') + for job, patterns in scopes.items()} + selected = {job: value if value[0] else (False, 'inputs unchanged') for job, value in selected.items()} + if evidence is None or not any(value[0] for value in selected.values()): + return selected + try: + candidates = evidence.candidates(filename, event, event_name, head) + for run in candidates: + if not any(v[0] for v in selected.values()): + break + old = commit(run['head_sha']) + for job, patterns in scopes.items(): + if not selected[job][0]: + continue + try: + same = fingerprint(old, filename, job, patterns) == fingerprint(head, filename, job, patterns) + except (KeyError, subprocess.CalledProcessError): + continue + if (same and checks_candidate(old, filename, job) + and checks_candidate(head, filename, job) + and job in evidence.successful_jobs(run['id'])): + selected[job] = (False, f"reused successful run {run['id']} at {old}") + except Exception as error: + # Missing token, API limits or unavailable commits must never skip tests. + print(f'Evidence lookup unavailable ({type(error).__name__}); affected checks will run') + return selected + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('workflow') + args = parser.parse_args() + config = json.loads((ROOT / '.github/ci/scopes.json').read_text()) + scopes = config[args.workflow] + event = json.loads(Path(os.environ['GITHUB_EVENT_PATH']).read_text()) + name = os.environ['GITHUB_EVENT_NAME'] + head = commit(event['pull_request']['head']['sha'] if name == 'pull_request' else os.environ['GITHUB_SHA']) + token = os.environ.get('GH_TOKEN', '') + evidence = Evidence(os.environ['GITHUB_REPOSITORY'], token) if token else None + selected = select(args.workflow, scopes, name, event, head, evidence) + with open(os.environ['GITHUB_OUTPUT'], 'a') as output: + for job, (run, reason) in selected.items(): + output.write(f'{job}={str(run).lower()}\n') + print(f'{job}: {"run" if run else "skip"} ({reason})') + with open(os.environ['GITHUB_STEP_SUMMARY'], 'a') as summary: + summary.write('| Check | Decision | Reason |\n| --- | --- | --- |\n') + for job, (run, reason) in selected.items(): + summary.write(f'| {job} | {"run" if run else "skip"} | {reason} |\n') + + +if __name__ == '__main__': + main() diff --git a/.github/ci/test_select.py b/.github/ci/test_select.py new file mode 100644 index 000000000000..fedd8c58f25d --- /dev/null +++ b/.github/ci/test_select.py @@ -0,0 +1,172 @@ +import importlib.util +import json +from pathlib import Path +import subprocess +import tempfile +import unittest +from unittest.mock import patch + +import yaml + +SPEC = importlib.util.spec_from_file_location('ci_select', Path(__file__).with_name('select_jobs.py')) +ci = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(ci) +REPO = ci.ROOT + + +class SelectionTests(unittest.TestCase): + def setUp(self): + self.temp = tempfile.TemporaryDirectory() + self.addCleanup(self.temp.cleanup) + self.root = Path(self.temp.name) + self.patch = patch.object(ci, 'ROOT', self.root) + self.patch.start() + self.addCleanup(self.patch.stop) + self.env = patch.dict('os.environ', {'GITHUB_REF': 'refs/pull/7/merge'}) + self.env.start() + self.addCleanup(self.env.stop) + ci.tree.cache_clear() + ci.workflow_at.cache_clear() + self.git('init', '-q') + self.git('config', 'user.email', 'fixture@example.invalid') + self.git('config', 'user.name', 'Fixture') + self.write('.github/workflows/main.yml', 'name: CI\npermissions:\n contents: read\njobs:\n backend:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v6\n with:\n ref: ${{ github.event.pull_request.head.sha || github.sha }}\n - run: go test ./...\n frontend:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v6\n with:\n ref: ${{ github.event.pull_request.head.sha || github.sha }}\n - run: pnpm test\n') + self.write('backend/a.go', 'package a\n') + self.write('frontend/a.ts', 'export const a = 1\n') + self.base = self.save() + self.scopes = {'backend': ['backend/**'], 'frontend': ['frontend/**']} + + def git(self, *args): + return subprocess.check_output(['git', *args], cwd=self.root, stderr=subprocess.DEVNULL).decode().strip() + + def write(self, path, text): + target = self.root / path + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text(text) + + def save(self): + self.git('add', '-A') + self.git('commit', '-qm', 'fixture') + return self.git('rev-parse', 'HEAD') + + def event(self): + return {'pull_request': {'number': 7, 'base': {'sha': self.base}, 'head': {'ref': 'feature', 'repo': {'full_name': 'fixture/repo'}}}} + + def select(self, head, evidence=None): + return ci.select('main.yml', self.scopes, 'pull_request', self.event(), head, evidence) + + def test_docs_and_frontend_changes_do_not_run_backend(self): + self.write('docs/guide.md', 'docs') + docs = self.save() + self.assertFalse(any(v[0] for v in self.select(docs).values())) + self.write('frontend/a.ts', 'changed') + result = self.select(self.save()) + self.assertFalse(result['backend'][0]) + self.assertTrue(result['frontend'][0]) + + def test_deletions_renames_and_dependency_changes_are_affected(self): + (self.root / 'backend/a.go').rename(self.root / 'backend/b.go') + self.assertTrue(self.select(self.save())['backend'][0]) + (self.root / 'backend/b.go').unlink() + self.assertTrue(self.select(self.save())['backend'][0]) + self.write('frontend/pnpm-lock.yaml', 'new dependency') + self.assertTrue(self.select(self.save())['frontend'][0]) + + def test_trigger_edits_skip_but_test_command_edits_run(self): + p = self.root / '.github/workflows/main.yml' + p.write_text(p.read_text() + 'on:\n pull_request:\n') + self.assertFalse(any(v[0] for v in self.select(self.save()).values())) + p.write_text(p.read_text().replace('go test ./...', 'go test -race ./...')) + result = self.select(self.save()) + self.assertTrue(result['backend'][0]) + self.assertFalse(result['frontend'][0]) + + def test_successful_identical_inputs_reused_but_failed_jobs_not_reused(self): + self.write('backend/a.go', 'package updated\n') + previous = self.save() + self.write('docs/notes.md', 'unrelated followup') + head = self.save() + class Evidence: + def candidates(self, *args): + return [{'id': 42, 'head_sha': previous}] + def successful_jobs(self, run_id): + return {'backend'} + self.assertFalse(self.select(head, Evidence())['backend'][0]) + with patch.object(Evidence, 'successful_jobs', return_value=set()): + self.assertTrue(self.select(head, Evidence())['backend'][0]) + self.write('backend/a.go', 'package newer\n') + self.assertTrue(self.select(self.save(), Evidence())['backend'][0]) + + def test_api_failure_runs_affected_checks(self): + self.write('backend/a.go', 'package updated\n') + class Broken: + def candidates(self, *args): + raise TimeoutError('fixture') + self.assertTrue(self.select(self.save(), Broken())['backend'][0]) + + def test_manual_schedule_and_tags_force_full_checks(self): + for event_name in ['workflow_dispatch', 'schedule']: + result = ci.select('main.yml', self.scopes, event_name, {}, self.base) + self.assertTrue(all(v[0] for v in result.values())) + with patch.dict('os.environ', {'GITHUB_REF': 'refs/tags/v1.0.0'}): + result = ci.select('main.yml', self.scopes, 'push', {}, self.base) + self.assertTrue(all(v[0] for v in result.values())) + + def test_production_merge_reuses_identical_successful_pr_inputs(self): + self.write('backend/a.go', 'package updated\n') + head = self.save() + class Evidence: + def candidates(self, *args): + return [{'id': 11, 'head_sha': head}] + def successful_jobs(self, run_id): + return {'backend'} + result = ci.select('main.yml', self.scopes, 'push', {'before': self.base}, head, Evidence()) + self.assertFalse(result['backend'][0]) + + def test_default_merge_checkout_is_not_reusable(self): + p = self.root / '.github/workflows/main.yml' + p.write_text(p.read_text().replace(' ref: ${{ github.event.pull_request.head.sha || github.sha }}', ' fetch-depth: 0')) + self.write('backend/a.go', 'package updated\n') + previous = self.save() + self.write('docs/notes.md', 'unchanged application') + head = self.save() + class Evidence: + def candidates(self, *args): + return [{'id': 42, 'head_sha': previous}] + def successful_jobs(self, run_id): + return {'backend'} + self.assertTrue(self.select(head, Evidence())['backend'][0]) + + def test_other_pr_and_other_repository_results_are_not_candidates(self): + evidence = ci.Evidence('fixture/repo', 'unused') + common = {'head_sha': 'a' * 40, 'head_repository': {'full_name': 'fixture/repo'}, 'pull_requests': [{'number': 7}]} + runs = [dict(common, id=1), dict(common, id=2, pull_requests=[{'number': 8}]), + dict(common, id=3, head_repository={'full_name': 'other/repo'})] + with patch.object(evidence, 'get', return_value={'workflow_runs': runs}): + self.assertEqual([r['id'] for r in evidence.candidates('main.yml', self.event(), 'pull_request', self.base)], [1]) + + +class WiringTests(unittest.TestCase): + def test_workflow_outputs_scopes_and_conditions_are_consistent(self): + config = json.loads((REPO / '.github/ci/scopes.json').read_text()) + for filename, scopes in config.items(): + workflow = yaml.safe_load((REPO / '.github/workflows' / filename).read_text()) + self.assertEqual(set(workflow['jobs']['changes']['outputs']), set(scopes), filename) + for job in scopes: + self.assertEqual(workflow['jobs'][job]['needs'], 'changes') + self.assertEqual(workflow['jobs'][job]['if'], f"needs.changes.outputs['{job}'] == 'true'") + for p in (REPO / '.github/workflows').glob('*.yml'): + self.assertTrue(yaml.safe_load(p.read_text()).get('jobs'), p.name) + + def test_feature_workflow_jobs_unchanged_by_trigger_cleanup(self): + # Broad inputs must not sneak back through shared UI metadata. + for p in (REPO / '.github/workflows').glob('*.yml'): + workflow = yaml.safe_load(p.read_text()) + events = workflow.get('on', workflow.get(True, {})) + paths = (events.get('pull_request') or {}).get('paths', []) + self.assertNotIn('frontend/src/constants/newFeatureNotices.ts', paths, p.name) + self.assertNotIn('frontend/src/**', paths, p.name) + + +if __name__ == '__main__': + unittest.main() diff --git a/.github/workflows/account-daily-schedule.yml b/.github/workflows/account-daily-schedule.yml index 6e71eb034426..83acd64e8797 100644 --- a/.github/workflows/account-daily-schedule.yml +++ b/.github/workflows/account-daily-schedule.yml @@ -1,7 +1,5 @@ name: Account daily schedule regressions on: - push: - branches: ['feat/account-daily-schedule*'] pull_request: paths: - '.github/workflows/account-daily-schedule.yml' diff --git a/.github/workflows/account-performance-error-threshold.yml b/.github/workflows/account-performance-error-threshold.yml index 33fd1bc34bb7..f6866b6e7bbc 100644 --- a/.github/workflows/account-performance-error-threshold.yml +++ b/.github/workflows/account-performance-error-threshold.yml @@ -1,8 +1,7 @@ name: Account performance HTTP error thresholds on: - push: - branches: [feat/account-performance-error-rate] + workflow_dispatch: pull_request: branches: [production] paths: @@ -13,7 +12,6 @@ on: - 'frontend/src/components/account/AccountPerformance*' - 'frontend/src/components/account/__tests__/AccountPerformance*' - 'frontend/src/i18n/locales/*/accountPerformance.ts' - - 'frontend/src/constants/newFeatureNotices.ts' - 'frontend/src/api/__tests__/admin.accounts.performance.spec.ts' - '.github/workflows/account-performance-error-threshold.yml' - '.github/scripts/account-performance-cache-screenshot.mjs' diff --git a/.github/workflows/account-performance-regressions.yml b/.github/workflows/account-performance-regressions.yml index 92cb7d3c7166..c2ca01f21b94 100644 --- a/.github/workflows/account-performance-regressions.yml +++ b/.github/workflows/account-performance-regressions.yml @@ -1,8 +1,15 @@ name: Account performance release regressions on: + workflow_dispatch: push: - branches: [production, fix/account-performance-release-2.19.2] + branches: [production] + paths: + - 'backend/internal/service/account_performance*' + - 'backend/internal/repository/account_performance*' + - 'backend/internal/service/regional_scheduler_sync.go' + - 'backend/internal/repository/regional_slot_authority.go' + - '.github/workflows/account-performance-regressions.yml' pull_request: paths: - 'backend/internal/service/account_performance*' diff --git a/.github/workflows/ai-ops.yml b/.github/workflows/ai-ops.yml index 9a6743c28da9..25dbb8145a45 100644 --- a/.github/workflows/ai-ops.yml +++ b/.github/workflows/ai-ops.yml @@ -7,7 +7,6 @@ on: - 'frontend/src/api/admin/__tests__/aiOps*' - 'frontend/src/components/admin/operations/SmartOpsNav.vue' - 'frontend/src/i18n/locales/*/aiOps*' - - 'frontend/src/constants/newFeatureNotices.ts' - 'frontend/src/router/index.ts' - 'backend/internal/**/ai_ops*' - 'backend/internal/**/ops_ai*' diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index d910214ffce1..c4f26c8cc518 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -14,12 +14,39 @@ concurrency: permissions: contents: read + actions: read env: EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} jobs: + changes: + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + shell: ${{ steps.select.outputs['shell'] }} + test: ${{ steps.select.outputs['test'] }} + frontend: ${{ steps.select.outputs['frontend'] }} + golangci-lint: ${{ steps.select.outputs['golangci-lint'] }} + release-helpers: ${{ steps.select.outputs['release-helpers'] }} + prism-adapter: ${{ steps.select.outputs['prism-adapter'] }} + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - name: Install selector dependency + run: python3 -m pip install PyYAML==6.0.3 + - name: Select affected checks + id: select + env: + GH_TOKEN: ${{ github.token }} + run: python3 .github/ci/select_jobs.py backend-ci.yml + shell: + needs: changes + if: needs.changes.outputs['shell'] == 'true' runs-on: macos-15-intel steps: - uses: actions/checkout@v6 @@ -38,6 +65,8 @@ jobs: /bin/sh deploy/test-caddyfile-cache.sh test: + needs: changes + if: needs.changes.outputs['test'] == 'true' runs-on: ubuntu-latest services: postgres: @@ -100,6 +129,8 @@ jobs: run: make test-integration frontend: + needs: changes + if: needs.changes.outputs['frontend'] == 'true' runs-on: ubuntu-latest env: NODE_OPTIONS: --max-old-space-size=6144 @@ -126,6 +157,8 @@ jobs: run: make test-frontend golangci-lint: + needs: changes + if: needs.changes.outputs['golangci-lint'] == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -150,6 +183,8 @@ jobs: working-directory: backend release-helpers: + needs: changes + if: needs.changes.outputs['release-helpers'] == 'true' runs-on: ${{ vars.SUB2API_SUPPLEMENTARY_RUNNER || 'ubuntu-latest' }} steps: - uses: actions/checkout@v6 @@ -182,6 +217,8 @@ jobs: - run: python -m unittest discover -s deploy/connection-diagnostics -p 'test_collect.py' prism-adapter: + needs: changes + if: needs.changes.outputs['prism-adapter'] == 'true' runs-on: ${{ vars.SUB2API_SUPPLEMENTARY_RUNNER || 'ubuntu-latest' }} steps: - uses: actions/checkout@v6 diff --git a/.github/workflows/ci-selection.yml b/.github/workflows/ci-selection.yml new file mode 100644 index 000000000000..121720289638 --- /dev/null +++ b/.github/workflows/ci-selection.yml @@ -0,0 +1,27 @@ +name: CI selection rules +on: + pull_request: + paths: + - '.github/ci/**' + - '.github/workflows/**' + push: + branches: [production] + paths: + - '.github/ci/**' + - '.github/workflows/**' + workflow_dispatch: +permissions: + contents: read +concurrency: + group: ci-selection-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + selection: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + - run: python3 -m pip install PyYAML==6.0.3 + - run: python3 -m unittest discover -s .github/ci -p 'test_*.py' -v diff --git a/.github/workflows/collection-reliability.yml b/.github/workflows/collection-reliability.yml index aa596c2e1513..09e2af4221b0 100644 --- a/.github/workflows/collection-reliability.yml +++ b/.github/workflows/collection-reliability.yml @@ -19,8 +19,7 @@ on: - 'frontend/src/api/*payment*' - 'frontend/src/api/admin/bepusdt.ts' - 'frontend/src/types/payment.ts' - - 'frontend/src/constants/newFeatureNotices.ts' - - 'frontend/src/i18n/**' + - 'frontend/src/i18n/locales/*/payment.ts' - 'frontend/src/router/**' - 'frontend/package.json' - 'frontend/pnpm-lock.yaml' diff --git a/.github/workflows/credential-operation-errors.yml b/.github/workflows/credential-operation-errors.yml index c231cb8c598a..35f1d17a8558 100644 --- a/.github/workflows/credential-operation-errors.yml +++ b/.github/workflows/credential-operation-errors.yml @@ -1,7 +1,6 @@ name: Credential operation errors on: - push: - branches: ['fix/credential-operations-error-classification'] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/*credential*' @@ -17,7 +16,13 @@ on: - 'tools/credential_operation_seam.py' - 'tools/fixtures/credential-operation-errors.json' - 'tools/fixtures/credential-refresh-policy-errors.json' - - 'frontend/src/**' + - 'frontend/src/views/admin/ops/*TokenGuard*' + - 'frontend/src/views/admin/ops/__tests__/*Credential*' + - 'frontend/src/views/admin/ops/__tests__/*TokenGuard*' + - 'frontend/src/components/account/*Credential*' + - 'frontend/src/components/account/__tests__/*Credential*' + - 'frontend/src/api/admin/*credential*' + - 'frontend/src/i18n/locales/*/credential*' - '.github/workflows/credential-operation-errors.yml' permissions: contents: read diff --git a/.github/workflows/dashboard-account-concurrency.yml b/.github/workflows/dashboard-account-concurrency.yml index d8326fda27e0..f2b56c6ec9fc 100644 --- a/.github/workflows/dashboard-account-concurrency.yml +++ b/.github/workflows/dashboard-account-concurrency.yml @@ -13,8 +13,6 @@ on: - 'frontend/src/views/admin/DashboardView.vue' - 'frontend/src/views/admin/__tests__/DashboardView.spec.ts' - 'frontend/src/components/common/NewFeatureBadge.vue' - - 'frontend/src/components/common/__tests__/NewFeatureBadge.spec.ts' - - 'frontend/src/constants/newFeatureNotices.ts' - 'frontend/src/i18n/locales/*/admin/overview.ts' permissions: diff --git a/.github/workflows/encrypted-history-400.yml b/.github/workflows/encrypted-history-400.yml index 10283624b576..5b3a037c91cb 100644 --- a/.github/workflows/encrypted-history-400.yml +++ b/.github/workflows/encrypted-history-400.yml @@ -10,8 +10,6 @@ on: - 'backend/internal/handler/admin/setting*' - 'backend/internal/handler/dto/settings.go' - 'frontend/src/components/settings/EncryptedHistory400Settings.vue' - - 'frontend/src/components/common/__tests__/NewFeatureBadge.spec.ts' - - 'frontend/src/constants/newFeatureNotices.ts' - 'frontend/src/views/admin/SettingsView.vue' - 'frontend/src/views/admin/__tests__/SettingsView.spec.ts' - 'frontend/src/api/admin/settings.ts' diff --git a/.github/workflows/free-fast-customer-cost-details.yml b/.github/workflows/free-fast-customer-cost-details.yml index 5232abefc41f..9e154d239b12 100644 --- a/.github/workflows/free-fast-customer-cost-details.yml +++ b/.github/workflows/free-fast-customer-cost-details.yml @@ -3,10 +3,24 @@ on: pull_request: branches: [production] paths: - - 'backend/**' + - 'backend/go.*' + - 'backend/ent/**' + - 'backend/migrations/**' + - 'backend/internal/service/*billing*' + - 'backend/internal/service/*pricing*' + - 'backend/internal/service/*group*' + - 'backend/internal/service/*usage*' + - 'backend/internal/service/customer_cost*' + - 'backend/internal/service/*free*fast*' + - 'backend/internal/handler/dto/**' + - 'backend/internal/handler/admin/*usage*' + - 'backend/internal/handler/admin/*group*' + - 'backend/internal/repository/*usage*' + - 'backend/internal/repository/*group*' + - 'backend/internal/repository/*free*fast*' + - 'backend/internal/pkg/usagelog/**' - 'frontend/src/components/admin/usage/**' - 'frontend/src/utils/customerCostDetails.ts' - - 'frontend/src/types/index.ts' - '.github/workflows/free-fast-customer-cost-details.yml' - '.github/scripts/free-fast-*' - '.github/scripts/test_free_fast_cost_evidence.py' diff --git a/.github/workflows/free-ultrafast.yml b/.github/workflows/free-ultrafast.yml index 318a64e6821e..6ba5a0ce2c4e 100644 --- a/.github/workflows/free-ultrafast.yml +++ b/.github/workflows/free-ultrafast.yml @@ -3,12 +3,26 @@ on: pull_request: branches: [production] paths: - - 'backend/**' + - 'backend/go.*' + - 'backend/ent/**' + - 'backend/migrations/**' + - 'backend/internal/service/*billing*' + - 'backend/internal/service/*pricing*' + - 'backend/internal/service/*group*' + - 'backend/internal/service/*usage*' + - 'backend/internal/service/customer_cost*' + - 'backend/internal/service/*free*fast*' + - 'backend/internal/handler/dto/**' + - 'backend/internal/handler/admin/*usage*' + - 'backend/internal/handler/admin/*group*' + - 'backend/internal/repository/*usage*' + - 'backend/internal/repository/*group*' + - 'backend/internal/repository/*free*fast*' + - 'backend/internal/pkg/usagelog/**' - 'frontend/src/views/admin/GroupsView.vue' - 'frontend/src/views/admin/__tests__/GroupsView.freeUltrafast.spec.ts' - 'frontend/src/utils/customerCostDetails.ts' - 'frontend/src/utils/__tests__/customerCostDetails.ultrafast.spec.ts' - - 'frontend/src/constants/newFeatureNotices.ts' - '.github/workflows/free-ultrafast.yml' - '.github/scripts/free-ultrafast-browser.mjs' workflow_dispatch: diff --git a/.github/workflows/image-header-timeout.yml b/.github/workflows/image-header-timeout.yml index af5b3898254b..c58bd56f7ba7 100644 --- a/.github/workflows/image-header-timeout.yml +++ b/.github/workflows/image-header-timeout.yml @@ -1,7 +1,6 @@ name: Image header timeout acceptance on: - push: - branches: [review/pr714-merge-fixes] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/issue-578-regression.yml b/.github/workflows/issue-578-regression.yml index b3e36125d2ef..50013f4a293a 100644 --- a/.github/workflows/issue-578-regression.yml +++ b/.github/workflows/issue-578-regression.yml @@ -1,8 +1,6 @@ name: Issue 578 offline regression on: - push: - branches: ['fix/issue-578-bps-usage-snapshot'] pull_request: branches: [production] paths: diff --git a/.github/workflows/issue-600-regression.yml b/.github/workflows/issue-600-regression.yml index 87321c963431..9949edc5ed30 100644 --- a/.github/workflows/issue-600-regression.yml +++ b/.github/workflows/issue-600-regression.yml @@ -1,7 +1,6 @@ name: Issue 600 WS client identity on: - push: - branches: [fix/issue600-ws-client-identity] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/issue618-easypay-recovery.yml b/.github/workflows/issue618-easypay-recovery.yml index 29135d7d2ed0..44544db7d57f 100644 --- a/.github/workflows/issue618-easypay-recovery.yml +++ b/.github/workflows/issue618-easypay-recovery.yml @@ -1,7 +1,6 @@ name: Issue618 EasyPay confirmation recovery on: - push: - branches: [fix/payment-confirmation-recovery-618] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/issue711-scheduler-contention.yml b/.github/workflows/issue711-scheduler-contention.yml index 2414ec2f88ab..8cfd52bba8e4 100644 --- a/.github/workflows/issue711-scheduler-contention.yml +++ b/.github/workflows/issue711-scheduler-contention.yml @@ -1,8 +1,7 @@ name: Issue711 scheduler contention on: - push: - branches: [fix/scheduler-snapshot-lock-contention] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/issue733-priority-filters.yml b/.github/workflows/issue733-priority-filters.yml index 7131d97047a5..e331ea86f61b 100644 --- a/.github/workflows/issue733-priority-filters.yml +++ b/.github/workflows/issue733-priority-filters.yml @@ -1,8 +1,6 @@ name: Issue733 explicit priority filters on: workflow_dispatch: - push: - branches: [fix/issue733-priority-filter-fix] pull_request: paths: - 'frontend/src/**/PriorityScheduling*' diff --git a/.github/workflows/issue733-priority-ui.yml b/.github/workflows/issue733-priority-ui.yml index c535740f35c3..8feba5bc03bc 100644 --- a/.github/workflows/issue733-priority-ui.yml +++ b/.github/workflows/issue733-priority-ui.yml @@ -1,7 +1,6 @@ name: Issue733 priority reading UI on: - push: - branches: [fix/issue733-priority-ui] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/priority_latency_series*' diff --git a/.github/workflows/issue765-image-scheduler.yml b/.github/workflows/issue765-image-scheduler.yml index 1c2110383a0b..32a07d574b67 100644 --- a/.github/workflows/issue765-image-scheduler.yml +++ b/.github/workflows/issue765-image-scheduler.yml @@ -1,8 +1,7 @@ name: Issue 765 image scheduler authorization on: - push: - branches: [fix/issue765-image-scheduler-20261110] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/issue817-manual-fencing.yml b/.github/workflows/issue817-manual-fencing.yml index e714a05da709..6db88e2907de 100644 --- a/.github/workflows/issue817-manual-fencing.yml +++ b/.github/workflows/issue817-manual-fencing.yml @@ -1,8 +1,7 @@ name: Issue817 manual request fencing on: - push: - branches: [fix/issue817-ack-fencing-20261114] + workflow_dispatch: pull_request: paths: - 'backend/internal/repository/account_quality.go' diff --git a/.github/workflows/issue817-quality-quota.yml b/.github/workflows/issue817-quality-quota.yml index 280a33e8e264..6f69da272f18 100644 --- a/.github/workflows/issue817-quality-quota.yml +++ b/.github/workflows/issue817-quality-quota.yml @@ -1,8 +1,7 @@ name: Issue817 quality quota regressions on: - push: - branches: [fix/issue817-quality-exhausted-filter] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/quality_quota*' diff --git a/.github/workflows/issue817-quota-skip-followup.yml b/.github/workflows/issue817-quota-skip-followup.yml index 1d333b74c6d1..fb58596750d1 100644 --- a/.github/workflows/issue817-quota-skip-followup.yml +++ b/.github/workflows/issue817-quota-skip-followup.yml @@ -1,8 +1,7 @@ name: Issue817 quota skip pending 5xx on: - push: - branches: [fix/issue817-quota-skip-followup-20261113] + workflow_dispatch: pull_request: paths: - 'backend/internal/repository/quality_template_quota.go' diff --git a/.github/workflows/key-risk-postgres.yml b/.github/workflows/key-risk-postgres.yml index 3e5dc93fcbeb..4588b935cc48 100644 --- a/.github/workflows/key-risk-postgres.yml +++ b/.github/workflows/key-risk-postgres.yml @@ -1,8 +1,9 @@ name: Key risk PostgreSQL acceptance on: + workflow_dispatch: push: - branches: [production, review/pr717-merge-fixes] + branches: [production] paths: - 'backend/internal/keyrisk/**' - 'backend/migrations/*key_risk*.sql' diff --git a/.github/workflows/keys-usage-layout.yml b/.github/workflows/keys-usage-layout.yml index a2527a9bb372..3c038123deaf 100644 --- a/.github/workflows/keys-usage-layout.yml +++ b/.github/workflows/keys-usage-layout.yml @@ -1,8 +1,7 @@ name: Keys usage layout on: - push: - branches: [fix/keys-usage-layout-20261108] + workflow_dispatch: pull_request: paths: - 'frontend/src/views/user/KeysView.vue' diff --git a/.github/workflows/model-billing-groups.yml b/.github/workflows/model-billing-groups.yml index f2381082854a..22ddf3de8609 100644 --- a/.github/workflows/model-billing-groups.yml +++ b/.github/workflows/model-billing-groups.yml @@ -1,7 +1,6 @@ name: Model billing group scope on: - push: - branches: [feat/model-multiplier-group-scope] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/model_billing*' diff --git a/.github/workflows/multigroup-model-list.yml b/.github/workflows/multigroup-model-list.yml index e25bb8e269c5..c52f248583ca 100644 --- a/.github/workflows/multigroup-model-list.yml +++ b/.github/workflows/multigroup-model-list.yml @@ -1,8 +1,7 @@ name: Multi-group model catalogue on: - push: - branches: [fix/multigroup-model-list-union] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/multihost-caddy.yml b/.github/workflows/multihost-caddy.yml index 1558aa01f1b8..78ac4de0665f 100644 --- a/.github/workflows/multihost-caddy.yml +++ b/.github/workflows/multihost-caddy.yml @@ -14,9 +14,31 @@ concurrency: permissions: contents: read + actions: read jobs: + changes: + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + real-proxy-responses: ${{ steps.select.outputs['real-proxy-responses'] }} + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - name: Install selector dependency + run: python3 -m pip install PyYAML==6.0.3 + - name: Select affected checks + id: select + env: + GH_TOKEN: ${{ github.token }} + run: python3 .github/ci/select_jobs.py multihost-caddy.yml + real-proxy-responses: + needs: changes + if: needs.changes.outputs['real-proxy-responses'] == 'true' runs-on: ubuntu-latest timeout-minutes: 6 steps: diff --git a/.github/workflows/multihost-fullapp.yml b/.github/workflows/multihost-fullapp.yml index 36502535b1ea..3d9091a72a6b 100644 --- a/.github/workflows/multihost-fullapp.yml +++ b/.github/workflows/multihost-fullapp.yml @@ -14,9 +14,31 @@ concurrency: permissions: contents: read + actions: read jobs: + changes: + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + isolated-real-applications: ${{ steps.select.outputs['isolated-real-applications'] }} + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - name: Install selector dependency + run: python3 -m pip install PyYAML==6.0.3 + - name: Select affected checks + id: select + env: + GH_TOKEN: ${{ github.token }} + run: python3 .github/ci/select_jobs.py multihost-fullapp.yml + isolated-real-applications: + needs: changes + if: needs.changes.outputs['isolated-real-applications'] == 'true' runs-on: ubuntu-latest timeout-minutes: 35 steps: diff --git a/.github/workflows/oauth-degradation-actions.yml b/.github/workflows/oauth-degradation-actions.yml index 62f6a1c53589..a850f5e6673b 100644 --- a/.github/workflows/oauth-degradation-actions.yml +++ b/.github/workflows/oauth-degradation-actions.yml @@ -1,10 +1,19 @@ name: OAuth degradation actions on: + workflow_dispatch: push: - branches: [production, feat/oauth-degradation-actions-20261109, ci/oauth-workflow-mirror-recovery-20261111] + branches: [production] + paths: + - 'backend/internal/service/*oauth*' + - 'backend/internal/repository/*oauth*' + - 'backend/internal/repository/*timezone*' + - '.github/workflows/oauth-degradation-actions.yml' pull_request: branches: [production] paths: + - 'backend/internal/service/*oauth*' + - 'backend/internal/repository/*oauth*' + - 'backend/internal/repository/*timezone*' - '.github/workflows/oauth-degradation-actions.yml' permissions: contents: read diff --git a/.github/workflows/oauth-degradation-native-controls.yml b/.github/workflows/oauth-degradation-native-controls.yml index f4d9b8fc0b11..7a2aa0cde46d 100644 --- a/.github/workflows/oauth-degradation-native-controls.yml +++ b/.github/workflows/oauth-degradation-native-controls.yml @@ -1,8 +1,19 @@ name: OAuth degradation native controls on: + workflow_dispatch: push: - branches: [production, fix/oauth-degradation-native-controls-20261110, ci/oauth-workflow-mirror-recovery-20261111] + branches: [production] + paths: + - 'backend/internal/service/*oauth*' + - 'backend/internal/service/account.go' + - 'backend/internal/service/openai_model*' + - 'backend/internal/repository/*oauth*' + - 'backend/internal/repository/account*' + - 'backend/internal/repository/*group*' + - 'backend/migrations/*oauth_degradation*' + - 'frontend/src/i18n/locales/*/autoConfig.ts' + - '.github/workflows/oauth-degradation-native-controls.yml' pull_request: branches: [production] paths: diff --git a/.github/workflows/oauth-initial-model-selection.yml b/.github/workflows/oauth-initial-model-selection.yml index b766fab90ffd..c166ac0137bc 100644 --- a/.github/workflows/oauth-initial-model-selection.yml +++ b/.github/workflows/oauth-initial-model-selection.yml @@ -1,7 +1,6 @@ name: OAuth initial model selection on: - push: - branches: [feat/oauth-initial-model-selection] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/*model*' diff --git a/.github/workflows/oauth-initial-ws-evidence.yml b/.github/workflows/oauth-initial-ws-evidence.yml index 037f1cea7a93..f3d73c4aad88 100644 --- a/.github/workflows/oauth-initial-ws-evidence.yml +++ b/.github/workflows/oauth-initial-ws-evidence.yml @@ -1,7 +1,6 @@ name: OAuth initial WS rendered evidence on: - push: - branches: [feat/oauth-initial-ws-settings-20261109, fix/debug-fallback-account-picker-20261111] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/oauth-initial-ws.yml b/.github/workflows/oauth-initial-ws.yml index 94772b8f3382..7906f1932a15 100644 --- a/.github/workflows/oauth-initial-ws.yml +++ b/.github/workflows/oauth-initial-ws.yml @@ -9,7 +9,6 @@ on: - 'frontend/src/api/admin/autoConfig.ts' - 'frontend/src/views/admin/AutoConfigView.vue' - 'frontend/src/views/admin/__tests__/AutoConfigView.spec.ts' - - 'frontend/src/constants/newFeatureNotices.ts' - 'frontend/src/i18n/locales/*/autoConfig.ts' - '.github/workflows/oauth-initial-ws.yml' workflow_dispatch: diff --git a/.github/workflows/openai-legacy-admission.yml b/.github/workflows/openai-legacy-admission.yml index 39b5d70df50c..a92a32845ad8 100644 --- a/.github/workflows/openai-legacy-admission.yml +++ b/.github/workflows/openai-legacy-admission.yml @@ -1,14 +1,7 @@ name: OpenAI legacy admission binding on: - push: - branches: [fix/pr756-legacy-admission-followup-20261110] - paths: - - 'backend/internal/service/openai_account_scheduler.go' - - 'backend/internal/service/openai_gateway_scheduling.go' - - 'backend/internal/service/openai_legacy_admission_rebind_test.go' - - 'backend/internal/repository/gateway_cache_legacy_admission_test.go' - - '.github/workflows/openai-legacy-admission.yml' + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/openai-multi-auth.yml b/.github/workflows/openai-multi-auth.yml index 48abe95f8976..ebd6576c9600 100644 --- a/.github/workflows/openai-multi-auth.yml +++ b/.github/workflows/openai-multi-auth.yml @@ -1,8 +1,7 @@ name: OpenAI multi-connection contract on: - push: - branches: [feat/openai-multi-auth-connections] + workflow_dispatch: pull_request: branches: [production] paths: ['backend/**', 'frontend/**', '.github/workflows/openai-multi-auth.yml'] diff --git a/.github/workflows/openai-sse-delivery.yml b/.github/workflows/openai-sse-delivery.yml index 812d9a842acf..ae14ac5d3019 100644 --- a/.github/workflows/openai-sse-delivery.yml +++ b/.github/workflows/openai-sse-delivery.yml @@ -13,12 +13,10 @@ on: - 'frontend/src/components/admin/usage/**' - 'frontend/src/components/common/**' - 'frontend/src/stores/newFeatureNotices.ts' - - 'frontend/src/constants/newFeatureNotices.ts' - 'frontend/src/views/admin/UsageView.vue' - 'frontend/src/views/admin/__tests__/UsageView.spec.ts' - 'frontend/src/__tests__/integration/usage-reasoning-effort.spec.ts' - 'frontend/src/i18n/locales/*/requestTiming.ts' - - 'frontend/src/types/index.ts' - 'deploy/config.example.yaml' - 'deploy/docker-compose*.yml' - 'deploy/.env.example' diff --git a/.github/workflows/pr598-repair-regression.yml b/.github/workflows/pr598-repair-regression.yml index 20759c9c3c01..e850187a14ef 100644 --- a/.github/workflows/pr598-repair-regression.yml +++ b/.github/workflows/pr598-repair-regression.yml @@ -1,8 +1,7 @@ name: PR598 repair regression on: - push: - branches: [feat/priority-scheduling-latency-sticky] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/priority*' diff --git a/.github/workflows/pr838-ui-acceptance.yml b/.github/workflows/pr838-ui-acceptance.yml index e13075f51430..cab87e34d0af 100644 --- a/.github/workflows/pr838-ui-acceptance.yml +++ b/.github/workflows/pr838-ui-acceptance.yml @@ -5,7 +5,6 @@ on: paths: - 'frontend/src/components/account/**' - 'frontend/src/stores/newFeatureNotices.ts' - - 'frontend/src/constants/newFeatureNotices.ts' - '.github/fixtures/pr838-ui/**' - '.github/scripts/pr838-ui-*.mjs' - '.github/workflows/pr838-ui-acceptance.yml' diff --git a/.github/workflows/priority-observation.yml b/.github/workflows/priority-observation.yml index f7a777c72e07..6b9f11965a51 100644 --- a/.github/workflows/priority-observation.yml +++ b/.github/workflows/priority-observation.yml @@ -1,7 +1,6 @@ name: Priority observation regression on: - push: - branches: [fix/priority-observation-identity] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/priority*' diff --git a/.github/workflows/quality-jev-judge.yml b/.github/workflows/quality-jev-judge.yml index 6b4b81b55d6d..299a00c41b67 100644 --- a/.github/workflows/quality-jev-judge.yml +++ b/.github/workflows/quality-jev-judge.yml @@ -1,7 +1,6 @@ name: Quality Jev exact-head regression on: - push: - branches: [feat/quality-jev-judge] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/quality_judge*' diff --git a/.github/workflows/quality-live-regressions.yml b/.github/workflows/quality-live-regressions.yml index 48c2e9774c59..fa3e5e039e8c 100644 --- a/.github/workflows/quality-live-regressions.yml +++ b/.github/workflows/quality-live-regressions.yml @@ -1,7 +1,6 @@ name: Quality live regressions on: - push: - branches: [fix/quality-operations-live-regressions] + workflow_dispatch: pull_request: paths: - 'backend/internal/service/quality*' diff --git a/.github/workflows/quality-orphan-removal.yml b/.github/workflows/quality-orphan-removal.yml index e44b2b499742..f5710376a31c 100644 --- a/.github/workflows/quality-orphan-removal.yml +++ b/.github/workflows/quality-orphan-removal.yml @@ -1,7 +1,6 @@ name: Quality orphan model removal on: - push: - branches: [fix/quality-orphan-isolation-release] + workflow_dispatch: pull_request: paths: - 'backend/internal/**/quality*' diff --git a/.github/workflows/quality-ownership-ui.yml b/.github/workflows/quality-ownership-ui.yml index 4551ad9aa850..c1f519e204e2 100644 --- a/.github/workflows/quality-ownership-ui.yml +++ b/.github/workflows/quality-ownership-ui.yml @@ -1,7 +1,6 @@ name: Quality ownership offline UI on: - push: - branches: [fix/quality-template-switch-conflicts] + workflow_dispatch: pull_request: paths: - 'frontend/src/components/admin/operations/QualityOwnershipReview.vue' diff --git a/.github/workflows/quality-rule152.yml b/.github/workflows/quality-rule152.yml index 8e8425db3719..c1f8a4e43010 100644 --- a/.github/workflows/quality-rule152.yml +++ b/.github/workflows/quality-rule152.yml @@ -1,7 +1,6 @@ name: Quality rule152 account saves on: - push: - branches: [fix/quality-operations-live-regressions] + workflow_dispatch: pull_request: paths: - 'backend/internal/repository/account_repo.go' diff --git a/.github/workflows/quality-template-complete.yml b/.github/workflows/quality-template-complete.yml index 41b2e7db1e16..878877459033 100644 --- a/.github/workflows/quality-template-complete.yml +++ b/.github/workflows/quality-template-complete.yml @@ -1,7 +1,6 @@ name: Quality complete template roundtrip on: - push: - branches: [fix/quality-orphan-isolation-release] + workflow_dispatch: pull_request: paths: - 'backend/internal/**/quality*' diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.yml index 2b5ef743962a..af197d516eee 100644 --- a/.github/workflows/security-scan.yml +++ b/.github/workflows/security-scan.yml @@ -16,12 +16,35 @@ concurrency: permissions: contents: read + actions: read env: EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} jobs: + changes: + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + backend-security: ${{ steps.select.outputs['backend-security'] }} + frontend-security: ${{ steps.select.outputs['frontend-security'] }} + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - name: Install selector dependency + run: python3 -m pip install PyYAML==6.0.3 + - name: Select affected checks + id: select + env: + GH_TOKEN: ${{ github.token }} + run: python3 .github/ci/select_jobs.py security-scan.yml + backend-security: + needs: changes + if: needs.changes.outputs['backend-security'] == 'true' runs-on: ubuntu-latest timeout-minutes: 15 steps: @@ -46,6 +69,8 @@ jobs: govulncheck ./... frontend-security: + needs: changes + if: needs.changes.outputs['frontend-security'] == 'true' runs-on: ${{ vars.SUB2API_SUPPLEMENTARY_RUNNER || 'ubuntu-latest' }} steps: - uses: actions/checkout@v6 diff --git a/.github/workflows/serverless-ip-routing.yml b/.github/workflows/serverless-ip-routing.yml index 8774d92ab280..36e014da12d9 100644 --- a/.github/workflows/serverless-ip-routing.yml +++ b/.github/workflows/serverless-ip-routing.yml @@ -6,7 +6,6 @@ on: paths: - 'backend/internal/serverless/**' - 'frontend/src/components/settings/ServerlessSettings*' - - 'frontend/src/constants/newFeatureNotices.ts' - 'frontend/src/views/admin/SettingsView.vue' - 'frontend/src/views/admin/__tests__/SettingsView.spec.ts' - '.github/scripts/serverless-ip-routing-screenshot.mjs' diff --git a/.github/workflows/smart-ops-sidebar-evidence.yml b/.github/workflows/smart-ops-sidebar-evidence.yml index 3132bc601465..8799f202868e 100644 --- a/.github/workflows/smart-ops-sidebar-evidence.yml +++ b/.github/workflows/smart-ops-sidebar-evidence.yml @@ -1,7 +1,6 @@ name: Smart ops sidebar rendered evidence on: - push: - branches: [fix/smart-ops-default-six-20261109] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/upstream-account-types-evidence.yml b/.github/workflows/upstream-account-types-evidence.yml index 898cc164cbf7..09db02d1d7f1 100644 --- a/.github/workflows/upstream-account-types-evidence.yml +++ b/.github/workflows/upstream-account-types-evidence.yml @@ -1,7 +1,6 @@ name: Upstream account types rendered evidence on: - push: - branches: [feat/upstream-model-sync-account-types-20261109] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/upstream-channel-entities-regression.yml b/.github/workflows/upstream-channel-entities-regression.yml index 7740c963fa89..ddac4e0c2ca9 100644 --- a/.github/workflows/upstream-channel-entities-regression.yml +++ b/.github/workflows/upstream-channel-entities-regression.yml @@ -1,7 +1,5 @@ name: Upstream channel entities regression on: - push: - branches: [feat/profit-url-channel-remarks] pull_request: paths: - '**/upstream_channels*' diff --git a/.github/workflows/vip-auto-credit.yml b/.github/workflows/vip-auto-credit.yml index cf85edc6516a..60e074e7c739 100644 --- a/.github/workflows/vip-auto-credit.yml +++ b/.github/workflows/vip-auto-credit.yml @@ -12,8 +12,30 @@ concurrency: permissions: contents: read + actions: read jobs: + changes: + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + postgres-repository: ${{ steps.select.outputs['postgres-repository'] }} + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + - name: Install selector dependency + run: python3 -m pip install PyYAML==6.0.3 + - name: Select affected checks + id: select + env: + GH_TOKEN: ${{ github.token }} + run: python3 .github/ci/select_jobs.py vip-auto-credit.yml + postgres-repository: + needs: changes + if: needs.changes.outputs['postgres-repository'] == 'true' runs-on: ubuntu-latest timeout-minutes: 25 services: diff --git a/.github/workflows/vip-credit-email-ui.yml b/.github/workflows/vip-credit-email-ui.yml index 19e8e369c8e5..ab053b108c9f 100644 --- a/.github/workflows/vip-credit-email-ui.yml +++ b/.github/workflows/vip-credit-email-ui.yml @@ -1,7 +1,6 @@ name: VIP credit email UI and production builds on: - push: - branches: [feat/vip-credit-email] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/.github/workflows/vip-credit-production-ui.yml b/.github/workflows/vip-credit-production-ui.yml index ead95627d737..833ebeffab48 100644 --- a/.github/workflows/vip-credit-production-ui.yml +++ b/.github/workflows/vip-credit-production-ui.yml @@ -1,7 +1,6 @@ name: VIP collection production UI on: - push: - branches: [fix/vip-receipt-overlay-20261113] + workflow_dispatch: pull_request: branches: [production] paths: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 65e1103cb8fd..d6465d872329 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -215,6 +215,8 @@ pnpm --dir frontend run dev ### CI 工作流维护 +主 CI 按[改动范围与成功证据](.github/ci/README.md)选择 job;未变化部分不重复执行。纯文档或触发规则改动不跑应用全量检查,手动/tag/定时验证保留全量入口。 + 主前端 CI 固定使用 GitHub 托管的 `ubuntu-latest`,通过 `NODE_OPTIONS=--max-old-space-size=6144` 为类型检查和关键测试提供 6 GiB Node 堆上限。`SUB2API_SUPPLEMENTARY_RUNNER` 仅用于发布辅助、Prism adapter 和前端安全检查,不再影响主前端任务的运行位置。 主 CI、安全扫描、多机部署验收和 VIP 入账回归在 PR、`production` 推送及 `v*` tag 上运行,也支持手动触发;功能分支推送由 PR 检查覆盖,避免同一提交重复运行这些检查。新的 PR 提交会取消该 PR 旧提交的同名工作流,production/tag 验证不主动取消。