Skip to content

Commit

Permalink
Extend repo script
Browse files Browse the repository at this point in the history
 Extend the repo script to
- Enable checkout/preparation of node and java server repos
- Add start commands for the node and java repos
- Update the prepare command to checkout the node server per default
- Update the log command to only execute the underlying git command if the repo exists
- Add client subcommand for print the standalone url
-  Add vscode-integration subbcommand for printing the vsix path

Update the playwright config to allow
- Customization of the default server start command via env variable

Update ci workflow
- Also include tests with the java based server
  • Loading branch information
tortmayr committed Aug 2, 2024
1 parent 0edc2a9 commit 6f409d4
Show file tree
Hide file tree
Showing 7 changed files with 268 additions and 37 deletions.
62 changes: 52 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: 'CI'

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -50,20 +49,17 @@ jobs:
npm_config_yes=true npx github:10up/eslint-json-to-md#82ff16b --path ./eslint_report.json --output ./eslint_report.md
cat eslint_report.md >> $GITHUB_STEP_SUMMARY
playwright:
name: Playwright Tests
playwright-node:
name: Playwright Tests (Node server)
timeout-minutes: 120
runs-on: ubuntu-latest
env:
STANDALONE_URL: 'file://${{ github.workspace }}/examples/workflow-test/repositories/glsp-client/examples/workflow-standalone/app/diagram.html'
THEIA_URL: 'http://localhost:3000'
VSCODE_VSIX_ID: 'eclipse-glsp.workflow-vscode-example'
VSCODE_VSIX_PATH: '${{ github.workspace }}/examples/workflow-test/repositories/glsp-vscode-integration/example/workflow/extension/workflow-vscode-example-2.3.0-next.vsix'
GLSP_SERVER_DEBUG: 'true'
GLSP_SERVER_PORT: '8081'
GLSP_SERVER_PLAYWRIGHT_MANAGED: 'true'
GLSP_WEBSOCKET_PATH: 'workflow'

steps:
- uses: actions/checkout@v4.1.7
- uses: actions/setup-node@v4.0.2
Expand All @@ -73,16 +69,62 @@ jobs:
run: yarn install
- name: Prepare repos
run: yarn repo prepare --protocol https
- name: Set Environment Variables
run: |
echo "STANDALONE_URL=$(yarn -s repo client url)" >> $GITHUB_ENV
echo "VSCODE_VSIX_PATH=$(yarn -s repo vscode-integration vsixPath)" >> $GITHUB_ENV
echo "GLSP_SERVER_START_COMMAND=yarn repo node-server start" >> $GITHUB_ENV
- name: Start theia
run: yarn repo theia-integration start &
- name: Run Playwright tests
id: run_playwright_tests
run: xvfb-run -a yarn test
- name: Upload Playwright report
if: ${{ always() }}
uses: actions/upload-artifact@v4.3.4
with:
name: playwright-report-node
path: examples/workflow-test/playwright-report/

playwright-java:
if: false
name: Playwright Tests (Java server)
timeout-minutes: 120
runs-on: ubuntu-latest
env:
THEIA_URL: 'http://localhost:3000'
VSCODE_VSIX_ID: 'eclipse-glsp.workflow-vscode-example'
GLSP_SERVER_DEBUG: 'true'
GLSP_SERVER_PORT: '8081'
GLSP_SERVER_PLAYWRIGHT_MANAGED: 'true'
GLSP_WEBSOCKET_PATH: 'workflow'
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/setup-node@v4.0.2
with:
node-version: '18'
- name: Set up JDK
uses: actions/setup-java@v4.2.1
with:
distribution: 'temurin'
java-version: '17'
- name: Install dependencies
run: yarn install
- name: Prepare repos
run: yarn repo prepare --protocol https --serverType java
- name: Set Environment Variables
run: |
echo "STANDALONE_URL=$(yarn -s repo client url)" >> $GITHUB_ENV
echo "VSCODE_VSIX_PATH=$(yarn -s repo vscode-integration vsixPath)" >> $GITHUB_ENV
echo "GLSP_SERVER_START_COMMAND=yarn repo java-server start" >> $GITHUB_ENV
- name: Start theia
run: yarn repo theia-integration start &
- name: Run Playwright tests
id: run_playwright_tests
run: xvfb-run -a yarn test
continue-on-error: true
- name: Upload Playwright report
if: ${{ always() }}
uses: actions/upload-artifact@v4.3.4
with:
name: playwright-report
name: playwright-report-java
path: examples/workflow-test/playwright-report/
- if: steps.run_playwright_tests.outcome == 'failure'
run: exit 1
57 changes: 57 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: E2E Playwright Tests (Multi OS)

concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
schedule:
- cron: '20 18 * * 1'

jobs:
playwright-node:
name: E2E Playwright (Node)
strategy:
fail-fast: false
matrix:
os: [windows-2019, ubuntu-latest, macos-14]
timeout-minutes: 120
runs-on: ${{ matrix.os }}
env:
THEIA_URL: 'http://localhost:3000'
VSCODE_VSIX_ID: 'eclipse-glsp.workflow-vscode-example'
GLSP_SERVER_DEBUG: 'true'
GLSP_SERVER_PORT: '8081'
GLSP_SERVER_PLAYWRIGHT_MANAGED: 'true'
GLSP_WEBSOCKET_PATH: 'workflow'
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/setup-node@v4.0.2
with:
node-version: '18'
- name: Install dependencies
run: yarn install
- name: Prepare repos
run: yarn repo prepare --protocol https
- name: Set Environment Variables
run: |
echo "STANDALONE_URL=$(yarn -s repo client url)" >> $GITHUB_ENV
echo "VSCODE_VSIX_PATH=$(yarn -s repo vscode-integration vsixPath)" >> $GITHUB_ENV
echo "GLSP_SERVER_START_COMMAND=yarn repo node-server start" >> $GITHUB_ENV
- name: Start theia
run: yarn repo theia-integration start &
- name: Run Playwright tests
id: run_playwright_tests
run: |
if [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
xvfb-run -a yarn test
else
yarn test
fi
- name: Upload Playwright report
if: ${{ always() }}
uses: actions/upload-artifact@v4.3.4
with:
name: playwright-report-${{ matrix.os }}
path: examples/workflow-test/playwright-report/
3 changes: 2 additions & 1 deletion .github/workflows/publish-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
workflows: ['CI']
types:
- completed
branches: ['main']
workflow_dispatch:

permissions:
Expand All @@ -13,7 +14,7 @@ jobs:
name: Build & Publish
runs-on: ubuntu-latest
timeout-minutes: 60
if: github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main')
if: github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success')
env:
changes: true
steps:
Expand Down
7 changes: 5 additions & 2 deletions examples/workflow-test/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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
Expand All @@ -9,3 +9,6 @@ THEIA_URL="http://localhost:3000"
VSCODE_VERSION="1.88.1"
VSCODE_VSIX_ID="eclipse-glsp.workflow-vscode-example"
VSCODE_VSIX_PATH="/.../repositories/glsp-vscode-integration/example/workflow/extension/workflow-vscode-example-2.1.1.vsix"

# Optional
# GLSP_SERVER_START_COMMAND="yarn repo java-server start" # To use a custom command in playwright for starting the server
8 changes: 7 additions & 1 deletion examples/workflow-test/configs/webserver.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export function isManagedServer(): boolean {
return env === undefined || env === 'true';
}

export function getServerStartCommand(): string | undefined {
return getEnv('GLSP_SERVER_START_COMMAND', false);
}

export function hasRunningServer(config: PlaywrightTestConfig<GLSPPlaywrightOptions>): boolean {
const webserver = config.webServer;

Expand All @@ -42,9 +46,11 @@ export function createWebserver(): PlaywrightTestConfig['webServer'] {
return [];
}

const command = getServerStartCommand() ?? `yarn start:server -w -p ${+port}`;

return [
{
command: `yarn start:server -w -p ${+port}`,
command: command,
port: +port,
reuseExistingServer: !process.env.CI,
stdout: 'ignore'
Expand Down
Loading

0 comments on commit 6f409d4

Please sign in to comment.