name: docv-front-runtime-release on: push: branches: - "release/**" paths: - "**/src/lib/docv-sdk/**" - "**/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 mandatory DocV runtime integration checks on all 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" >&2 exit 1 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