Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cfc6686904 | |||
| 40a6076961 | |||
| 53a4103308 | |||
| ea7bbebb3e |
@@ -5,14 +5,15 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'apps/studio/**'
|
- 'apps/studio/**'
|
||||||
- 'apps/waterfall-wiki/**'
|
- 'apps/waterfall-wiki/**'
|
||||||
- '.gitea/workflows/creative-workspace.yml'
|
- '.gitea/workflows/**'
|
||||||
|
- 'scripts/*studio*'
|
||||||
concurrency:
|
concurrency:
|
||||||
group: creative-workspace-${{ gitea.event.pull_request.number }}
|
group: creative-workspace-${{ gitea.event.pull_request.number }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
verify:
|
verify:
|
||||||
runs-on: ces-control
|
runs-on: ces-control
|
||||||
timeout-minutes: 45
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -21,5 +22,13 @@ jobs:
|
|||||||
run: git diff --check HEAD^ HEAD
|
run: git diff --check HEAD^ HEAD
|
||||||
- name: Verify Studio types, tests, build and smoke
|
- name: Verify Studio types, tests, build and smoke
|
||||||
run: docker build -f apps/studio/Dockerfile -t "creative-studio-review:${{ gitea.sha }}" .
|
run: docker build -f apps/studio/Dockerfile -t "creative-studio-review:${{ gitea.sha }}" .
|
||||||
- name: Verify Wiki types, tests, build and smoke
|
- name: Build Wiki integration and runtime images
|
||||||
run: docker build --target build -f apps/waterfall-wiki/Dockerfile -t "creative-wiki-review:${{ gitea.sha }}" .
|
run: |
|
||||||
|
docker build --target integration -t "creative-wiki-tests:${{ gitea.sha }}" .
|
||||||
|
docker build --target runtime -t "creative-wiki-review:${{ gitea.sha }}" .
|
||||||
|
- name: Verify isolated PostgreSQL, S3 and browser integration
|
||||||
|
env:
|
||||||
|
WATERFALL_WIKI_IMAGE: creative-wiki-review:${{ gitea.sha }}
|
||||||
|
WATERFALL_WIKI_TEST_IMAGE: creative-wiki-tests:${{ gitea.sha }}
|
||||||
|
GITEA_RUN_ID: ${{ gitea.run_id }}
|
||||||
|
run: bash scripts/integration.sh
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
name: studio CI and deployment
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
paths:
|
|
||||||
- 'apps/studio/**'
|
|
||||||
- 'scripts/deploy-studio.sh'
|
|
||||||
- 'scripts/verify-studio-production.sh'
|
|
||||||
- 'scripts/verify-studio-library.mjs'
|
|
||||||
- 'scripts/verify-studio-visual.cjs'
|
|
||||||
- '.gitea/workflows/studio.yml'
|
|
||||||
- 'scripts/*studio*'
|
|
||||||
- 'content/studio-examples/**'
|
|
||||||
- 'content/studio-tools/layouts-api.md'
|
|
||||||
- 'pnpm-workspace.yaml'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
verify-and-deploy:
|
|
||||||
if: gitea.ref == 'refs/heads/main' && gitea.event_name == 'push'
|
|
||||||
runs-on: ces-control
|
|
||||||
timeout-minutes: 45
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Check shared content and documentation contracts
|
|
||||||
run: |
|
|
||||||
node scripts/check-studio-contracts.mjs
|
|
||||||
node --check scripts/export-studio-series.cjs
|
|
||||||
node --check scripts/save-studio-series.mjs
|
|
||||||
bash -n scripts/publish-studio-guide.sh scripts/deliver-studio-series.sh
|
|
||||||
- name: Build and verify studio
|
|
||||||
run: docker build -f apps/studio/Dockerfile -t "prompt-studio:${{ gitea.sha }}" .
|
|
||||||
- name: Release studio
|
|
||||||
if: gitea.ref == 'refs/heads/main' && gitea.event_name == 'push'
|
|
||||||
run: bash scripts/deploy-studio.sh "${{ gitea.sha }}"
|
|
||||||
- name: Verify the deployed Studio API and native pages
|
|
||||||
if: gitea.ref == 'refs/heads/main' && gitea.event_name == 'push'
|
|
||||||
run: bash scripts/verify-studio-production.sh
|
|
||||||
- name: Save server acceptance evidence
|
|
||||||
id: acceptance_evidence
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: studio-production-acceptance
|
|
||||||
path: artifacts/studio-acceptance/
|
|
||||||
if-no-files-found: ignore
|
|
||||||
retention-days: 7
|
|
||||||
- name: Remove temporary acceptance output after upload
|
|
||||||
if: always() && steps.acceptance_evidence.outcome == 'success'
|
|
||||||
run: rm -rf artifacts/studio-acceptance
|
|
||||||
@@ -1,9 +1,13 @@
|
|||||||
name: waterfall-wiki CI and deployment
|
name: creative workspace CI and deployment
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- 'apps/waterfall-wiki/**'
|
- 'apps/waterfall-wiki/**'
|
||||||
|
- 'apps/studio/**'
|
||||||
|
- 'scripts/*studio*'
|
||||||
|
- 'content/studio-examples/**'
|
||||||
|
- 'content/studio-tools/layouts-api.md'
|
||||||
- '.gitea/workflows/waterfall-wiki.yml'
|
- '.gitea/workflows/waterfall-wiki.yml'
|
||||||
- 'Dockerfile'
|
- 'Dockerfile'
|
||||||
- 'compose.yml'
|
- 'compose.yml'
|
||||||
@@ -18,11 +22,19 @@ jobs:
|
|||||||
verify-and-deploy:
|
verify-and-deploy:
|
||||||
if: gitea.ref == 'refs/heads/main' && gitea.event_name == 'push'
|
if: gitea.ref == 'refs/heads/main' && gitea.event_name == 'push'
|
||||||
runs-on: ces-control
|
runs-on: ces-control
|
||||||
timeout-minutes: 45
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- name: Check shared content and documentation contracts
|
||||||
|
run: |
|
||||||
|
node scripts/check-studio-contracts.mjs
|
||||||
|
node --check scripts/export-studio-series.cjs
|
||||||
|
node --check scripts/save-studio-series.mjs
|
||||||
|
bash -n scripts/publish-studio-guide.sh scripts/deliver-studio-series.sh
|
||||||
|
- name: Build and verify Studio
|
||||||
|
run: docker build -f apps/studio/Dockerfile -t "prompt-studio:${{ gitea.sha }}" .
|
||||||
- name: Build, verify, deploy and retain wiki images
|
- name: Build, verify, deploy and retain wiki images
|
||||||
env:
|
env:
|
||||||
RELEASE_SHA: ${{ gitea.sha }}
|
RELEASE_SHA: ${{ gitea.sha }}
|
||||||
@@ -32,3 +44,19 @@ jobs:
|
|||||||
else
|
else
|
||||||
sudo -n python3 scripts/wiki-image-lifecycle.py ci --sha "$RELEASE_SHA"
|
sudo -n python3 scripts/wiki-image-lifecycle.py ci --sha "$RELEASE_SHA"
|
||||||
fi
|
fi
|
||||||
|
- name: Release Studio after Wiki routes are deployed
|
||||||
|
run: bash scripts/deploy-studio.sh "${{ gitea.sha }}"
|
||||||
|
- name: Verify the deployed creative workspace
|
||||||
|
run: bash scripts/verify-studio-production.sh
|
||||||
|
- name: Save server acceptance evidence
|
||||||
|
id: acceptance_evidence
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: studio-production-acceptance
|
||||||
|
path: artifacts/studio-acceptance/
|
||||||
|
if-no-files-found: ignore
|
||||||
|
retention-days: 7
|
||||||
|
- name: Remove temporary acceptance output after upload
|
||||||
|
if: always() && steps.acceptance_evidence.outcome == 'success'
|
||||||
|
run: rm -rf artifacts/studio-acceptance
|
||||||
|
|||||||
@@ -81,14 +81,14 @@ bash -n scripts/deploy.sh scripts/integration.sh scripts/deploy-studio.sh
|
|||||||
|
|
||||||
## 部署与持久化
|
## 部署与持久化
|
||||||
|
|
||||||
Gitea 工作流按应用路径触发:`waterfall-wiki.yml`、`studio.yml` 和 `python.yml`。waterfall-wiki 完成类型检查、单元测试、生产构建、冒烟和真实 PostgreSQL/S3 集成测试后部署;Studio 独立构建和部署。文档与作者数据本身不触发应用部署。
|
Web 应用由 `waterfall-wiki.yml` 统一发布,两个应用的路径都能触发它:先检查并构建 Studio,再完成 Wiki 的类型检查、单元测试、生产构建、冒烟及隔离 PostgreSQL/S3 集成测试并部署 Wiki,随后部署 Studio,最后在指定服务器验收。顺序在同一个 ces-control 作业内保证,避免独立作业互相等待。PR 检查也运行隔离集成测试,但不部署。Python 检查仍由 `python.yml` 承担;文档与作者数据本身不触发应用部署。
|
||||||
|
|
||||||
| 服务 | 入口/端口 |
|
| 服务 | 入口/端口 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `waterfall-wiki` | 公网 `18131`,也是 Studio 的统一入口 |
|
| `waterfall-wiki` | 公网 `18131`,也是 Studio 的统一入口 |
|
||||||
| PostgreSQL | `127.0.0.1:18132` |
|
| PostgreSQL | `127.0.0.1:18132` |
|
||||||
| 对象存储 | `127.0.0.1:18133` |
|
| 对象存储 | `127.0.0.1:18133` |
|
||||||
| Studio | `127.0.0.1:18134`;公网通过 `/studio` 代理 |
|
| Studio | `127.0.0.1:18134`;编辑器公网入口为 `/graphic`、`/infinite_canvas`,资源和 API 保留 `/studio` 代理 |
|
||||||
| Python | 无网络端口,按需运行 |
|
| Python | 无网络端口,按需运行 |
|
||||||
|
|
||||||
生产 Compose 项目仍为 `prompt`,部署根目录仍为 `/opt/prompt`。既有 `prompt_postgres_data`、`prompt_objects`、`prompt_auth_data` 卷与数据库身份保留;应用更名不会重新创建一套空存储。Compose 应用服务改为 `waterfall-wiki` 和 `waterfall-wiki-worker`,镜像参数为 `WATERFALL_WIKI_IMAGE` / `WATERFALL_WIKI_TEST_IMAGE`。
|
生产 Compose 项目仍为 `prompt`,部署根目录仍为 `/opt/prompt`。既有 `prompt_postgres_data`、`prompt_objects`、`prompt_auth_data` 卷与数据库身份保留;应用更名不会重新创建一套空存储。Compose 应用服务改为 `waterfall-wiki` 和 `waterfall-wiki-worker`,镜像参数为 `WATERFALL_WIKI_IMAGE` / `WATERFALL_WIKI_TEST_IMAGE`。
|
||||||
|
|||||||
@@ -30,12 +30,17 @@ export async function verifyGuidancePublishing(base:string){
|
|||||||
const own=await fetch(base+'/api/documents?author='+owner).then(r=>r.json());assert.ok(own.documents.some((d:{id:string})=>d.id===httpDoc.id));assert.ok(own.documents.every((d:{author:string})=>d.author===owner));assert.equal((await fetch(base+'/api/documents?author=invalid')).status,400);
|
const own=await fetch(base+'/api/documents?author='+owner).then(r=>r.json());assert.ok(own.documents.some((d:{id:string})=>d.id===httpDoc.id));assert.ok(own.documents.every((d:{author:string})=>d.author===owner));assert.equal((await fetch(base+'/api/documents?author=invalid')).status,400);
|
||||||
const xml=await fetch(base+'/api/documents/'+httpDoc.id+'?revision=1&format=xml');assert.equal(xml.status,200);assert.match(await xml.text(),/<tag>往返标签<\/tag>/);
|
const xml=await fetch(base+'/api/documents/'+httpDoc.id+'?revision=1&format=xml');assert.equal(xml.status,200);assert.match(await xml.text(),/<tag>往返标签<\/tag>/);
|
||||||
const page=await fetch(base+'/documents/'+httpDoc.id+'?revision=1');assert.equal(page.status,200);assert.ok((await page.text()).includes('实际数据库文档'));
|
const page=await fetch(base+'/documents/'+httpDoc.id+'?revision=1');assert.equal(page.status,200);assert.ok((await page.text()).includes('实际数据库文档'));
|
||||||
// The homepage and discovery list hydrate from the real API, so verify them in Chromium on the CI runner.
|
// The document discovery list hydrates from the real API; the homepage is the product landing page.
|
||||||
const browser=await chromium.launch({executablePath:process.env.CHROMIUM_PATH||'/usr/bin/chromium',headless:true,args:['--no-sandbox','--disable-dev-shm-usage']});
|
const browser=await chromium.launch({executablePath:process.env.CHROMIUM_PATH||'/usr/bin/chromium',headless:true,args:['--no-sandbox','--disable-dev-shm-usage']});
|
||||||
try{
|
try{
|
||||||
const page=await browser.newPage();
|
const page=await browser.newPage();
|
||||||
|
const navigationDiagnostics:string[]=[];
|
||||||
|
const record=(value:string)=>{navigationDiagnostics.push(value.slice(0,1800));if(navigationDiagnostics.length>12)navigationDiagnostics.shift();};
|
||||||
|
page.on('pageerror',error=>record('pageerror: '+error.message));
|
||||||
|
page.on('console',message=>{if(message.type()==='error')record('console: '+message.text());});
|
||||||
|
page.on('response',response=>{if(response.url().includes('/_next/data/'))void response.text().then(body=>record(`data ${response.status()} ${new URL(response.url()).pathname}: ${body.slice(0,1400)}`)).catch(()=>{});});
|
||||||
const link=`a[href="/documents/${httpDoc.id}?revision=1"]`;
|
const link=`a[href="/documents/${httpDoc.id}?revision=1"]`;
|
||||||
await page.goto(base+'/',{waitUntil:'domcontentloaded'});
|
await page.goto(base+'/documents',{waitUntil:'domcontentloaded'});
|
||||||
await page.locator(link).waitFor({state:'visible'});assert.equal(await page.locator(link).getByRole('heading').textContent(),httpDoc.title);
|
await page.locator(link).waitFor({state:'visible'});assert.equal(await page.locator(link).getByRole('heading').textContent(),httpDoc.title);
|
||||||
// Published matches must not inherit the examples' empty state; submitted filters survive reload.
|
// Published matches must not inherit the examples' empty state; submitted filters survive reload.
|
||||||
const search=page.getByRole('textbox',{name:'搜索文档'});
|
const search=page.getByRole('textbox',{name:'搜索文档'});
|
||||||
@@ -54,7 +59,11 @@ export async function verifyGuidancePublishing(base:string){
|
|||||||
await page.locator(link).waitFor({state:'visible'});
|
await page.locator(link).waitFor({state:'visible'});
|
||||||
assert.equal(await search.inputValue(),'');
|
assert.equal(await search.inputValue(),'');
|
||||||
await page.getByRole('navigation',{name:'主导航',exact:true}).getByRole('link',{name:'社区文档',exact:true}).click();await page.locator(link).waitFor({state:'visible'});
|
await page.getByRole('navigation',{name:'主导航',exact:true}).getByRole('link',{name:'社区文档',exact:true}).click();await page.locator(link).waitFor({state:'visible'});
|
||||||
await page.locator(link).click();await page.locator('h1').waitFor();assert.equal(await page.locator('h1').textContent(),httpDoc.title);
|
await page.locator(link).click();
|
||||||
|
await page.waitForURL(url=>url.pathname==='/documents/'+httpDoc.id&&url.searchParams.get('revision')==='1');
|
||||||
|
try{await page.getByRole('heading',{name:httpDoc.title,exact:true}).waitFor();}
|
||||||
|
catch(error){console.error('Document navigation diagnostics',JSON.stringify({url:page.url(),headings:await page.locator('h1').allTextContents(),events:navigationDiagnostics}));throw error;}
|
||||||
|
assert.equal(await page.locator('h1').textContent(),httpDoc.title);
|
||||||
await page.goto(base+'/write',{waitUntil:'domcontentloaded'});assert.equal(await page.locator('h1').textContent(),'发布独立文档');
|
await page.goto(base+'/write',{waitUntil:'domcontentloaded'});assert.equal(await page.locator('h1').textContent(),'发布独立文档');
|
||||||
}finally{await browser.close();}
|
}finally{await browser.close();}
|
||||||
assert.equal((await request('/'+httpDoc.id,'DELETE',undefined,{cookie:''})).status,401);
|
assert.equal((await request('/'+httpDoc.id,'DELETE',undefined,{cookie:''})).status,401);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ flock -w 300 9
|
|||||||
latest=$(git -c safe.directory="$PWD" ls-remote origin refs/heads/main | cut -f1)
|
latest=$(git -c safe.directory="$PWD" ls-remote origin refs/heads/main | cut -f1)
|
||||||
if [ "$latest" != "$sha" ]; then
|
if [ "$latest" != "$sha" ]; then
|
||||||
git -c safe.directory="$PWD" fetch origin main
|
git -c safe.directory="$PWD" fetch origin main
|
||||||
git -c safe.directory="$PWD" diff --quiet "$sha" origin/main -- apps/studio scripts/deploy-studio.sh .gitea/workflows/studio.yml pnpm-workspace.yaml || exit 0
|
git -c safe.directory="$PWD" diff --quiet "$sha" origin/main -- apps/studio scripts/deploy-studio.sh .gitea/workflows/waterfall-wiki.yml pnpm-workspace.yaml || exit 0
|
||||||
fi
|
fi
|
||||||
mkdir -p /opt/prompt-studio
|
mkdir -p /opt/prompt-studio
|
||||||
previous=$(cat /opt/prompt-studio/image 2>/dev/null || true)
|
previous=$(cat /opt/prompt-studio/image 2>/dev/null || true)
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Run on ces-control after deployment; never starts a preview web server.
|
# Run on ces-control after deployment; never starts a preview web server.
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
# Wiki and Studio deploy independently; wait for Wiki's canonical route proxy.
|
# The shared release job deploys Wiki before Studio; a missing route is an error,
|
||||||
canonical_ready=false
|
# not a reason to occupy this runner while another queued job tries to deploy it.
|
||||||
for attempt in {1..120}; do
|
if ! curl -fsS http://8.211.154.134:18131/ | grep -q '想法不该停在对话里'; then
|
||||||
if curl -fsS http://8.211.154.134:18131/ | grep -q '想法不该停在对话里'; then canonical_ready=true; break; fi
|
echo 'The shared release has not deployed the Wiki landing and canonical routes'
|
||||||
sleep 5
|
exit 1
|
||||||
done
|
fi
|
||||||
$canonical_ready || { echo 'Wiki landing and canonical route release is not ready'; exit 1; }
|
|
||||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||||
RESULT_DIR="$REPO_ROOT/artifacts/studio-acceptance"
|
RESULT_DIR="$REPO_ROOT/artifacts/studio-acceptance"
|
||||||
MODE=${1:-verify}
|
MODE=${1:-verify}
|
||||||
|
|||||||
Reference in New Issue
Block a user