add release runtime matrix workflow for DocV fronts

Add the same runtime origin matrix and DOCV_IT guard pattern used in active DocV fronts, with explicit skip when no DocV runtime integration surface is present in this archive repository.
This commit is contained in:
Nicolas Cantu 2026-05-15 11:43:32 +02:00
parent f6094cff4b
commit c5685f61f8

View File

@ -0,0 +1,116 @@
name: docv-front-runtime-release
on:
push:
branches:
- "release/**"
paths:
- "**/src/**"
- "**/package.json"
- "**/package-lock.json"
- ".gitea/workflows/docv-front-runtime-release.yml"
workflow_dispatch:
jobs:
verify-docv-front-runtime-release:
runs-on: ubuntu-latest
environment: docv-integration
strategy:
fail-fast: false
matrix:
origin:
- label: test
value: https://test.enso.4nkweb.com
- label: pprod
value: https://pprod.enso.4nkweb.com
- label: prod
value: https://prod.enso.4nkweb.com
env:
DOCV_IT_API_BASE: ${{ secrets.DOCV_IT_API_BASE }}
DOCV_IT_TOKEN: ${{ secrets.DOCV_IT_TOKEN }}
DOCV_IT_FILE_UID: ${{ secrets.DOCV_IT_FILE_UID }}
DOCV_IT_FOLDER_UID: ${{ secrets.DOCV_IT_FOLDER_UID }}
DOCV_IT_API_VERSION: ${{ secrets.DOCV_IT_API_VERSION }}
DOCV_IT_ORIGIN: ${{ matrix.origin.value }}
DOCV_IT_REQUIRED: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Validate integration environment matrix
run: |
test -n "${DOCV_IT_API_BASE}"
test -n "${DOCV_IT_TOKEN}"
test -n "${DOCV_IT_FILE_UID}"
test -n "${DOCV_IT_FOLDER_UID}"
test -n "${DOCV_IT_API_VERSION}"
test -n "${DOCV_IT_ORIGIN}"
- name: Run DocV runtime integration checks on discovered fronts
run: |
set -euo pipefail
mapfile -t docv_surfaces < <(node <<'NODE'
const { execSync } = require('node:child_process');
const { readFileSync, existsSync } = require('node:fs');
const { dirname } = require('node:path');
const files = execSync('git ls-files "**/package.json"').toString('utf8').trim().split('\n').filter(Boolean);
const surfaceSet = new Set();
for (const packageFile of files) {
if (packageFile.includes('/node_modules/')) continue;
let raw = '';
try {
raw = readFileSync(packageFile, 'utf8');
} catch {
continue;
}
let pkg = null;
try {
pkg = JSON.parse(raw);
} catch {
continue;
}
const scripts = pkg && typeof pkg.scripts === 'object' ? pkg.scripts : {};
const hasRuntimeScripts = Boolean(
scripts['test:docv:integration'] &&
scripts['ci:docv-it-env'] &&
scripts['ci:docv-it-api-version']
);
if (!hasRuntimeScripts) continue;
const root = dirname(packageFile);
const hasDocvSdkIntegrationFile = existsSync(`${root}/src/lib/docv-sdk/api.integration.test.ts`);
const deps = Object.assign({}, pkg.dependencies || {}, pkg.devDependencies || {}, pkg.peerDependencies || {});
const hasDocvSdkDependency = Object.prototype.hasOwnProperty.call(deps, '@4nk/docv-sdk');
if (hasDocvSdkIntegrationFile || hasDocvSdkDependency) {
surfaceSet.add(root);
}
}
const surfaces = Array.from(surfaceSet).sort();
for (const surface of surfaces) {
process.stdout.write(`${surface}\n`);
}
NODE
)
if [[ "${#docv_surfaces[@]}" -eq 0 ]]; then
echo "[docv-front-runtime-release] no docv runtime integration surface found, skip."
exit 0
fi
for surface in "${docv_surfaces[@]}"; do
if [[ ! -f "${surface}/package.json" ]]; then
echo "[docv-front-runtime-release] missing package.json in ${surface}" >&2
exit 1
fi
npm --prefix "${surface}" ci
npm --prefix "${surface}" run ci:docv-it-env
npm --prefix "${surface}" run ci:docv-it-api-version
DOCV_IT_REQUIRED=1 npm --prefix "${surface}" run test:docv:integration
done