Skip to content

Commit

Permalink
Improve build setup and switch to actions CI setup
Browse files Browse the repository at this point in the history
# GLSP-1179
- Update tsconfig, eslint config and package.json to fully utilize composite typescript/eslint builds
-- Compile typescript code from root instead of streaming to each package
-- Remove lint and clean from prepare steps. Linting is the most expensive step and is already
    covered via vscode/ci. Manual execution is enough. Skipping the clean step per default
    ensures that we can fully utilize incremental ts builds
-- Adapt linting commands to be executed with a single command from root instead of streaming 
    to all packages
Part of eclipse-glsp/glsp#1179


# GLSP 1154
- Update project configuration to also create projects for testing against firefox/edge
  if the MULTI_BROWSER env variable is set to true
- Update to playwright 1.42.1. This is necessary to allow passing regexes/wildcards for the --project argument
- Also report with `estruyf/github-actions-reporter` when running in CI

Part  of  eclipse-glsp/glsp#1154
  • Loading branch information
tortmayr committed Mar 3, 2024
1 parent 3e54bf5 commit 1bb8a8d
Show file tree
Hide file tree
Showing 15 changed files with 1,118 additions and 1,079 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Expand Up @@ -2,7 +2,7 @@
module.exports = {
root: true,
extends: ['@eclipse-glsp'],
ignorePatterns: ['**/{node_modules,lib}', '**/.eslintrc.js'],
ignorePatterns: ['**/{node_modules,lib}', '**/.eslintrc.js', "scripts/*.js"],
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.eslint.json'
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,30 @@
name: ci

on:
push:
branches:
- testci
pull_request:
branches:
- testci
workflow_dispatch:

jobs:
build_and_lint:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install dependencies
run: yarn install
- name: Check for uncommitted changes in yarn.lock
run: |
if git diff --name-only | grep -q "^yarn.lock"; then
echo "::error::The yarn.lock file has uncommitted changes!"
exit 1
fi
- name: ESLint Check
run: yarn lint:ci
149 changes: 0 additions & 149 deletions Jenkinsfile

This file was deleted.

9 changes: 7 additions & 2 deletions examples/workflow-test/.env.example
@@ -1,10 +1,15 @@
GLSP_SERVER_DEBUG="true" # For Theia and VSCode instances to connect to an external server
GLSP_SERVER_PORT="8081"
GLSP_SERVER_PLAYWRIGHT_MANAGED="true" # To allow Playwright to manage/start the server
GLSP_SERVER_PORT="8081"
GLSP_SERVER_PLAYWRIGHT_MANAGED="true" # To allow Playwright to manage/start the server
GLSP_WEBSOCKET_PATH="workflow"

# Configurations
STANDALONE_URL="file:///.../glsp-client/examples/workflow-standalone/app/diagram.html"
THEIA_URL="http://localhost:3000"
VSCODE_VSIX_ID="eclipse-glsp.workflow-vscode-example"
VSCODE_VSIX_PATH="/.../glsp-vscode-integration/example/workflow/extension/workflow-vscode-example-1.1.0-next.vsix"

## Additional configurations

MULTI_BROWSER=false # Set to true to run the tests against multipe browser targets (chrome, firefox, edge)
GLSP_SERVER_PLAYWRIGHT_MANAGED=true # Set to false to manage the server manually
82 changes: 69 additions & 13 deletions examples/workflow-test/configs/project.config.ts
Expand Up @@ -24,7 +24,10 @@ import { PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, P
import * as path from 'path';
import { getEnv } from './utils';

const projectDevices = devices['Desktop Chrome'];
export function isMultiBrowser(): boolean {
const env = getEnv('MULTI_BROWSER', false);
return env === undefined || env === 'true';
}

export function createStandaloneProject(): Project<PlaywrightTestOptions & GLSPPlaywrightOptions, PlaywrightWorkerArgs>[] {
const url = getEnv('STANDALONE_URL');
Expand All @@ -39,16 +42,41 @@ export function createStandaloneProject(): Project<PlaywrightTestOptions & GLSPP
url
};

return [
{
name: 'standalone',
const chromeProject = {
name: 'standalone-chrome',
testMatch: ['**/*.spec.js'],
use: {
...devices['Desktop Chrome'],
integrationOptions: standaloneIntegrationOptions
}
};

if (!isMultiBrowser()) {
return [chromeProject];
}

const firefoxProject = {
name: 'standalone-firefox',
testMatch: ['**/*.spec.js'],
use: {
...devices['Desktop Firefox'],
integrationOptions: standaloneIntegrationOptions
}
};

const projects = [chromeProject, firefoxProject];
if (process.platform === 'win32') {
const edgeProject = {
name: 'standalone-edge',
testMatch: ['**/*.spec.js'],
use: {
...projectDevices,
...devices['Desktop Edge'],
integrationOptions: standaloneIntegrationOptions
}
}
];
};
projects.push(edgeProject);
}
return projects;
}

export function createTheiaProject(): Project<PlaywrightTestOptions & GLSPPlaywrightOptions, PlaywrightWorkerOptions>[] {
Expand All @@ -67,17 +95,45 @@ export function createTheiaProject(): Project<PlaywrightTestOptions & GLSPPlaywr
file: 'example1.wf'
};

return [
{
name: 'theia',
const chromeProject = {
name: 'theia-chrome',
testMatch: ['**/*.spec.js'],
use: {
...devices['Desktop Chrome'],
baseURL: theiaIntegrationOptions.url,
integrationOptions: theiaIntegrationOptions
}
};

if (!isMultiBrowser()) {
return [chromeProject];
}

const firefoxProject = {
name: 'theia-firefox',
testMatch: ['**/*.spec.js'],
use: {
...devices['Desktop Firefox'],
baseURL: theiaIntegrationOptions.url,
integrationOptions: theiaIntegrationOptions
}
};

const projects = [chromeProject, firefoxProject];
if (process.platform === 'win32') {
const edgeProject = {
name: 'theia-edge',
testMatch: ['**/*.spec.js'],
use: {
...projectDevices,
...devices['Desktop Edge'],
baseURL: theiaIntegrationOptions.url,
integrationOptions: theiaIntegrationOptions
}
}
];
};
projects.push(edgeProject);
}

return projects;
}

export function createVSCodeProject(): Project<PlaywrightTestOptions & GLSPPlaywrightOptions, PlaywrightWorkerOptions>[] {
Expand Down
12 changes: 6 additions & 6 deletions examples/workflow-test/package.json
Expand Up @@ -32,22 +32,22 @@
"scripts": {
"build": "tsc -b",
"check-types": "tsc --noemit",
"clean": "rimraf --glob lib tsconfig.tsbuildinfo server/*.log",
"clean": "rimraf lib *.tsbuildinfo",
"lint": "eslint --ext .ts,.tsx ./src ./tests",
"lint:all": "yarn check-types && yarn lint",
"lint:ci": "yarn lint -o eslint.xml -f checkstyle",
"prepare": "yarn clean && yarn build && yarn lint && playwright install",
"prepare": "playwright install",
"start:server": "node node_modules/@eclipse-glsp-examples/workflow-server-bundled/wf-glsp-server-node.js",
"test": "playwright test",
"test:standalone": "yarn test --project=standalone",
"test:theia": "yarn test --project=theia",
"test:standalone": "yarn test --project=standalone-*",
"test:theia": "yarn test --project=theia-*",
"test:vscode": "yarn test --project=vscode",
"watch": "tsc -w"
},
"devDependencies": {
"@eclipse-glsp-examples/workflow-server-bundled": "~2.0.1",
"@eclipse-glsp/glsp-playwright": "~2.0.0",
"@playwright/test": "^1.40.1",
"@estruyf/github-actions-reporter": "1.5.0",
"@playwright/test": "^1.42.1",
"dotenv": "^16.0.3",
"ts-dedent": "^2.2.0",
"tsx": "^3.12.4"
Expand Down
2 changes: 1 addition & 1 deletion examples/workflow-test/playwright.config.ts
Expand Up @@ -36,7 +36,7 @@ const config: PlaywrightTestConfig<GLSPPlaywrightOptions> = {
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [['html', { open: 'never' }]],
reporter: process.env.CI ? [['html', { open: 'never' }], ['@estruyf/github-actions-reporter']] : [['html', { open: 'never' }]],
use: {
actionTimeout: 0,
trace: 'on-first-retry'
Expand Down
10 changes: 6 additions & 4 deletions examples/workflow-test/tsconfig.json
Expand Up @@ -3,9 +3,11 @@
"compilerOptions": {
"rootDir": ".",
"outDir": "lib",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"baseUrl": "."
},
"include": ["src", "tests", "scripts", "playwright.config.ts", "./configs/*.ts", "./server/server-config.json"]
"include": ["src", "tests", "playwright.config.ts", "./configs/*.ts"],
"references": [
{
"path": "../../packages/glsp-playwright"
}
]
}

0 comments on commit 1bb8a8d

Please sign in to comment.