ci: Update TypeScript test workflow for improved Playwright integration (#4781)
* Update TypeScript test workflow to improve Playwright caching and containerization - Add container image for Playwright to ensure consistent environment - Modify Playwright version retrieval to use `npm ls` for accuracy - Enhance caching strategy with restore keys for Playwright binaries - Refactor Playwright installation steps to handle dependencies based on cache status * Remove Playwright container image specification from GitHub Actions workflow * Add GitHub Action to install Playwright with caching support - Created a new composite GitHub Action `install-playwright` to install Playwright and its dependencies with caching. - Updated `typescript_test.yml` workflow to use the new `install-playwright` action, simplifying the installation process and ensuring efficient use of cache. - The action supports specifying a working directory and selecting browsers to install. * Remove redundant Playwright caching steps from GitHub Actions workflow * Update Playwright version extraction logic in GitHub Action - Modify script to read `package.json` directly for Playwright version. - Support both `dependencies` and `devDependencies` for version retrieval. - Remove caret and tilde symbols from version string. * Optimize Node.js setup and caching in GitHub Actions workflow * Set UV_CACHE_DIR environment variable in GitHub workflows * Refactor SignUpPage to import InputComponent from the core components directory * Set default test suites to an empty array in TypeScript test workflow * Fix conditional logic in TypeScript test workflow for release builds * Fix syntax error in conditional statement in GitHub Actions workflow
This commit is contained in:
parent
989cefd0ac
commit
87e5b86f48
4 changed files with 93 additions and 41 deletions
76
.github/actions/install-playwright/action.yml
vendored
Normal file
76
.github/actions/install-playwright/action.yml
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
name: Install Playwright
|
||||||
|
description: Install Playwright and dependencies with cache
|
||||||
|
|
||||||
|
# https://github.com/microsoft/playwright/issues/7249
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
working-directory:
|
||||||
|
description: Where to install Playwright
|
||||||
|
default: ./
|
||||||
|
browsers:
|
||||||
|
description: Browsers to install
|
||||||
|
default: chromium webkit firefox
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
version:
|
||||||
|
description: Installed version of Playwright
|
||||||
|
value: ${{ steps.version.outputs.version }}
|
||||||
|
cache-hit:
|
||||||
|
description: Whether cache for Playwright was found
|
||||||
|
value: ${{ steps.cache.outputs.cache-hit }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Get Playwright version
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
id: version
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
// Get working directory
|
||||||
|
const workingDirectory = "${{ inputs.working-directory }}";
|
||||||
|
console.debug("Specified working directory:", workingDirectory);
|
||||||
|
if (workingDirectory) process.chdir(workingDirectory);
|
||||||
|
console.debug("Actual working directory:", process.cwd());
|
||||||
|
|
||||||
|
// Read package.json
|
||||||
|
let version = "";
|
||||||
|
try {
|
||||||
|
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
||||||
|
version = (
|
||||||
|
packageJson.devDependencies?.['@playwright/test'] ||
|
||||||
|
packageJson.dependencies?.['@playwright/test'] ||
|
||||||
|
packageJson.dependencies?.['playwright'] ||
|
||||||
|
packageJson.devDependencies?.['playwright']
|
||||||
|
)?.replace(/[\^~]/g, '');
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.debug("Version:", version);
|
||||||
|
if (version) {
|
||||||
|
core.exportVariable("PLAYWRIGHT_VERSION", version);
|
||||||
|
core.setOutput("version", version);
|
||||||
|
} else core.setFailed("Couldn't get Playwright version");
|
||||||
|
|
||||||
|
- name: Cache Playwright
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cache/ms-playwright
|
||||||
|
key: playwright-${{ env.PLAYWRIGHT_VERSION }}
|
||||||
|
|
||||||
|
- name: Install Playwright and its dependencies
|
||||||
|
shell: bash
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
working-directory: ${{ inputs.working-directory }}
|
||||||
|
run: npx playwright install ${{ inputs.browsers }} --with-deps
|
||||||
|
|
||||||
|
- name: Install just Playwright's dependencies
|
||||||
|
shell: bash
|
||||||
|
if: steps.cache.outputs.cache-hit == 'true'
|
||||||
|
working-directory: ${{ inputs.working-directory }}
|
||||||
|
run: npx playwright install-deps
|
||||||
2
.github/workflows/python_test.yml
vendored
2
.github/workflows/python_test.yml
vendored
|
|
@ -33,6 +33,8 @@ jobs:
|
||||||
build:
|
build:
|
||||||
name: Unit Tests - Python ${{ matrix.python-version }} - Group ${{ matrix.group }}
|
name: Unit Tests - Python ${{ matrix.python-version }} - Group ${{ matrix.group }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
UV_CACHE_DIR: /tmp/.uv-cache
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ${{ fromJson(inputs.python-versions || '["3.10", "3.11", "3.12"]' ) }}
|
python-version: ${{ fromJson(inputs.python-versions || '["3.10", "3.11", "3.12"]' ) }}
|
||||||
|
|
|
||||||
54
.github/workflows/typescript_test.yml
vendored
54
.github/workflows/typescript_test.yml
vendored
|
|
@ -12,7 +12,7 @@ on:
|
||||||
description: "Test suites to run (JSON array)"
|
description: "Test suites to run (JSON array)"
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: '["starter-projects", "components", "workspace", "api", "database"]'
|
default: '[]'
|
||||||
release:
|
release:
|
||||||
description: "Whether this is a release build"
|
description: "Whether this is a release build"
|
||||||
required: false
|
required: false
|
||||||
|
|
@ -81,7 +81,7 @@ jobs:
|
||||||
RELEASE="${{ inputs.release || 'false' }}"
|
RELEASE="${{ inputs.release || 'false' }}"
|
||||||
echo "Release build: $RELEASE"
|
echo "Release build: $RELEASE"
|
||||||
|
|
||||||
if [[ "$RELEASE" == "true" || "$SUITES" == "[]" ]]; then
|
if [[ "$RELEASE" == "true" ]]; then
|
||||||
SUITES='["release"]'
|
SUITES='["release"]'
|
||||||
echo "Release build detected - setting suites to: $SUITES"
|
echo "Release build detected - setting suites to: $SUITES"
|
||||||
# No grep pattern for release - run all tests
|
# No grep pattern for release - run all tests
|
||||||
|
|
@ -166,13 +166,13 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||||
shardTotal: [10]
|
shardTotal: [10]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
OPENAI_API_KEY: ${{ inputs.openai_api_key || secrets.OPENAI_API_KEY }}
|
OPENAI_API_KEY: ${{ inputs.openai_api_key || secrets.OPENAI_API_KEY }}
|
||||||
STORE_API_KEY: ${{ inputs.store_api_key || secrets.STORE_API_KEY }}
|
STORE_API_KEY: ${{ inputs.store_api_key || secrets.STORE_API_KEY }}
|
||||||
SEARCH_API_KEY: "${{ secrets.SEARCH_API_KEY }}"
|
SEARCH_API_KEY: "${{ secrets.SEARCH_API_KEY }}"
|
||||||
ASTRA_DB_APPLICATION_TOKEN: "${{ secrets.ASTRA_DB_APPLICATION_TOKEN }}"
|
ASTRA_DB_APPLICATION_TOKEN: "${{ secrets.ASTRA_DB_APPLICATION_TOKEN }}"
|
||||||
ASTRA_DB_API_ENDPOINT: "${{ secrets.ASTRA_DB_API_ENDPOINT }}"
|
ASTRA_DB_API_ENDPOINT: "${{ secrets.ASTRA_DB_API_ENDPOINT }}"
|
||||||
|
UV_CACHE_DIR: /tmp/.uv-cache
|
||||||
outputs:
|
outputs:
|
||||||
failed: ${{ steps.check-failure.outputs.failed }}
|
failed: ${{ steps.check-failure.outputs.failed }}
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -183,50 +183,24 @@ jobs:
|
||||||
# else checkout the default ref
|
# else checkout the default ref
|
||||||
ref: ${{ inputs.ref || github.ref }}
|
ref: ${{ inputs.ref || github.ref }}
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node ${{ env.NODE_VERSION }}
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
id: setup-node
|
id: setup-node
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: "npm"
|
||||||
- name: Cache Node.js dependencies
|
cache-dependency-path: ./src/frontend/package-lock.json
|
||||||
uses: actions/cache@v4
|
|
||||||
id: npm-cache
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('src/frontend/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node-
|
|
||||||
|
|
||||||
- name: Install Node.js dependencies
|
- name: Install Node.js dependencies
|
||||||
run: |
|
run: npm ci
|
||||||
cd src/frontend
|
working-directory: ./src/frontend
|
||||||
npm ci
|
|
||||||
if: ${{ steps.setup-node.outputs.cache-hit != 'true' }}
|
- name: Install Playwright
|
||||||
- name: Get Playwright version
|
id: install-playwright
|
||||||
run: echo "PLAYWRIGHT_VERSION=$(jq '.devDependencies["@playwright/test"]' src/frontend/package.json -r)" >> $GITHUB_ENV
|
uses: ./.github/actions/install-playwright
|
||||||
- name: Cache Playwright binaries
|
|
||||||
id: playwright-cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/ms-playwright
|
working-directory: ./src/frontend
|
||||||
key: playwright-browsers-${{ runner.os }}-${{ env.PLAYWRIGHT_VERSION }}
|
browsers: chromium
|
||||||
|
|
||||||
- name: Install Frontend dependencies
|
|
||||||
run: |
|
|
||||||
cd src/frontend
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Install Playwright's browser binaries
|
|
||||||
run: |
|
|
||||||
cd src/frontend
|
|
||||||
npx playwright install --with-deps
|
|
||||||
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
||||||
- name: Install Playwright's dependencies
|
|
||||||
run: |
|
|
||||||
cd src/frontend
|
|
||||||
npx playwright install-deps
|
|
||||||
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
||||||
|
|
||||||
- name: "Setup Environment"
|
- name: "Setup Environment"
|
||||||
uses: ./.github/actions/setup-uv
|
uses: ./.github/actions/setup-uv
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import LangflowLogo from "@/assets/LangflowLogo.svg?react";
|
import LangflowLogo from "@/assets/LangflowLogo.svg?react";
|
||||||
|
import InputComponent from "@/components/core/parameterRenderComponent/components/inputComponent";
|
||||||
import { useAddUser } from "@/controllers/API/queries/auth";
|
import { useAddUser } from "@/controllers/API/queries/auth";
|
||||||
import { CustomLink } from "@/customization/components/custom-link";
|
import { CustomLink } from "@/customization/components/custom-link";
|
||||||
import { ENABLE_NEW_LOGO } from "@/customization/feature-flags";
|
import { ENABLE_NEW_LOGO } from "@/customization/feature-flags";
|
||||||
|
|
@ -6,7 +7,6 @@ import { useCustomNavigate } from "@/customization/hooks/use-custom-navigate";
|
||||||
import { track } from "@/customization/utils/analytics";
|
import { track } from "@/customization/utils/analytics";
|
||||||
import * as Form from "@radix-ui/react-form";
|
import * as Form from "@radix-ui/react-form";
|
||||||
import { FormEvent, useEffect, useState } from "react";
|
import { FormEvent, useEffect, useState } from "react";
|
||||||
import InputComponent from "../../components/inputComponent";
|
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import { Input } from "../../components/ui/input";
|
import { Input } from "../../components/ui/input";
|
||||||
import { SIGNUP_ERROR_ALERT } from "../../constants/alerts_constants";
|
import { SIGNUP_ERROR_ALERT } from "../../constants/alerts_constants";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue