From cdd9b15c7a03b8b0f10360da9e982cb7a6777c57 Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Tue, 28 Jan 2025 13:00:12 -0800 Subject: [PATCH 1/8] Debug tests Signed-off-by: Shveta Sachdeva --- .github/workflows/windows-nightly-ci.yml | 27 +++++++++++------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 47a6508c..ad4b0053 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -1,9 +1,6 @@ name: (Windows)(nonadmin) Run Playwright tests nightly on main branch -on: - schedule: - - cron: "5 3 * * *" - workflow_dispatch: +on: push jobs: start-ec2-instance: @@ -79,14 +76,14 @@ jobs: EC2_USER: nonadmin EC2_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} - stop-ec2-instance: - needs: [ start-ec2-instance, install-requirements-as-admin, run-test-as-nonadmin] - if: always() - uses: ./.github/workflows/remove-runner.yml - with: - ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} - ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} - secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} + # stop-ec2-instance: + # needs: [ start-ec2-instance, install-requirements-as-admin, run-test-as-nonadmin] + # if: always() + # uses: ./.github/workflows/remove-runner.yml + # with: + # ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} + # ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} + # secrets: + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} From dd64de62ba48f0faf494114362d8a5a40a81507c Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Tue, 28 Jan 2025 13:48:56 -0800 Subject: [PATCH 2/8] Install vscode Signed-off-by: Shveta Sachdeva --- .github/workflows/windows-nightly-ci.yml | 36 +++++++++++++----------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index ad4b0053..163842d0 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -3,23 +3,23 @@ name: (Windows)(nonadmin) Run Playwright tests nightly on main branch on: push jobs: - start-ec2-instance: - uses: ./.github/workflows/provision-runner.yml - with: - ec2-image-id: ami-0cf05b9bbda99aed3 - ec2-instance-type: t2.micro - security-group-id: sg-0a3e6b53e86d0e69d - subnet-id: subnet-06113672589e7e836 - ec2-os-type: windows - secrets: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} - nonadmin-password: ${{ secrets.NONADMIN_PASSWORD }} + # start-ec2-instance: + # uses: ./.github/workflows/provision-runner.yml + # with: + # ec2-image-id: ami-0cf05b9bbda99aed3 + # ec2-instance-type: t2.micro + # security-group-id: sg-0a3e6b53e86d0e69d + # subnet-id: subnet-06113672589e7e836 + # ec2-os-type: windows + # secrets: + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} + # nonadmin-password: ${{ secrets.NONADMIN_PASSWORD }} install-requirements-as-admin: - needs: start-ec2-instance - runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} + # needs: start-ec2-instance + runs-on: t851y steps: - name: Install Node.js run: choco install nodejs -y @@ -33,8 +33,12 @@ jobs: run: choco install maven -y shell: powershell + - name: Install VSCode as admin + run: choco install vscode -y + shell: powershell + run-test-as-nonadmin: - needs: [ start-ec2-instance, install-requirements-as-admin] + needs: [ install-requirements-as-admin] runs-on: ubuntu-latest steps: From 4af6bfc3d0c49e245da79da8089319c695ac8274 Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Tue, 28 Jan 2025 14:21:53 -0800 Subject: [PATCH 3/8] Install vscode Signed-off-by: Shveta Sachdeva --- .env.example | 8 ++++---- e2e/pages/vscode.pages.ts | 16 ++++++++-------- e2e/tests/vscode.test.ts | 7 +------ e2e/utilities/utils.ts | 11 ++++++++++- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.env.example b/.env.example index 6b219e42..9b695c00 100644 --- a/.env.example +++ b/.env.example @@ -6,13 +6,13 @@ # Instead, copy it, remove the .example extension and provide your custom values # For git password please use your generated git token, not a clear text password -VSIX_FILE_NAME='konveyor-v0.0.5.vsix' -DEFAULT_VSIX_DOWNLOAD_URL= 'https://github.com/konveyor/editor-extensions/releases/download/v0.0.5/konveyor-v0.0.5.vsix' +VSIX_FILE_NAME='konveyor-v0.0.6.vsix' +DEFAULT_VSIX_DOWNLOAD_URL= 'https://github.com/konveyor/editor-extensions/releases/download/v0.0.6/konveyor-v0.0.6.vsix' PLUGIN_URL= 'https://github.com/konveyor/editor-extensions/releases/download/' -PLUGIN_VERSION= 'v0.0.5' +PLUGIN_VERSION= 'v0.0.6' # For Windows Path needs to be given in below format -WINDOWS_VSCODE_EXECUTABLE_PATH='C:/Users/nonadmin/AppData/Local/Programs/Microsoft VS Code/Code.exe' +WINDOWS_VSCODE_EXECUTABLE_PATH='C:/Program Files/Microsoft VS Code/Code.exe' # For Linux VSCODE_EXECUTABLE_PATH='/usr/share/code/code' diff --git a/e2e/pages/vscode.pages.ts b/e2e/pages/vscode.pages.ts index 20d70fea..1bb0028f 100644 --- a/e2e/pages/vscode.pages.ts +++ b/e2e/pages/vscode.pages.ts @@ -6,7 +6,11 @@ import { } from 'playwright'; import { execSync } from 'child_process'; import { downloadLatestKAIPlugin } from '../utilities/download.utils'; -import { getKAIPluginName, getOSInfo } from '../utilities/utils'; +import { + getKAIPluginName, + getOSInfo, + getVscodeExecutablePath, +} from '../utilities/utils'; import * as path from 'path'; class VSCode { @@ -20,15 +24,10 @@ class VSCode { /** * launches VSCode with KAI plugin installed and coolstore app opened. - * @param executablePath path to the vscode binary * @param repoUrl coolstore app to be cloned * @param cloneDir path to repo */ - public static async init( - executablePath: string, - repoUrl: string, - cloneDir: string - ): Promise { + public static async init(repoUrl: string, cloneDir: string): Promise { try { console.log('Cloning repo'); execSync(`git clone ${repoUrl}`); @@ -51,10 +50,11 @@ class VSCode { 'VSIX_FILE_PATH environment variable is not set. Skipping extension installation.' ); } + console.log('launching vscode ... '); // Launch VSCode as an Electron app const vscodeApp = await electron.launch({ - executablePath: executablePath, + executablePath: getVscodeExecutablePath(), args: [path.resolve(cloneDir), '--disable-workspace-trust'], }); diff --git a/e2e/tests/vscode.test.ts b/e2e/tests/vscode.test.ts index c9d1ee96..df8df524 100644 --- a/e2e/tests/vscode.test.ts +++ b/e2e/tests/vscode.test.ts @@ -10,12 +10,7 @@ test.describe('VSCode Tests', () => { test.beforeAll(async () => { test.setTimeout(60000); - const executablePath = - getOSInfo() == 'windows' - ? process.env.WINDOWS_VSCODE_EXECUTABLE_PATH - : process.env.VSCODE_EXECUTABLE_PATH; - console.log(`VSCode executable path: ${executablePath}`); - vscodeApp = await VSCode.init(executablePath, repoUrl, 'coolstore'); + vscodeApp = await VSCode.init(repoUrl, 'coolstore'); }); test('Should launch VSCode and check window title', async () => { diff --git a/e2e/utilities/utils.ts b/e2e/utilities/utils.ts index 8477093e..b2910a18 100644 --- a/e2e/utilities/utils.ts +++ b/e2e/utilities/utils.ts @@ -25,7 +25,7 @@ export function getOSInfo(): string { } export function getKAIPluginName(): string { - const vsixFileName = process.env.VSIX_FILE_NAME || 'konveyor-v0.0.4.vsix'; + const vsixFileName = process.env.VSIX_FILE_NAME || 'konveyor-v0.0.6.vsix'; return vsixFileName; } @@ -50,3 +50,12 @@ export async function uninstallExtension() { console.error('Error uninstalling Konveyor extension:', error); } } + +export function getVscodeExecutablePath() { + const executablePath = + getOSInfo() == 'windows' + ? process.env.WINDOWS_VSCODE_EXECUTABLE_PATH + : process.env.VSCODE_EXECUTABLE_PATH || '/usr/share/code/code'; + console.log(`VSCode executable path: ${executablePath}`); + return executablePath; +} From 7efae3d8976ca4bc3f65f341eeae4cbbd2dfa2f0 Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Tue, 28 Jan 2025 14:25:57 -0800 Subject: [PATCH 4/8] Install vscode Signed-off-by: Shveta Sachdeva --- .github/workflows/windows-nightly-ci.yml | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 163842d0..70d4cca6 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -3,22 +3,22 @@ name: (Windows)(nonadmin) Run Playwright tests nightly on main branch on: push jobs: - # start-ec2-instance: - # uses: ./.github/workflows/provision-runner.yml - # with: - # ec2-image-id: ami-0cf05b9bbda99aed3 - # ec2-instance-type: t2.micro - # security-group-id: sg-0a3e6b53e86d0e69d - # subnet-id: subnet-06113672589e7e836 - # ec2-os-type: windows - # secrets: - # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} - # nonadmin-password: ${{ secrets.NONADMIN_PASSWORD }} + start-ec2-instance: + uses: ./.github/workflows/provision-runner.yml + with: + ec2-image-id: ami-0cf05b9bbda99aed3 + ec2-instance-type: t2.micro + security-group-id: sg-0a3e6b53e86d0e69d + subnet-id: subnet-06113672589e7e836 + ec2-os-type: windows + secrets: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} + nonadmin-password: ${{ secrets.NONADMIN_PASSWORD }} install-requirements-as-admin: - # needs: start-ec2-instance + needs: start-ec2-instance runs-on: t851y steps: - name: Install Node.js From ea4441d454e1d7c8a004d28279941678780aa76c Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Tue, 28 Jan 2025 14:28:09 -0800 Subject: [PATCH 5/8] Install vscode Signed-off-by: Shveta Sachdeva --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 70d4cca6..0814db67 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -19,7 +19,7 @@ jobs: install-requirements-as-admin: needs: start-ec2-instance - runs-on: t851y + runs-on: ${{ needs.start-ec2-instance.outputs.instance_label }} steps: - name: Install Node.js run: choco install nodejs -y From 917333bed7e49f65640195854e24e71fa2e2d859 Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Tue, 28 Jan 2025 14:28:57 -0800 Subject: [PATCH 6/8] Install vscode Signed-off-by: Shveta Sachdeva --- .github/workflows/windows-nightly-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 0814db67..42e9cc01 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -38,7 +38,7 @@ jobs: shell: powershell run-test-as-nonadmin: - needs: [ install-requirements-as-admin] + needs: [ start-ec2-instance, install-requirements-as-admin] runs-on: ubuntu-latest steps: From c43b46eab8a5352ed6286be9995581dab8bec048 Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Tue, 28 Jan 2025 14:48:39 -0800 Subject: [PATCH 7/8] Install vscode Signed-off-by: Shveta Sachdeva --- .github/workflows/windows-nightly-ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 42e9cc01..61ce5c3e 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -61,7 +61,7 @@ jobs: echo "set PATH=%PATH%;%nodePath%" >> execute-tests.bat echo "cd C:\\Users\\nonadmin\\kai-ci" >> execute-tests.bat echo "copy .env.example .env" >> execute-tests.bat - echo "npx playwright test" >> execute-tests.bat + echo "npx playwright test --reporter=list" >> execute-tests.bat shell: bash - name: Copy batch file to Windows EC2 instance @@ -80,14 +80,14 @@ jobs: EC2_USER: nonadmin EC2_PASSWORD: ${{ secrets.NONADMIN_PASSWORD }} - # stop-ec2-instance: - # needs: [ start-ec2-instance, install-requirements-as-admin, run-test-as-nonadmin] - # if: always() - # uses: ./.github/workflows/remove-runner.yml - # with: - # ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} - # ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} - # secrets: - # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} + stop-ec2-instance: + needs: [ start-ec2-instance, install-requirements-as-admin, run-test-as-nonadmin] + if: always() + uses: ./.github/workflows/remove-runner.yml + with: + ec2-instance-id: ${{ needs.start-ec2-instance.outputs.ec2-instance-id }} + ec2-runner-label: ${{ needs.start-ec2-instance.outputs.instance_label }} + secrets: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + github-token: ${{ secrets.GH_RUNNER_API_TOKEN }} From aa550e7ed7e32edf7b458ca939103181c7b38e2f Mon Sep 17 00:00:00 2001 From: Shveta Sachdeva Date: Tue, 28 Jan 2025 15:00:25 -0800 Subject: [PATCH 8/8] Install vscode Signed-off-by: Shveta Sachdeva --- .github/workflows/windows-nightly-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-nightly-ci.yml b/.github/workflows/windows-nightly-ci.yml index 61ce5c3e..c8a2de7e 100644 --- a/.github/workflows/windows-nightly-ci.yml +++ b/.github/workflows/windows-nightly-ci.yml @@ -1,6 +1,9 @@ name: (Windows)(nonadmin) Run Playwright tests nightly on main branch -on: push +on: + schedule: + - cron: "5 3 * * *" + workflow_dispatch: jobs: start-ec2-instance: