From 021a8761af5329cde9220c6fb46f29c32ff135fe Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 15 Aug 2025 16:59:18 -0700 Subject: [PATCH 1/2] feat: run e2e tests on vsc release --- .../actions/run-vscode-e2e-tests/action.yml | 99 +++++++++++++++ .github/workflows/e2e-tests.yml | 58 +++++++++ .github/workflows/main.yaml | 14 +++ .github/workflows/pr-checks.yaml | 115 ++---------------- 4 files changed, 179 insertions(+), 107 deletions(-) create mode 100644 .github/actions/run-vscode-e2e-tests/action.yml create mode 100644 .github/workflows/e2e-tests.yml diff --git a/.github/actions/run-vscode-e2e-tests/action.yml b/.github/actions/run-vscode-e2e-tests/action.yml new file mode 100644 index 00000000000..210aa44c2a1 --- /dev/null +++ b/.github/actions/run-vscode-e2e-tests/action.yml @@ -0,0 +1,99 @@ +name: 'Run VS Code E2E Tests' +description: 'Runs VS Code E2E tests with test matrix generation and execution' +inputs: + github-token: + description: 'GitHub token for accessing private repositories' + required: true + ci-github-token: + description: 'CI GitHub token for accessing private repositories' + required: true + ssh_key: + description: 'SSH key for SSH tests' + required: false + ssh_host: + description: 'SSH host for SSH tests' + required: false + is_fork: + description: 'Whether this is running on a fork' + required: false + default: 'false' +outputs: + test_file_matrix: + description: 'Matrix of test files to run' + value: ${{ steps.get-test-file-matrix.outputs.test_file_matrix }} + +runs: + using: "composite" + steps: + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Cache npm + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-cache-matrix-${{ hashFiles('core/package-lock.json', 'extensions/vscode/package-lock.json') }} + + - name: Cache packages node_modules + uses: actions/cache@v4 + with: + path: | + packages/*/node_modules + key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }} + + - name: Cache core node modules + uses: actions/cache@v4 + with: + path: core/node_modules + key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} + + - name: Cache vscode extension node modules + uses: actions/cache@v4 + id: vscode-cache + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Build packages and get test files + id: get-test-file-matrix + shell: bash + run: | + node ./scripts/build-packages.js + cd extensions/vscode + npm ci + npm run e2e:compile + if [[ "${{ inputs.is_fork }}" == "true" ]]; then + # Exclude SSH tests for forks + FILES=$(ls -1 e2e/_output/tests/*.test.js | grep -v "SSH" | jq -R . | jq -s .) + else + # Include all tests for non-forks + FILES=$(ls -1 e2e/_output/tests/*.test.js | jq -R . | jq -s .) + fi + echo "test_file_matrix<> $GITHUB_OUTPUT + echo "$FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ inputs.ci-github-token }} + + - name: Debug Outputs + shell: bash + run: | + echo "Test files: ${{ steps.get-test-file-matrix.outputs.test_file_matrix }}" + + - name: Build VS Code extension + uses: ./.github/actions/build-vscode-extension + with: + platform: linux + arch: x64 + npm_config_arch: x64 + pre-release: false + commit-sha: ${{ github.sha }} + github-token: ${{ inputs.github-token }} + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: vscode-extension-build-Linux + path: extensions/vscode/build \ No newline at end of file diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml new file mode 100644 index 00000000000..5b60c705909 --- /dev/null +++ b/.github/workflows/e2e-tests.yml @@ -0,0 +1,58 @@ +name: 'E2E Tests' +description: 'Reusable workflow for running VS Code E2E tests' + +on: + workflow_call: + inputs: + is_fork: + description: 'Whether this is running on a fork' + type: boolean + default: false + secrets: + CI_GITHUB_TOKEN: + required: true + GITHUB_TOKEN: + required: true + GH_ACTIONS_SSH_TEST_KEY_PEM: + required: false + GH_ACTIONS_SSH_TEST_DNS_NAME: + required: false + +jobs: + vscode-get-test-file-matrix: + runs-on: ubuntu-latest + outputs: + test_file_matrix: ${{ steps.get-matrix.outputs.test_file_matrix }} + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Get test matrix + id: get-matrix + uses: ./.github/actions/run-vscode-e2e-tests + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + ci-github-token: ${{ secrets.CI_GITHUB_TOKEN }} + is_fork: ${{ inputs.is_fork }} + + vscode-e2e-tests: + name: ${{ matrix.test_file || 'unknown' }} (${{ matrix.command }}) + needs: [vscode-get-test-file-matrix] + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }} + command: ["e2e:ci:run", "e2e:ci:run-yaml"] + steps: + - uses: actions/checkout@v5 + - name: Run VS Code E2E test + uses: ./.github/actions/run-vscode-e2e-test + with: + test_file: ${{ matrix.test_file }} + command: ${{ matrix.command }} + ssh_key: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} + ssh_host: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }} + is_fork: ${{ inputs.is_fork }} \ No newline at end of file diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index cf276f36099..d1d643db588 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -110,6 +110,7 @@ jobs: runs-on: ubuntu-latest needs: - build + - vscode-e2e-tests steps: - name: Checkout uses: actions/checkout@v5 @@ -135,10 +136,23 @@ jobs: token: ${{ secrets.CI_GITHUB_TOKEN }} repository: continuedev/continue + vscode-e2e-tests: + needs: check_release_name + if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' + uses: ./.github/workflows/e2e-tests.yml + with: + is_fork: false + secrets: + CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_ACTIONS_SSH_TEST_KEY_PEM: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} + GH_ACTIONS_SSH_TEST_DNS_NAME: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }} + publish: runs-on: ubuntu-latest needs: - build + - vscode-e2e-tests if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' permissions: contents: write diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index fb91e8d9761..9ac3a1b11a5 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -192,112 +192,15 @@ jobs: AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} - vscode-get-test-file-matrix: - runs-on: ubuntu-latest - outputs: - test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache npm - uses: actions/cache@v4 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-cache-matrix-${{ hashFiles('core/package-lock.json', 'extensions/vscode/package-lock.json') }} - - - name: Cache packages node_modules - uses: actions/cache@v4 - with: - path: | - packages/*/node_modules - key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }} - - - name: Cache core node modules - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - name: Cache vscode extension node modules - uses: actions/cache@v4 - id: vscode-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - name: Build packages and get test files - id: vscode-get-test-file-matrix - run: | - node ./scripts/build-packages.js - cd extensions/vscode - npm ci - npm run e2e:compile - if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" || "${{ github.actor }}" == "dependabot[bot]" ]]; then - # Exclude SSH tests for forks - FILES=$(ls -1 e2e/_output/tests/*.test.js | grep -v "SSH" | jq -R . | jq -s .) - else - # Include all tests for non-forks - FILES=$(ls -1 e2e/_output/tests/*.test.js | jq -R . | jq -s .) - fi - echo "test_file_matrix<> $GITHUB_OUTPUT - echo "$FILES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - name: Debug Outputs - run: | - echo "Test files: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}" - - vscode-package-extension-linux: - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Build VS Code extension - uses: ./.github/actions/build-vscode-extension - with: - platform: linux - arch: x64 - npm_config_arch: x64 - pre-release: false - commit-sha: ${{ github.sha }} - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: vscode-extension-build-Linux - path: extensions/vscode/build - vscode-e2e-tests: - name: ${{ matrix.test_file || 'unknown' }} (${{ matrix.command }}) - needs: [vscode-get-test-file-matrix, vscode-package-extension-linux] - runs-on: ubuntu-latest - timeout-minutes: 15 - # Tests requiring secrets need approval from maintainers - strategy: - fail-fast: false - matrix: - test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }} - command: ["e2e:ci:run", "e2e:ci:run-yaml"] - steps: - - uses: actions/checkout@v5 - - name: Run VS Code E2E test - uses: ./.github/actions/run-vscode-e2e-test - with: - test_file: ${{ matrix.test_file }} - command: ${{ matrix.command }} - ssh_key: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} - ssh_host: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }} - is_fork: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} + uses: ./.github/workflows/e2e-tests.yml + with: + is_fork: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} + secrets: + CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_ACTIONS_SSH_TEST_KEY_PEM: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} + GH_ACTIONS_SSH_TEST_DNS_NAME: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }} jetbrains-tests: runs-on: ubuntu-latest @@ -350,8 +253,6 @@ jobs: - vscode-checks - get-packages-matrix - packages-checks - - vscode-get-test-file-matrix - - vscode-package-extension-linux - vscode-e2e-tests - jetbrains-tests - pr-review-action-tests From 3ce945e8e50c22681affce1d4419c14967f1e37b Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 15 Aug 2025 17:45:15 -0700 Subject: [PATCH 2/2] fix broken workflow --- .../actions/run-vscode-e2e-tests/action.yml | 99 ------------------- .github/workflows/e2e-tests.yml | 83 ++++++++++++++-- 2 files changed, 75 insertions(+), 107 deletions(-) delete mode 100644 .github/actions/run-vscode-e2e-tests/action.yml diff --git a/.github/actions/run-vscode-e2e-tests/action.yml b/.github/actions/run-vscode-e2e-tests/action.yml deleted file mode 100644 index 210aa44c2a1..00000000000 --- a/.github/actions/run-vscode-e2e-tests/action.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: 'Run VS Code E2E Tests' -description: 'Runs VS Code E2E tests with test matrix generation and execution' -inputs: - github-token: - description: 'GitHub token for accessing private repositories' - required: true - ci-github-token: - description: 'CI GitHub token for accessing private repositories' - required: true - ssh_key: - description: 'SSH key for SSH tests' - required: false - ssh_host: - description: 'SSH host for SSH tests' - required: false - is_fork: - description: 'Whether this is running on a fork' - required: false - default: 'false' -outputs: - test_file_matrix: - description: 'Matrix of test files to run' - value: ${{ steps.get-test-file-matrix.outputs.test_file_matrix }} - -runs: - using: "composite" - steps: - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache npm - uses: actions/cache@v4 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-cache-matrix-${{ hashFiles('core/package-lock.json', 'extensions/vscode/package-lock.json') }} - - - name: Cache packages node_modules - uses: actions/cache@v4 - with: - path: | - packages/*/node_modules - key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }} - - - name: Cache core node modules - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - name: Cache vscode extension node modules - uses: actions/cache@v4 - id: vscode-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - name: Build packages and get test files - id: get-test-file-matrix - shell: bash - run: | - node ./scripts/build-packages.js - cd extensions/vscode - npm ci - npm run e2e:compile - if [[ "${{ inputs.is_fork }}" == "true" ]]; then - # Exclude SSH tests for forks - FILES=$(ls -1 e2e/_output/tests/*.test.js | grep -v "SSH" | jq -R . | jq -s .) - else - # Include all tests for non-forks - FILES=$(ls -1 e2e/_output/tests/*.test.js | jq -R . | jq -s .) - fi - echo "test_file_matrix<> $GITHUB_OUTPUT - echo "$FILES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ inputs.ci-github-token }} - - - name: Debug Outputs - shell: bash - run: | - echo "Test files: ${{ steps.get-test-file-matrix.outputs.test_file_matrix }}" - - - name: Build VS Code extension - uses: ./.github/actions/build-vscode-extension - with: - platform: linux - arch: x64 - npm_config_arch: x64 - pre-release: false - commit-sha: ${{ github.sha }} - github-token: ${{ inputs.github-token }} - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: vscode-extension-build-Linux - path: extensions/vscode/build \ No newline at end of file diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 5b60c705909..95d5105fe65 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,5 +1,4 @@ name: 'E2E Tests' -description: 'Reusable workflow for running VS Code E2E tests' on: workflow_call: @@ -22,23 +21,91 @@ jobs: vscode-get-test-file-matrix: runs-on: ubuntu-latest outputs: - test_file_matrix: ${{ steps.get-matrix.outputs.test_file_matrix }} + test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Cache npm + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-cache-matrix-${{ hashFiles('core/package-lock.json', 'extensions/vscode/package-lock.json') }} + + - name: Cache packages node_modules + uses: actions/cache@v4 + with: + path: | + packages/*/node_modules + key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }} + + - name: Cache core node modules + uses: actions/cache@v4 + with: + path: core/node_modules + key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} + + - name: Cache vscode extension node modules + uses: actions/cache@v4 + id: vscode-cache + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Build packages and get test files + id: vscode-get-test-file-matrix + run: | + node ./scripts/build-packages.js + cd extensions/vscode + npm ci + npm run e2e:compile + if [[ "${{ inputs.is_fork }}" == "true" ]]; then + # Exclude SSH tests for forks + FILES=$(ls -1 e2e/_output/tests/*.test.js | grep -v "SSH" | jq -R . | jq -s .) + else + # Include all tests for non-forks + FILES=$(ls -1 e2e/_output/tests/*.test.js | jq -R . | jq -s .) + fi + echo "test_file_matrix<> $GITHUB_OUTPUT + echo "$FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: Debug Outputs + run: | + echo "Test files: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}" + + vscode-package-extension-linux: + runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - - name: Get test matrix - id: get-matrix - uses: ./.github/actions/run-vscode-e2e-tests + - name: Build VS Code extension + uses: ./.github/actions/build-vscode-extension with: + platform: linux + arch: x64 + npm_config_arch: x64 + pre-release: false + commit-sha: ${{ github.sha }} github-token: ${{ secrets.GITHUB_TOKEN }} - ci-github-token: ${{ secrets.CI_GITHUB_TOKEN }} - is_fork: ${{ inputs.is_fork }} + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: vscode-extension-build-Linux + path: extensions/vscode/build vscode-e2e-tests: name: ${{ matrix.test_file || 'unknown' }} (${{ matrix.command }}) - needs: [vscode-get-test-file-matrix] + needs: [vscode-get-test-file-matrix, vscode-package-extension-linux] runs-on: ubuntu-latest timeout-minutes: 15 strategy: