Skip to content

Commit

Permalink
Merge branch 'develop' into wip/db/11478-build-ydoc-on-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
4e6 committed Nov 26, 2024
2 parents 0f038df + cf85c0b commit 9cec1c4
Show file tree
Hide file tree
Showing 318 changed files with 5,952 additions and 5,630 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/gui-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,18 @@ jobs:
continue-on-error: true
run: pnpm run ci:test

- name: 💾 Save cache
uses: actions/cache/save@v4
if: always() && steps.cache.outputs.cache-hit != 'true'
id: save-cache
with:
key: ${{ steps.cache.outputs.cache-primary-key }}
path: |
**/.eslintcache
node_modules/.cache/prettier
- name: 📝 Annotate Code Linting Results
if: always()
continue-on-error: true
uses: ataylorme/eslint-annotate-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
report-json: "./**/eslint_report.json"
markdown-report-on-step-summary: true
check-name: 🧹 GUI Lint Results
only-pr-files: false
fail-on-error: false
fail-on-warning: false

- name: ❌ Fail if any check failed
if: always() && (steps.prettier.outcome == 'failure' || steps.lint.outcome == 'failure' || steps.typecheck.outcome == 'failure' || steps.unit-tests.outcome == 'failure')
Expand All @@ -99,6 +94,16 @@ jobs:
echo "Unit tests outcome: ${{ steps.unit-tests.outcome }}"
exit 1
- name: 💾 Save cache
uses: actions/cache/save@v4
if: always() && steps.cache.outputs.cache-hit != 'true'
id: save-cache
with:
key: ${{ steps.cache.outputs.cache-primary-key }}
path: |
**/.eslintcache
node_modules/.cache/prettier
playwright:
name: 🎭 Playwright Tests
env:
Expand Down Expand Up @@ -186,7 +191,7 @@ jobs:

- name: 🔗 Merge into HTML Report
working-directory: app/gui
run: pnpm playwright merge-reports --reporter html ./blob-report
run: pnpm playwright merge-reports --reporter=html,github ./blob-report

- name: ⬆️ Upload HTML report
uses: actions/upload-artifact@v4
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/gui-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ permissions:
jobs:
changed-files:
runs-on: ubuntu-latest
name: 🔍 Detect changed files in GUI
name: 🔍 GUI files changed
outputs:
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
any_changed: ${{ steps.changed-files.outputs.any_changed }}
Expand All @@ -43,6 +43,7 @@ jobs:
.prettierrc.js
.prettierignore
vitest.workspace.ts
.github/workflows/gui*
files_ignore: |
app/ide-desktop/**
app/gui/scripts/**
Expand Down Expand Up @@ -74,10 +75,18 @@ jobs:
# This job is used to report success if the needed jobs were successful.
# This is a workaround to make optional jobs required if they run
report-success:
name: Success or skipped due to no changes
name: GUI Checks Success or Skipped
runs-on: ubuntu-latest
needs: [checks, storybook]
if: needs.checks.result == 'skipped' && needs.storybook.result == 'skipped' || needs.checks.result == 'success' && needs.storybook.result == 'success'
if: always()
steps:
- name: Report success
run: echo "Success!"
run: |
echo "Checks: ${{ needs.checks.result }}"
echo "Storybook: ${{ needs.storybook.result }}"
if [[ "${{ needs.checks.result }}" == "failure" || "${{ needs.storybook.result }}" == "failure" ]]; then
exit 1
fi
echo "Success!"
24 changes: 12 additions & 12 deletions .github/workflows/gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down Expand Up @@ -250,9 +250,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down Expand Up @@ -305,9 +305,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down Expand Up @@ -362,9 +362,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- run: xvfb-run corepack pnpm -r --filter enso exec playwright test
env:
DEBUG: "pw:browser log:"
Expand Down Expand Up @@ -435,9 +435,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- run: corepack pnpm -r --filter enso exec playwright test
env:
DEBUG: "pw:browser log:"
Expand Down Expand Up @@ -501,9 +501,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.MICROSOFT_CODE_SIGNING_CERT_PASSWORD }}
WIN_CSC_LINK: ${{ secrets.MICROSOFT_CODE_SIGNING_CERT }}
- run: corepack pnpm -r --filter enso exec playwright test
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down Expand Up @@ -573,9 +573,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down Expand Up @@ -640,9 +640,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down Expand Up @@ -701,9 +701,9 @@ jobs:
ENSO_CLOUD_GOOGLE_ANALYTICS_TAG: ${{ vars.ENSO_CLOUD_GOOGLE_ANALYTICS_TAG }}
ENSO_CLOUD_SENTRY_DSN: ${{ vars.ENSO_CLOUD_SENTRY_DSN }}
ENSO_CLOUD_STRIPE_KEY: ${{ vars.ENSO_CLOUD_STRIPE_KEY }}
ENSO_IDE_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
ENSO_IDE_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.MICROSOFT_CODE_SIGNING_CERT_PASSWORD }}
WIN_CSC_LINK: ${{ secrets.MICROSOFT_CODE_SIGNING_CERT }}
- if: failure() && runner.os == 'Windows'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
comment-on-pr:
name: 💬 Comment on PR
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: deploy-chromatic-react
steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
- ["Write" button in component menu allows to evaluate it separately from the
rest of the workflow][11523].
- [The documentation editor can now display tables][11564]
- [The documentation editor supports the Markdown URL syntax, and uses it to
render pasted URLs as links][11597]
- [Table Input Widget is now matched for Table.input method instead of
Table.new. Values must be string literals, and their content is parsed to the
suitable type][11612].
- [Visualizations on components are slightly transparent when not
focused][11582].
- [New design for vector-editing widget][11620]

[11151]: https://github.com/enso-org/enso/pull/11151
[11271]: https://github.com/enso-org/enso/pull/11271
Expand All @@ -48,6 +56,10 @@
[11547]: https://github.com/enso-org/enso/pull/11547
[11523]: https://github.com/enso-org/enso/pull/11523
[11564]: https://github.com/enso-org/enso/pull/11564
[11597]: https://github.com/enso-org/enso/pull/11597
[11612]: https://github.com/enso-org/enso/pull/11612
[11582]: https://github.com/enso-org/enso/pull/11582
[11620]: https://github.com/enso-org/enso/pull/11620

#### Enso Standard Library

Expand Down
28 changes: 25 additions & 3 deletions app/common/src/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ export async function readEnvironmentFromFile() {
const filePath = path.join(url.fileURLToPath(new URL('../..', import.meta.url)), fileName)
const buildInfo = await (async () => {
try {
return await import('../../../build.json', { with: { type: 'json' } })
const build = await import('../../../build.json', { with: { type: 'json' } })
// Handle importing json file regardless of CommonJS/ESM integation settings.
return 'default' in build ? build.default : build
} catch {
return { commit: '', version: '', engineVersion: '', name: '' }
}
})()
console.info('Build info: ' + JSON.stringify(buildInfo))
discardUndefinedEnv('ENSO_IDE_VERSION')
discardUndefinedEnv('ENSO_CLOUD_DASHBOARD_VERSION')
discardUndefinedEnv('ENSO_CLOUD_DASHBOARD_COMMIT_HASH')

try {
const file = await fs.readFile(filePath, { encoding: 'utf-8' })
console.info(`Reading environment from file: ${filePath}`)
/** @type {readonly (readonly [string, string])[]} */
let entries = file.split('\n').flatMap(line => {
if (/^\s*$|^.s*#/.test(line)) {
Expand All @@ -36,10 +44,14 @@ export async function readEnvironmentFromFile() {
})
if (isProduction) {
entries = entries.filter(kv => {
const [k] = kv
return process.env[k] == null
const [k, v] = kv
return v !== 'undefined' && process.env[k] == null
})
}

const foundVars = entries.map(([k, _]) => k).join(', ')
console.info(`Found variables: ${foundVars}`)

const variables = Object.fromEntries(entries)
if (!isProduction || entries.length > 0) {
Object.assign(process.env, variables)
Expand All @@ -52,6 +64,16 @@ export async function readEnvironmentFromFile() {
}
}

/**
* Discard environment variable value when is an "undefined" string.
* @param {string} name Name of an env variable.
*/
function discardUndefinedEnv(name) {
if (process.env[name] === 'undefined') {
delete process.env[name]
}
}

// ===============
// === globals ===
// ===============
Expand Down
2 changes: 1 addition & 1 deletion app/common/src/queryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ declare module '@tanstack/query-core' {
/** Query Client type suitable for shared use in React and Vue. */
export type QueryClient = vueQuery.QueryClient

const DEFAULT_QUERY_STALE_TIME_MS = 2 * 60 * 1000
const DEFAULT_QUERY_STALE_TIME_MS = Infinity
const DEFAULT_QUERY_PERSIST_TIME_MS = 30 * 24 * 60 * 60 * 1000 // 30 days

const DEFAULT_BUSTER = 'v1.1'
Expand Down
20 changes: 19 additions & 1 deletion app/gui/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,30 @@ const sharedConfig: Partial<ReactStorybookConfig> = {
env: { FRAMEWORK: framework },

previewHead: (head) => {
return `
return /*html*/ `
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=M+PLUS+1:wght@300;400;500;600;700&display=swap"
rel="preload"
as="style"
crossorigin
/>
<script>
window.global = window;
// Pass environment variables to the storybook
window.ENV = {
// The framework used to render the story
// Used by the preview to determine which framework to use
FRAMEWORK: '${framework}',
}
// Allow React DevTools to work in Storybook
if (window.parent !== window) {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__
}
</script>
${head}
`
Expand Down
18 changes: 16 additions & 2 deletions app/gui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@
*/
import type { Preview as ReactPreview } from '@storybook/react'
import type { Preview as VuePreview } from '@storybook/vue3'
import React, { useLayoutEffect, useState } from 'react'
import isChromatic from 'chromatic/isChromatic'
import { useLayoutEffect, useState } from 'react'

import invariant from 'tiny-invariant'
import UIProviders from '../src/dashboard/components/UIProviders'

import { QueryClientProvider } from '@tanstack/react-query'
import { createQueryClient } from 'enso-common/src/queryClient'
import { MotionGlobalConfig } from 'framer-motion'
import z from 'zod'
import '../src/dashboard/tailwind.css'

if (isChromatic()) {
MotionGlobalConfig.skipAnimations = true
document.documentElement.classList.add('disable-animations')
}

const framework = z.enum(['vue', 'react']).parse(window.ENV.FRAMEWORK)

const vuePreview: VuePreview = {
Expand All @@ -32,7 +42,6 @@ const reactPreview: ReactPreview = {
},
},
},

// Decorators for all stories
// Decorators are applied in the reverse order they are defined
decorators: [
Expand Down Expand Up @@ -61,6 +70,11 @@ const reactPreview: ReactPreview = {
<div id="enso-portal-root" className="enso-portal-root" />
</>
),

(Story, context) => {
const [queryClient] = useState(() => createQueryClient())
return <QueryClientProvider client={queryClient}>{Story(context)}</QueryClientProvider>
},
],
}

Expand Down
2 changes: 1 addition & 1 deletion app/gui/chromatic.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://www.chromatic.com/config-file.schema.json",
"projectId": "Enso Dashboard",
"autoAcceptChanges": "main",
"autoAcceptChanges": "develop",
"exitOnceUploaded": true,
"skip": "dependabot/**",
"buildScriptName": "build-storybook:react"
Expand Down
Loading

0 comments on commit 9cec1c4

Please sign in to comment.