This is an automated email from the ASF dual-hosted git repository. harishgokul01 pushed a commit to branch development in repository https://gitbox.apache.org/repos/asf/incubator-resilientdb.git
commit bf9a7f263b9d559e068e8471d5dfe28ec116981c Author: harish876 <[email protected]> AuthorDate: Tue Jan 20 00:13:56 2026 +0000 ResLens Vercel deployment - Workflow Test --- .github/deploy-ecosystem-configs.yml | 46 ++++++ .github/workflows/deploy-ecosystem.yml | 204 +++++++++++++++++++++++++ ecosystem/monitoring/reslens/.gitignore | 3 +- ecosystem/monitoring/reslens/package-lock.json | 35 +++++ ecosystem/monitoring/reslens/package.json | 1 + ecosystem/monitoring/reslens/vercel.json | 8 - ecosystem/monitoring/reslens/vercel.ts | 27 ++++ 7 files changed, 315 insertions(+), 9 deletions(-) diff --git a/.github/deploy-ecosystem-configs.yml b/.github/deploy-ecosystem-configs.yml new file mode 100644 index 00000000..35ca20a7 --- /dev/null +++ b/.github/deploy-ecosystem-configs.yml @@ -0,0 +1,46 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Configuration for Vercel deployments from ecosystem folder +# Add projects here to enable automatic deployment + +projects: + - name: reslens + path: ecosystem/monitoring/reslens + # Vercel project configuration (optional) + # If vercel_project_id is specified, uses existing project + # If not specified, Vercel will create a new project on first deploy + # vercel_org_id: your-org-id # Optional: defaults to VERCEL_ORG_ID secret + vercel_project_id: prj_g5KA6QQ36ltVydRW6TUKJhgdgYjT # Optional: existing Vercel project ID + # Optional: override default branch trigger + # branches: + # - main + # - master + # - development + # Optional: additional paths to monitor for changes + # additional_paths: + # - ecosystem/shared/** + # Optional: project-specific environment variables + # env: + # - name: CUSTOM_VAR + # value: custom_value + + # Add more projects here: + # - name: another-project + # path: ecosystem/another/project diff --git a/.github/workflows/deploy-ecosystem.yml b/.github/workflows/deploy-ecosystem.yml new file mode 100644 index 00000000..12a8de2a --- /dev/null +++ b/.github/workflows/deploy-ecosystem.yml @@ -0,0 +1,204 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +name: Deploy Ecosystem Projects to Vercel + +on: + push: + branches: + - development + paths: + - 'ecosystem/**' + - '.github/workflows/deploy-ecosystem.yml' + - '.github/deploy-ecosystem-configs.yml' + workflow_dispatch: + inputs: + project_name: + description: 'Specific project to deploy (leave empty to deploy all changed projects)' + required: false + type: string + force_deploy_all: + description: 'Force deploy all projects regardless of changes' + required: false + type: boolean + default: false + +jobs: + determine-projects: + name: Determine Projects to Deploy + runs-on: ubuntu-latest + outputs: + projects: ${{ steps.filter.outputs.projects }} + projects_json: ${{ steps.filter.outputs.projects_json }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Read deployment config + id: config + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const yaml = require('js-yaml'); + + const configPath = '.github/deploy-ecosystem-configs.yml'; + const configContent = fs.readFileSync(configPath, 'utf8'); + const config = yaml.load(configContent); + + core.setOutput('config', JSON.stringify(config)); + + - name: Filter projects based on changes + id: filter + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { execSync } = require('child_process'); + const config = JSON.parse('${{ steps.config.outputs.config }}'); + + // Manual trigger: deploy specific project or all + if ('${{ github.event_name }}' === 'workflow_dispatch') { + if ('${{ inputs.project_name }}') { + const project = config.projects.find(p => p.name === '${{ inputs.project_name }}'); + if (project) { + core.setOutput('projects_json', JSON.stringify([project])); + core.setOutput('projects', JSON.stringify([project.name])); + return; + } + } + if ('${{ inputs.force_deploy_all }}' === 'true') { + core.setOutput('projects_json', JSON.stringify(config.projects)); + core.setOutput('projects', JSON.stringify(config.projects.map(p => p.name))); + return; + } + } + + // Get changed files (only for push events) + let changedFiles = []; + if ('${{ github.event_name }}' === 'push') { + try { + changedFiles = execSync(`git diff --name-only ${{ github.event.before }} ${{ github.event.after }}`) + .toString().trim().split('\n').filter(Boolean); + } catch (error) { + // If git diff fails, deploy all projects + changedFiles = ['ecosystem/']; + } + } + + // Find projects with changed files, or if workflow/config changed + const workflowChanged = changedFiles.some(f => + f.includes('deploy-ecosystem') || f.includes('deploy-ecosystem-configs') + ); + + const projectsToDeploy = workflowChanged + ? config.projects + : config.projects.filter(project => + changedFiles.some(file => file.startsWith(project.path + '/')) + ); + + core.setOutput('projects_json', JSON.stringify(projectsToDeploy)); + core.setOutput('projects', JSON.stringify(projectsToDeploy.map(p => p.name))); + + - name: Show projects to deploy + run: | + echo "Projects to deploy: ${{ steps.filter.outputs.projects }}" + if [ "${{ steps.filter.outputs.projects }}" == "[]" ]; then + echo "No projects to deploy" + fi + + deploy: + name: Deploy ${{ matrix.project.name }} + needs: determine-projects + if: needs.determine-projects.outputs.projects != '[]' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + project: ${{ fromJson(needs.determine-projects.outputs.projects_json) }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: ${{ matrix.project.path }}/package-lock.json + + - name: Install Vercel CLI + run: npm install --global vercel@latest + + - name: Install dependencies + working-directory: ${{ matrix.project.path }} + run: | + if [ -f "package-lock.json" ]; then + npm ci + elif [ -f "yarn.lock" ]; then + yarn install --frozen-lockfile + elif [ -f "pnpm-lock.yaml" ]; then + pnpm install --frozen-lockfile + else + echo "No lockfile found, using npm install" + npm install + fi + + - name: Pull Vercel Environment Information + working-directory: ${{ matrix.project.path }} + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ matrix.project.vercel_org_id || secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ matrix.project.vercel_project_id }} + run: | + # Link to existing project if project_id is specified, otherwise let vercel create one + if [ -n "$VERCEL_PROJECT_ID" ] && [ -n "$VERCEL_ORG_ID" ]; then + echo "$VERCEL_ORG_ID" > .vercel/org-id || mkdir -p .vercel && echo "$VERCEL_ORG_ID" > .vercel/org-id + echo "$VERCEL_PROJECT_ID" > .vercel/project-id + fi + vercel pull --yes --environment=production --token=$VERCEL_TOKEN || echo "Could not pull Vercel config, continuing..." + + - name: Build Project + working-directory: ${{ matrix.project.path }} + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ matrix.project.vercel_org_id || secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ matrix.project.vercel_project_id }} + run: | + vercel build --prod --token=$VERCEL_TOKEN + + - name: Deploy to Vercel + working-directory: ${{ matrix.project.path }} + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ matrix.project.vercel_org_id || secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ matrix.project.vercel_project_id }} + run: | + vercel deploy --prebuilt --prod --token=$VERCEL_TOKEN + + - name: Deployment Summary + if: always() + run: | + echo "### Deployment: ${{ matrix.project.name }}" >> $GITHUB_STEP_SUMMARY + echo "- **Path:** ${{ matrix.project.path }}" >> $GITHUB_STEP_SUMMARY + echo "- **Status:** ${{ job.status }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY diff --git a/ecosystem/monitoring/reslens/.gitignore b/ecosystem/monitoring/reslens/.gitignore index 1dcef2d9..400bedc9 100644 --- a/ecosystem/monitoring/reslens/.gitignore +++ b/ecosystem/monitoring/reslens/.gitignore @@ -1,2 +1,3 @@ node_modules -.env \ No newline at end of file +.env +.vercel diff --git a/ecosystem/monitoring/reslens/package-lock.json b/ecosystem/monitoring/reslens/package-lock.json index ae85acda..0eeb097e 100644 --- a/ecosystem/monitoring/reslens/package-lock.json +++ b/ecosystem/monitoring/reslens/package-lock.json @@ -74,6 +74,7 @@ "@types/react-dom": "^18.3.1", "@types/react-gauge-chart": "^0.4.3", "@types/react-slick": "^0.23.13", + "@vercel/config": "^0.0.25", "@vitejs/plugin-react": "^4.3.3", "autoprefixer": "^10.4.20", "eslint": "^9.13.0", @@ -6381,6 +6382,19 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@vercel/config": { + "version": "0.0.25", + "resolved": "https://registry.npmjs.org/@vercel/config/-/config-0.0.25.tgz", + "integrity": "sha512-Z998v8d1ukgfxaOVgf9qz1P4+bvpKuDRPMaEhP2pcn7SaZC6HIjAN5mlX0tLALQD7nUow1spDCdj1EiU/ldbkg==", + "dev": true, + "dependencies": { + "pretty-cache-header": "^1.0.0", + "zod": "^3.22.0" + }, + "bin": { + "config": "dist/cli.js" + } + }, "node_modules/@vitejs/plugin-react": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.3.tgz", @@ -13530,6 +13544,18 @@ "node": ">=4" } }, + "node_modules/pretty-cache-header": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pretty-cache-header/-/pretty-cache-header-1.0.0.tgz", + "integrity": "sha512-xtXazslu25CdnGnUkByU1RoOjK55TqwatJkjjJLg5ZAdz2Lngko/mmaUgeET36P2GMlNwh3fdM7FWBO717pNcw==", + "dev": true, + "dependencies": { + "timestring": "^6.0.0" + }, + "engines": { + "node": ">=12.13" + } + }, "node_modules/prismjs": { "version": "1.29.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", @@ -16774,6 +16800,15 @@ "node": ">=0.6.0" } }, + "node_modules/timestring": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/timestring/-/timestring-6.0.0.tgz", + "integrity": "sha512-wMctrWD2HZZLuIlchlkE2dfXJh7J2KDI9Dwl+2abPYg0mswQHfOAyQW3jJg1pY5VfttSINZuKcXoB3FGypVklA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/tiny-invariant": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", diff --git a/ecosystem/monitoring/reslens/package.json b/ecosystem/monitoring/reslens/package.json index 6db94351..27c775f9 100644 --- a/ecosystem/monitoring/reslens/package.json +++ b/ecosystem/monitoring/reslens/package.json @@ -76,6 +76,7 @@ "@types/react-dom": "^18.3.1", "@types/react-gauge-chart": "^0.4.3", "@types/react-slick": "^0.23.13", + "@vercel/config": "^0.0.25", "@vitejs/plugin-react": "^4.3.3", "autoprefixer": "^10.4.20", "eslint": "^9.13.0", diff --git a/ecosystem/monitoring/reslens/vercel.json b/ecosystem/monitoring/reslens/vercel.json deleted file mode 100644 index 1323cdac..00000000 --- a/ecosystem/monitoring/reslens/vercel.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "rewrites": [ - { - "source": "/(.*)", - "destination": "/index.html" - } - ] -} diff --git a/ecosystem/monitoring/reslens/vercel.ts b/ecosystem/monitoring/reslens/vercel.ts new file mode 100644 index 00000000..15a9f384 --- /dev/null +++ b/ecosystem/monitoring/reslens/vercel.ts @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { routes, type VercelConfig } from '@vercel/config/v1'; + +export const config: VercelConfig = { + framework: 'vite', + rewrites: [ + routes.rewrite('/(.*)', '/index.html'), + ], +};
