163c7ff791
* refactor: replace i18n HTTP requests with build-time bundling - Create translationBundler.ts for build-time translation loading - Replace HTTP fetch in loadTranslations with file system reads - Add CalComVersion cache invalidation to prevent stale translations - Fix TypeScript errors in booking page components - Eliminate 60s timeout issues by removing network dependency Resolves translation timeout issues by bundling translations at build time instead of making runtime HTTP requests to /static/locales/ endpoints. Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: move i18n files back to packages/lib/server with proper imports - Move i18n.ts and translationBundler.ts back to packages/lib/server/ - Replace all relative imports with @calcom/lib/server/i18n pattern - Fix LOCALES_PATH to point to correct directory - Maintain optimized serverless-friendly translation loading Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * refactor: move locale files to packages/lib/server to eliminate circular deps - Move all locale files from apps/web/public/static/locales to packages/lib/server/locales - Create copy-locales-static.js script to copy files during build - Update all references to use new location for build-time access - Maintain public folder copying for Next.js runtime access - Update platform atoms, scripts, and config files - Fix copy script relative path issue Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update test imports after locale refactor - Fix import paths in test files updated by pre-commit hooks - Ensure all tests use correct locale import paths Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: revert import paths from @calcom/web/lib/i18n to @calcom/lib/server/i18n - Revert all test file imports back to @calcom/lib/server/i18n as requested - Addresses GitHub comment feedback to stick with packages/lib/server location - Fixes import paths in 6 test files that were incorrectly changed Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update vite config alias to use new locale path - Update @calcom/web/public/static/locales/en/common.json to @calcom/lib/server/locales/en/common.json - Addresses GitHub comment about updating platform atoms vite config - Maintains correct path resolution after locale files moved to packages/lib/server Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: update translationBundler path resolution for production builds - Use process.cwd() instead of __dirname for locale file path resolution - Ensures locale files can be found in both development and production environments - Fixes E2E test failures caused by missing locale files in .next/server/chunks/ Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: use relative path resolution for locale files in translationBundler - Change from process.cwd() to __dirname with relative paths - Ensures locale files can be found in both development and production environments - Fixes E2E test failures caused by incorrect path resolution in Next.js builds Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: use process.cwd() for locale path resolution in production builds - Change from __dirname to process.cwd() with relative paths - Ensures locale files can be found when bundled into Next.js server chunks - Fixes E2E test failures caused by incorrect path resolution in production environment - Follows same pattern used in getStaticProps.tsx for cross-package file access Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: use path.resolve pattern from sendVerificationRequest for locale access - Change from process.cwd() to path.resolve(process.cwd(), '..', '..', 'packages/lib/server/locales') - Follows same pattern used in sendVerificationRequest.ts for cross-environment file access - Should resolve E2E test failures by ensuring locale files can be found when bundled into Next.js server chunks - Pattern navigates up from current working directory to reach packages directory consistently Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: use dynamic monorepo root detection for locale path resolution - Replace relative path resolution with dynamic monorepo root finder - Ensures locale files can be found from any working directory (root, apps/web, apps/api/v2) - Update API v2 i18n config to use new locale path - Fixes remaining E2E test failures in API v2 and E2E (1/4) test suites Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * fix: use require.resolve(__filename) for robust path resolution in all contexts - Replace __dirname with require.resolve(__filename) in monorepo root detection - Ensures locale files can be found when running from any working directory - Fixes E2E API v2 test failures where __dirname resolves to '.' instead of actual file path Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * Revert "fix: use require.resolve(__filename) for robust path resolution in all contexts" This reverts commit b37d8226000da8f7d5fb98b83dd0e95a53d45372. * fix: update copied locale files after translationBundler path resolution fix - Copy script updated all locale files in public directory - Ensures E2E tests have access to latest locale files - Fixes regression where all E2E tests were failing Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * feat: remove existing locale files to establish copy script as single source of truth - Delete all common.json files from apps/web/public/static/locales/ - Eliminates developer confusion about which files are authoritative - copy-locales-static.js script now clearly the only mechanism for populating public folder - packages/lib/server/locales/ remains the definitive source of truth for translations Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * add comment * refactor: simplify findMonorepoRoot by removing redundant fallback loop - Remove unnecessary second while loop using process.cwd() - The first loop from __dirname will always find the monorepo root - Add clear error message for fail-fast behavior if repo structure is corrupted - Improves code clarity and maintainability Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * feat: integrate updated translations from main branch - Restore all common.json files from main branch to apps/web/public/static/locales/ - Overwrite packages/lib/server/locales/ with up-to-date translation content - Resolve merge conflicts using Benny's safer 2-step approach - Ensure translation source of truth remains in packages/lib/server/locales/ - Complete safer conflict resolution to eliminate merge conflicts on PR #22422 Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * chore: update package.json and yarn.lock after translation integration - Update dependencies after ts-node installation for pre-commit hooks - Ensure yarn.lock reflects current dependency state - Complete translation integration process Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> * feat: remove duplicate locale files from apps/web to establish single source of truth - Delete all common.json files from apps/web/public/static/locales/ - Maintain packages/lib/server/locales/ as the single source of truth for translations - copy-locales-static.js script will populate public folder during build process - Complete Benny's safer 2-step approach: restore from main, then remove duplicates - Resolve merge conflicts and eliminate developer confusion about translation file locations Co-Authored-By: keith@cal.com <keithwillcode@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: hbjORbj <sldisek783@gmail.com>
259 lines
8.8 KiB
YAML
259 lines
8.8 KiB
YAML
name: PR Update
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, synchronize, reopened, labeled]
|
|
branches:
|
|
- main
|
|
- gh-actions-test-branch
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
actions: write
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
name: Detect changes
|
|
runs-on: buildjet-2vcpu-ubuntu-2204
|
|
permissions:
|
|
pull-requests: read
|
|
outputs:
|
|
has-files-requiring-all-checks: ${{ steps.filter.outputs.has-files-requiring-all-checks }}
|
|
commit-sha: ${{ steps.get_sha.outputs.commit-sha }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/dangerous-git-checkout
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
has-files-requiring-all-checks:
|
|
- "!(**.md|.github/CODEOWNERS|docs/**|help/**|packages/lib/server/locales/**/common.json)"
|
|
- name: Get Latest Commit SHA
|
|
id: get_sha
|
|
run: |
|
|
echo "commit-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
|
|
|
check-label:
|
|
needs: [changes]
|
|
runs-on: buildjet-2vcpu-ubuntu-2204
|
|
name: Check for E2E label
|
|
permissions:
|
|
pull-requests: read
|
|
outputs:
|
|
run-e2e: ${{ steps.check-if-pr-has-label.outputs.run-e2e == 'true' && (github.event.action != 'labeled' || github.event.label.name == 'ready-for-e2e') }}
|
|
steps:
|
|
- name: Check if PR exists with ready-for-e2e label for this SHA
|
|
id: check-if-pr-has-label
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
let labels = [];
|
|
|
|
if (context.payload.pull_request) {
|
|
labels = context.payload.pull_request.labels;
|
|
} else {
|
|
try {
|
|
const sha = '${{ needs.changes.outputs.commit-sha }}';
|
|
console.log('sha', sha);
|
|
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
commit_sha: sha
|
|
});
|
|
|
|
if (prs.length === 0) {
|
|
core.setOutput('run-e2e', false);
|
|
console.log(`No pull requests found for commit SHA ${sha}`);
|
|
return;
|
|
}
|
|
|
|
const pr = prs[0];
|
|
console.log(`PR number: ${pr.number}`);
|
|
console.log(`PR title: ${pr.title}`);
|
|
console.log(`PR state: ${pr.state}`);
|
|
console.log(`PR URL: ${pr.html_url}`);
|
|
|
|
labels = pr.labels;
|
|
}
|
|
catch (e) {
|
|
core.setOutput('run-e2e', false);
|
|
console.log(e);
|
|
}
|
|
}
|
|
|
|
const labelFound = labels.map(l => l.name).includes('ready-for-e2e');
|
|
console.log('Found the label?', labelFound);
|
|
core.setOutput('run-e2e', labelFound);
|
|
|
|
deps:
|
|
name: Install dependencies
|
|
needs: [changes, check-label]
|
|
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/yarn-install.yml
|
|
|
|
type-check:
|
|
name: Type check
|
|
needs: [changes, check-label, deps]
|
|
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/check-types.yml
|
|
secrets: inherit
|
|
|
|
lint:
|
|
name: Linters
|
|
needs: [changes, check-label, deps]
|
|
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/lint.yml
|
|
secrets: inherit
|
|
|
|
unit-test:
|
|
name: Tests
|
|
needs: [changes, check-label, deps]
|
|
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/unit-tests.yml
|
|
secrets: inherit
|
|
|
|
build-api-v1:
|
|
name: Production builds
|
|
needs: [changes, check-label, deps]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/api-v1-production-build.yml
|
|
secrets: inherit
|
|
|
|
build-api-v2:
|
|
name: Production builds
|
|
needs: [changes, check-label, deps]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/api-v2-production-build.yml
|
|
secrets: inherit
|
|
|
|
build-atoms:
|
|
name: Production builds
|
|
needs: [changes, check-label, deps]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/atoms-production-build.yml
|
|
secrets: inherit
|
|
|
|
build-docs:
|
|
name: Production builds
|
|
needs: [changes, check-label, deps]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/docs-build.yml
|
|
secrets: inherit
|
|
|
|
build:
|
|
name: Production builds
|
|
needs: [changes, check-label, deps]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/production-build-without-database.yml
|
|
secrets: inherit
|
|
|
|
integration-test:
|
|
name: Tests
|
|
needs: [changes, check-label, build, build-api-v1, build-api-v2]
|
|
if: ${{ needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/integration-tests.yml
|
|
secrets: inherit
|
|
|
|
e2e:
|
|
name: Tests
|
|
needs: [changes, check-label, build, build-api-v1, build-api-v2]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/e2e.yml
|
|
secrets: inherit
|
|
|
|
e2e-api-v2:
|
|
name: Tests
|
|
needs: [changes, check-label, build, build-api-v1, build-api-v2]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/e2e-api-v2.yml
|
|
secrets: inherit
|
|
|
|
e2e-app-store:
|
|
name: Tests
|
|
needs: [changes, check-label, build, build-api-v1, build-api-v2]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/e2e-app-store.yml
|
|
secrets: inherit
|
|
|
|
e2e-embed:
|
|
name: Tests
|
|
needs: [changes, check-label, build, build-api-v1, build-api-v2]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/e2e-embed.yml
|
|
secrets: inherit
|
|
|
|
e2e-embed-react:
|
|
name: Tests
|
|
needs: [changes, check-label, build, build-api-v1, build-api-v2]
|
|
if: ${{ needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
uses: ./.github/workflows/e2e-embed-react.yml
|
|
secrets: inherit
|
|
|
|
analyze:
|
|
name: Analyze Build
|
|
needs: [build]
|
|
uses: ./.github/workflows/nextjs-bundle-analysis.yml
|
|
secrets: inherit
|
|
|
|
merge-reports:
|
|
name: Merge reports
|
|
if: ${{ !cancelled() && needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
needs: [changes, check-label, e2e, e2e-embed, e2e-embed-react, e2e-app-store]
|
|
uses: ./.github/workflows/merge-reports.yml
|
|
secrets: inherit
|
|
|
|
publish-report:
|
|
name: Publish HTML report
|
|
if: ${{ !cancelled() && needs.check-label.outputs.run-e2e == 'true' && needs.changes.outputs.has-files-requiring-all-checks == 'true' }}
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
needs: [changes, check-label, merge-reports]
|
|
uses: ./.github/workflows/publish-report.yml
|
|
secrets: inherit
|
|
|
|
cleanup-report:
|
|
name: Cleanup HTML report
|
|
if: ${{ !cancelled() && needs.check-label.outputs.run-e2e == 'true' && (github.event.pull_request.merged == true || github.event.pull_request.state == 'closed') }}
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
needs: [changes, check-label, publish-report]
|
|
uses: ./.github/workflows/cleanup-report.yml
|
|
secrets: inherit
|
|
|
|
required:
|
|
needs:
|
|
[
|
|
changes,
|
|
lint,
|
|
type-check,
|
|
unit-test,
|
|
integration-test,
|
|
check-label,
|
|
build,
|
|
build-api-v1,
|
|
build-api-v2,
|
|
build-atoms,
|
|
build-docs,
|
|
e2e,
|
|
e2e-api-v2,
|
|
e2e-embed,
|
|
e2e-embed-react,
|
|
e2e-app-store,
|
|
]
|
|
if: always()
|
|
runs-on: buildjet-2vcpu-ubuntu-2204
|
|
steps:
|
|
- name: fail if conditional jobs failed
|
|
if: needs.changes.outputs.has-files-requiring-all-checks == 'true' && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled'))
|
|
run: exit 1
|