diff --git a/.continue/rules/documentation-standards.md b/.continue/rules/documentation-standards.md index 4fa6984de..b93aefd71 100644 --- a/.continue/rules/documentation-standards.md +++ b/.continue/rules/documentation-standards.md @@ -12,7 +12,7 @@ alwaysApply: false ### Conversational and Direct -- Follow Docusaurus documentation standards +- Follow Mintlify documentation standards - Use simple, conversational language that gets straight to the point - Avoid overly technical jargon when simpler terms work - Write as if speaking directly to the developer using the tool diff --git a/.continue/rules/typescript-enum-usage.md b/.continue/rules/typescript-enum-usage.md new file mode 100644 index 000000000..34728c1d5 --- /dev/null +++ b/.continue/rules/typescript-enum-usage.md @@ -0,0 +1,6 @@ +--- +globs: "**/*.{ts,tsx}" +alwaysApply: false +--- + +Use enums instead of simple string unions when possible in TypeScript code diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 4a0595a38..cc85d0d0a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -11,6 +11,8 @@ body: attributes: label: Before submitting your bug report options: + - label: I've tried using the "Ask AI" feature on the [Continue docs site](https://docs.continue.dev/) to see if the docs have an answer + required: false - label: I believe this is a bug. I'll try to join the [Continue Discord](https://discord.gg/NWtdYexhMs) for questions required: false - label: I'm not able to find an [open issue](https://github.com/continuedev/continue/issues?q=is%3Aopen+is%3Aissue) that reports the same bug diff --git a/.github/actions/build-vscode-extension/action.yml b/.github/actions/build-vscode-extension/action.yml new file mode 100644 index 000000000..fb17816f2 --- /dev/null +++ b/.github/actions/build-vscode-extension/action.yml @@ -0,0 +1,150 @@ +name: 'Build VS Code Extension' +description: 'Build VS Code extension for a specific platform' +inputs: + platform: + description: 'Target platform (win32, linux, alpine, darwin)' + required: true + arch: + description: 'Target architecture (x64, arm64, armhf)' + required: true + npm_config_arch: + description: 'npm config arch (x64, arm64, arm)' + required: true + pre-release: + description: 'Whether to build as pre-release' + required: false + default: 'false' + commit-sha: + description: 'Commit SHA for version modification (optional, uses first 7 chars)' + required: false + default: '' +outputs: + target: + description: 'The target string used for the build' + value: ${{ steps.set-target.outputs.target }} + vsix-path: + description: 'Path to the generated VSIX file' + value: 'extensions/vscode/*.vsix' + build-path: + description: 'Path to the build artifacts' + value: 'extensions/vscode/build' + +runs: + using: 'composite' + steps: + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Set target variable + id: set-target + shell: bash + run: echo "target=${{ inputs.platform }}-${{ inputs.arch }}" >> $GITHUB_OUTPUT + + - name: Cache npm + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-cache-build-${{ hashFiles('**/package-lock.json') }} + + - name: Cache extension node_modules + uses: actions/cache@v4 + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Cache core node_modules + uses: actions/cache@v4 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache gui node_modules + uses: actions/cache@v4 + with: + path: gui/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('gui/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: Build packages + shell: bash + run: node ./scripts/build-packages.js + + - name: Install extension dependencies + shell: bash + run: | + cd extensions/vscode + npm ci + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} + + - name: Install gui dependencies + shell: bash + run: | + cd gui + npm ci + + - name: Install core dependencies + shell: bash + run: | + cd core + npm ci + npm i vectordb + + - name: Prepackage the extension + shell: bash + run: | + cd extensions/vscode + npm run prepackage -- --target ${{ steps.set-target.outputs.target }} + + - name: Re-install esbuild + shell: bash + run: | + cd extensions/vscode + npm install -f esbuild + + - name: Modify package.json version with commit SHA + if: inputs.commit-sha != '' + shell: bash + run: | + cd extensions/vscode + # Get current version from package.json + CURRENT_VERSION=$(node -p "require('./package.json').version") + + # Create new version with short commit SHA (first 7 chars) + COMMIT_SHORT="${{ inputs.commit-sha }}" + NEW_VERSION="${CURRENT_VERSION}-${COMMIT_SHORT:0:7}" + + echo "๐Ÿ“ Updating package.json version from $CURRENT_VERSION to $NEW_VERSION" + + # Update version in package.json + sed -i.bak "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEW_VERSION\"/" package.json + + # Remove backup file + rm -f package.json.bak + + # Verify the change + echo "โœ… New version: $(node -p "require('./package.json').version")" + + - name: Package extension (build artifacts) + shell: bash + run: | + cd extensions/vscode + npm run package + + - name: Package extension (.vsix files) + shell: bash + run: | + cd extensions/vscode + if [ "${{ inputs.pre-release }}" = "true" ]; then + npx vsce package --pre-release --no-dependencies --target ${{ steps.set-target.outputs.target }} + else + npx vsce package --no-dependencies --target ${{ steps.set-target.outputs.target }} + fi \ No newline at end of file diff --git a/.github/actions/run-jetbrains-tests/action.yml b/.github/actions/run-jetbrains-tests/action.yml new file mode 100644 index 000000000..71051101d --- /dev/null +++ b/.github/actions/run-jetbrains-tests/action.yml @@ -0,0 +1,139 @@ +name: "Run JetBrains Tests" +description: "Setup and run JetBrains IntelliJ tests with all dependencies" + +inputs: + github-token: + description: "GitHub token for accessing repositories" + required: true + ci-github-token: + description: "CI GitHub token for vscode extension build" + required: true + +runs: + using: "composite" + steps: + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - uses: actions/cache@v4 + with: + path: core/node_modules + key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} + + - name: Build packages and install core dependencies + shell: bash + run: | + node ./scripts/build-packages.js + cd core + npm ci + + - name: Setup Java + uses: actions/setup-java@v4.5.0 + with: + distribution: zulu + java-version: 17 + + - name: Setup FFmpeg + uses: AnimMouse/setup-ffmpeg@v1 + with: + token: ${{ inputs.github-token }} + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-cache-jetbrains-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - uses: actions/cache@v4 + id: vscode-extension-cache + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - uses: actions/cache@v4 + id: gui-cache + with: + path: gui/node_modules + key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} + + # Cache prepackaged extension build to share with other jobs + - uses: actions/cache@v4 + id: vscode-prepackage-cache + with: + path: extensions/vscode/build + key: ${{ runner.os }}-vscode-prepackage-${{ hashFiles('extensions/vscode/package-lock.json', 'extensions/vscode/**/*.ts', 'extensions/vscode/**/*.json') }} + + # Only run prepackage if not cached - saves ~1 minute + - name: Run prepackage script + if: steps.vscode-prepackage-cache.outputs.cache-hit != 'true' + shell: bash + run: | + cd extensions/vscode + if [ "${{ steps.vscode-extension-cache.outputs.cache-hit }}" != "true" ]; then + npm ci + fi + npm run prepackage + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ inputs.ci-github-token }} + + - uses: actions/cache@v4 + id: binary-cache + with: + path: binary/node_modules + key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} + + - name: Build the binaries + shell: bash + run: | + cd binary + npm run build + + - name: Start test IDE + shell: bash + run: | + cd extensions/intellij + export DISPLAY=:99.0 + Xvfb -ac :99 -screen 0 1920x1080x24 & + sleep 10 + mkdir -p build/reports + ./gradlew runIdeForUiTests & + + - name: Wait for JB connection + uses: jtalk/url-health-check-action@v3 + with: + url: http://127.0.0.1:8082 + max-attempts: 15 + retry-delay: 30s + + - name: Run tests + shell: bash + run: | + cd extensions/intellij + export DISPLAY=:99.0 + ./gradlew test + + - name: Move video + if: ${{ failure() }} + shell: bash + run: | + cd extensions/intellij + mv video build/reports + + - name: Copy logs + if: ${{ failure() }} + shell: bash + run: | + cd extensions/intellij + mv build/idea-sandbox/system/log/ build/reports + + - name: Save fails report + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: jb-failure-report + path: | + ${{ github.workspace }}/extensions/intellij/build/reports diff --git a/.github/actions/run-vscode-e2e-test/action.yml b/.github/actions/run-vscode-e2e-test/action.yml new file mode 100644 index 000000000..1fcba5245 --- /dev/null +++ b/.github/actions/run-vscode-e2e-test/action.yml @@ -0,0 +1,134 @@ +name: 'Run VS Code E2E Test' +description: 'Run a single VS Code E2E test with all required setup' +inputs: + test_file: + description: 'E2E test file to run' + required: true + command: + description: 'Command to run (e2e:ci:run or e2e:ci:run-yaml)' + required: true + ssh_key: + description: 'SSH private key for testing' + required: false + ssh_host: + description: 'SSH host for testing' + required: false + is_fork: + description: 'Whether this is a fork (affects SSH tests)' + required: false + default: 'false' + +runs: + using: 'composite' + steps: + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - uses: actions/cache@v4 + id: vscode-node-modules-cache + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} + + # We don't want to cache the Continue extension, so it is deleted at the end of the job + - uses: actions/cache@v4 + id: test-extensions-cache + with: + path: extensions/vscode/e2e/.test-extensions + key: CONSTANT + + - uses: actions/cache@v4 + id: storage-cache + with: + path: extensions/vscode/e2e/storage + key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: vscode-extension-build-Linux + path: extensions/vscode/build + + - name: Build packages and download e2e dependencies + shell: bash + run: | + node ./scripts/build-packages.js + if [ "${{ steps.storage-cache.outputs.cache-hit }}" != "true" ]; then + cd core + npm ci + cd ../extensions/vscode + npm run e2e:ci:download + else + cd core + npm ci + fi + + - name: Fix VSCode binary permissions + shell: bash + run: | + chmod +x extensions/vscode/e2e/storage/VSCode-linux-x64/code + chmod +x extensions/vscode/e2e/storage/chromedriver-linux64/chromedriver + + - name: Set up SSH + if: ${{ inputs.ssh_key != '' && inputs.ssh_host != '' && inputs.is_fork == 'false' }} + shell: bash + env: + SSH_KEY: ${{ inputs.ssh_key }} + SSH_HOST: ${{ inputs.ssh_host }} + run: | + mkdir -p ~/.ssh + echo "$SSH_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts + echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config + + - name: Set up Xvfb + shell: bash + run: | + Xvfb :99 & + export DISPLAY=:99 + + - name: Run e2e tests + shell: bash + run: | + cd extensions/vscode + IGNORE_SSH_TESTS="${{ inputs.is_fork }}" TEST_FILE="${{ inputs.test_file }}" npm run ${{ inputs.command }} + env: + DISPLAY: :99 + + - name: Delete continue from test extensions + shell: bash + run: | + cd extensions/vscode + rm -rf e2e/.test-extensions/continue* + + - name: Sanitize test file name + id: sanitize_filename + if: always() + shell: bash + run: | + FILENAME="${{ inputs.test_file }}" + SANITIZED_FILENAME="${FILENAME//\//-}" # Replace / with - using bash parameter expansion + echo "sanitized_test_file=${SANITIZED_FILENAME}" >> $GITHUB_OUTPUT + + - name: Upload e2e test screenshots + if: failure() + uses: actions/upload-artifact@v4 + with: + name: e2e-failure-screenshots-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ inputs.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }} + path: extensions/vscode/e2e/storage/screenshots + + - name: Find e2e log file + if: always() + shell: bash + run: | + echo "Searching for e2e.log file..." + find $GITHUB_WORKSPACE -name "e2e.log" -type f + + - name: Upload e2e logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: e2e-logs-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ inputs.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }} + path: extensions/vscode/e2e.log \ No newline at end of file diff --git a/.github/actions/setup-component/action.yml b/.github/actions/setup-component/action.yml new file mode 100644 index 000000000..d05de3bfb --- /dev/null +++ b/.github/actions/setup-component/action.yml @@ -0,0 +1,51 @@ +name: 'Setup Component' +description: 'Cache and install dependencies for a specific component' +inputs: + component: + description: 'Component name (core, gui, vscode, binary)' + required: true + include-packages: + description: 'Whether to include packages cache (default: true)' + required: false + default: 'true' + include-root: + description: 'Whether to include root cache (default: false)' + required: false + default: 'false' + +runs: + using: 'composite' + steps: + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + - uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-cache-${{ inputs.component }}-${{ hashFiles(inputs.component == 'vscode' && 'extensions/vscode/package-lock.json' || format('{0}/package-lock.json', inputs.component)) }} + + - uses: actions/cache@v4 + if: inputs.include-packages == 'true' + with: + path: | + packages/*/node_modules + key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }} + + - uses: actions/cache@v4 + if: inputs.include-root == 'true' + with: + path: node_modules + key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} + + - uses: actions/cache@v4 + id: component-cache + with: + path: ${{ inputs.component == 'vscode' && 'extensions/vscode/node_modules' || format('{0}/node_modules', inputs.component) }} + key: ${{ runner.os }}-${{ inputs.component }}-node-modules-${{ hashFiles(inputs.component == 'vscode' && 'extensions/vscode/package-lock.json' || format('{0}/package-lock.json', inputs.component)) }} + + - name: Install component dependencies + if: steps.component-cache.outputs.cache-hit != 'true' + shell: bash + run: | + cd ${{ inputs.component == 'vscode' && 'extensions/vscode' || inputs.component }} + npm ci \ No newline at end of file diff --git a/.github/actions/setup-packages/action.yml b/.github/actions/setup-packages/action.yml new file mode 100644 index 000000000..2c49e21bc --- /dev/null +++ b/.github/actions/setup-packages/action.yml @@ -0,0 +1,23 @@ +name: "Setup Packages" +description: "Cache and build packages with npm caching" + +runs: + using: "composite" + steps: + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + - uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-cache-packages-${{ hashFiles('packages/*/package-lock.json') }} + + - uses: actions/cache@v4 + with: + path: | + packages/*/node_modules + key: ${{ runner.os }}-packages-node-modules-${{ hashFiles('packages/*/package-lock.json') }} + + - name: Build packages + shell: bash + run: node ./scripts/build-packages.js diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml deleted file mode 100644 index ed05df6f9..000000000 --- a/.github/auto_assign.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Reference: https://github.com/marketplace/actions/auto-assign-action -addAssignees: true - -assignees: - - sestinj - - Patrick-Erichsen - - tomasz-stefaniak - - RomneyDa - -numberOfAssignees: 2 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 2497e28dc..348566cd8 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,9 +8,9 @@ - [] The relevant docs, if any, have been updated or created - [] The relevant tests, if any, have been updated or created -## Screenshots +## Screen recording or screenshot -[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ] +[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See [this PR](https://github.com/continuedev/continue/pull/6455) as a good example. ] ## Tests diff --git a/.github/workflows/auto-assign-issue.yaml b/.github/workflows/auto-assign-issue.yaml index 940f7cf54..1e62ae399 100644 --- a/.github/workflows/auto-assign-issue.yaml +++ b/.github/workflows/auto-assign-issue.yaml @@ -14,7 +14,7 @@ jobs: uses: pozil/auto-assign-issue@v2 with: repo-token: ${{ secrets.CI_GITHUB_TOKEN }} - assignees: sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa + assignees: Patrick-Erichsen,tomasz-stefaniak,RomneyDa,tingwai numOfAssignee: 1 # - name: "Add default labels" # uses: actions-ecosystem/action-add-labels@v1 diff --git a/.github/workflows/auto-assign-pr.yaml b/.github/workflows/auto-assign-pr.yaml deleted file mode 100644 index 4fd701a15..000000000 --- a/.github/workflows/auto-assign-pr.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: PR assignment -on: - pull_request: - types: [opened, ready_for_review] - -jobs: - add-reviews: - runs-on: ubuntu-latest - steps: - - uses: kentaro-m/auto-assign-action@v2.0.0 diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 43d65d5b5..031ed1fbe 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -4,8 +4,9 @@ on: push: branches: - nate/auto-main-release-draft - schedule: - - cron: "0 17 * * 1,3,5" # Run at 9am PST (17:00 UTC) on Monday, Wednesday, Friday + # Not using this now because making drafts was just noisy. Will be useful when we are ready for automated releases. + # schedule: + # - cron: "0 17 * * 1,3,5" # Run at 9am PST (17:00 UTC) on Monday, Wednesday, Friday workflow_dispatch: # Keep manual trigger option jobs: diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml index 1c4adce0c..724227354 100644 --- a/.github/workflows/compliance.yaml +++ b/.github/workflows/compliance.yaml @@ -12,7 +12,7 @@ concurrency: jobs: conventional-commits: - name: Validate Conventional Commits (Warning Only) + name: Validate Conventional Commits runs-on: ubuntu-latest if: ${{ !github.event.pull_request.draft }} continue-on-error: true @@ -21,22 +21,26 @@ jobs: issues: write contents: read steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Validate PR title format + id: pr-title-check + run: | + PR_TITLE="${{ github.event.pull_request.title }}" + echo "Checking PR title: $PR_TITLE" - - name: Validate conventional commits - id: commitlint - uses: wagoid/commitlint-github-action@v6 - with: - configFile: .commitlintrc.warning.json - # Only check the last commit instead of all commits in the PR - commitDepth: 1 - continue-on-error: true + # Regex pattern for conventional commits + PATTERN="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?: .+" - - name: Add commit message guidance comment - if: steps.commitlint.outcome == 'failure' + if [[ $PR_TITLE =~ $PATTERN ]]; then + echo "โœ… PR title follows conventional commit format" + echo "valid=true" >> $GITHUB_OUTPUT + else + echo "โŒ PR title does not follow conventional commit format" + echo "valid=false" >> $GITHUB_OUTPUT + exit 1 + fi + + - name: Add PR title guidance comment + if: steps.pr-title-check.outputs.valid == 'false' uses: actions/github-script@v7 with: script: | @@ -48,7 +52,7 @@ jobs: const botComment = comments.find(comment => comment.user.type === 'Bot' && - comment.body.includes('Conventional Commit Format') + comment.body.includes('PR Title Format') ); if (!botComment) { @@ -57,17 +61,13 @@ jobs: repo: context.repo.repo, issue_number: context.issue.number, body: [ - "## โš ๏ธ Conventional Commit Format", + "## โš ๏ธ PR Title Format", "", - "Your latest commit message doesn't follow the conventional commit format, but **this won't block your PR from being merged**. We recommend downloading [this extension](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits) if you are using VS Code.", + "Your PR title doesn't follow the conventional commit format, but **this won't block your PR from being merged**. We recommend using this format for better project organization.", "", "### Expected Format:", "```", "[optional scope]: ", - "", - "[optional body]", - "", - "[optional footer(s)]", "```", "", "### Examples:", diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 956d249c4..fe1351edf 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -63,7 +63,6 @@ jobs: - name: Bump version in gradle.properties run: | - cd extensions/intellij awk '/pluginVersion=/{split($0,a,"="); split(a[2],b,"."); b[3]+=1; printf "%s=%s.%s.%s\n",a[1],b[1],b[2],b[3];next}1' gradle.properties > tmp && mv tmp gradle.properties rm -rf tmp NEW_VERSION=$(grep 'pluginVersion=' gradle.properties | cut -d'=' -f2) @@ -88,7 +87,7 @@ jobs: needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' name: Build Plugin - runs-on: macos-latest + runs-on: macos-13 permissions: contents: write pull-requests: write @@ -168,7 +167,7 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - name: Build packages (Unix) - run: cd ../.. && ./scripts/build-packages.sh + run: cd ../.. && node ./scripts/build-packages.js # npm install core - name: Install core node_modules @@ -224,10 +223,6 @@ jobs: # apple-product-id: dev.continue.continue-binary # options: --options runtime --entitlements entitlements.xml - # Build plugin - - name: Build plugin - run: ./gradlew buildPlugin - # Publish the plugin to JetBrains Marketplace - name: Publish EAP Plugin if: github.event_name == 'release' || github.event.inputs.publish_build == 'true' @@ -237,7 +232,7 @@ jobs: PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} RELEASE_CHANNEL: eap - run: ./gradlew publishPlugin + run: ./gradlew publishPlugin --info --stacktrace - name: Publish Stable Plugin if: github.event_name == 'release' || github.event.inputs.publish_build == 'true' @@ -247,7 +242,7 @@ jobs: PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} RELEASE_CHANNEL: default - run: ./gradlew publishPlugin + run: ./gradlew publishPlugin --info --stacktrace # Prepare plugin archive content for creating artifact - name: Prepare Plugin Artifact @@ -330,7 +325,7 @@ jobs: platform: darwin arch: x64 npm_config_arch: x64 - - os: macos-latest + - os: macos-13 platform: darwin arch: arm64 npm_config_arch: arm64 diff --git a/.github/workflows/label-merged-prs.yml b/.github/workflows/label-merged-prs.yml new file mode 100644 index 000000000..c3c034117 --- /dev/null +++ b/.github/workflows/label-merged-prs.yml @@ -0,0 +1,121 @@ +name: Label Merged PRs + +on: + pull_request: + types: [closed] + +jobs: + label-pr: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Check if author is in tier list + id: check-author + run: | + USERS=( + "TyDunn" + "jpoly1219" + "bdougie" + "uinstinct" + "sestinj" + "tingwai" + "tomasz-stefaniak" + "RomneyDa" + "Patrick-Erichsen" + ) + + PR_AUTHOR="${{ github.event.pull_request.user.login }}" + SHOULD_LABEL="false" + + for user in "${USERS[@]}"; do + if [[ "$PR_AUTHOR" == "$user" ]]; then + SHOULD_LABEL="true" + break + fi + done + + echo "should_label=$SHOULD_LABEL" >> $GITHUB_OUTPUT + + - name: Determine and apply tier label + if: steps.check-author.outputs.should_label == 'true' + uses: actions/github-script@v7 + with: + script: | + const pr = context.payload.pull_request; + + // Check if PR already has a tier label + const existingLabels = pr.labels.map(l => l.name); + if (existingLabels.some(label => label.match(/^tier [1-3]$/))) { + console.log('PR already has a tier label, skipping'); + return; + } + + // Function to extract conventional commit prefix + function getConventionalPrefix(title) { + const match = title.match(/^([a-z]+)(\s|$|:)/); + return match ? match[1] : ''; + } + + // Function to determine tier + function determineTier(pr) { + const additions = pr.additions; + const deletions = pr.deletions; + const changedFiles = pr.changed_files; + const title = pr.title; + const body = pr.body || ''; + + const prefix = getConventionalPrefix(title); + + // If no conventional commit prefix, skip + if (!prefix) { + console.log('No conventional commit format, skipping'); + return null; + } + + // Tier 4 (unlabeled): fix, test, docs, style, refactor, perf, build, ci, revert, improve + const tier4Prefixes = ['fix', 'test', 'docs', 'style', 'refactor', 'perf', 'build', 'ci', 'revert', 'chore', 'improve']; + if (tier4Prefixes.includes(prefix)) { + console.log('Tier 4 prefix detected, will remain unlabeled'); + return null; + } + + const totalChanges = additions + deletions; + + // Tier 1: Major features (1000+ lines changed, or 20+ files, or feat with large scope) + if (totalChanges > 1000 || changedFiles > 20 || + (prefix === 'feat' && totalChanges > 800) || + title.match(/(major|milestone|launch)/)) { + return 'tier 1'; + } + + // Tier 2: Important features (500+ lines changed, or 10+ files, or standard feat) + if (totalChanges > 500 || changedFiles > 10 || prefix === 'feat') { + return 'tier 2'; + } + + // Tier 3: Smaller improvements + return 'tier 3'; + } + + const tier = determineTier(pr); + + if (tier) { + console.log(`Assigning ${tier} label to PR #${pr.number}`); + console.log(`Title: ${pr.title}`); + console.log(`Changes: +${pr.additions} -${pr.deletions} (${pr.changed_files} files)`); + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + labels: [tier] + }); + + console.log(`โœ“ Label '${tier}' added successfully`); + } \ No newline at end of file diff --git a/.github/workflows/main-build.yaml b/.github/workflows/main-build.yaml new file mode 100644 index 000000000..75e4104ab --- /dev/null +++ b/.github/workflows/main-build.yaml @@ -0,0 +1,105 @@ +name: Main Branch Build + +# Download and republish VS Code extension artifacts when code is merged to main +on: + push: + branches: + - main + workflow_dispatch: + inputs: + test_pr_number: + description: "PR number to test with" + required: true + +jobs: + republish-pr-artifacts: + runs-on: ubuntu-latest + strategy: + matrix: + platform: [Linux, macOS] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 # Get the last 2 commits to find the merge commit + + - name: Get merged PR number + id: get-pr + run: | + # Get the commit message of the merge commit + COMMIT_MSG=$(git log --format=%B -n 1 HEAD) + echo "Commit message: $COMMIT_MSG" + + # Extract PR number from merge commit message (format: "Merge pull request #123 from...") + PR_NUMBER=$(echo "$COMMIT_MSG" | grep -o "Merge pull request #[0-9]*" | grep -o "[0-9]*" || echo "6723") + + if [ -z "$PR_NUMBER" ]; then + echo "โŒ Could not extract PR number from commit message. This might not be a PR merge." + echo "Commit message was: $COMMIT_MSG" + exit 1 + fi + + echo "Found PR number: $PR_NUMBER" + echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT + + - name: Find PR workflow run + id: find-run + env: + PR_NUMBER: ${{ steps.get-pr.outputs.pr_number }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "๐Ÿ” Getting branch name for PR #$PR_NUMBER..." + + # Get the branch name for the PR + BRANCH_NAME=$(gh pr view "$PR_NUMBER" --repo "${{ github.repository }}" --json headRefName --jq '.headRefName') + + if [ -z "$BRANCH_NAME" ]; then + echo "โŒ Could not find PR #$PR_NUMBER" + exit 1 + fi + + echo "Branch name: $BRANCH_NAME" + + # Get the latest successful workflow run for the branch + RUN_ID=$(gh run list \ + --repo "${{ github.repository }}" \ + --workflow="pr_checks.yaml" \ + --branch="$BRANCH_NAME" \ + --json databaseId,status,conclusion \ + --jq ".[] | select(.status == \"completed\" and .conclusion == \"success\") | .databaseId" \ + | head -1) + + if [ -z "$RUN_ID" ]; then + echo "โŒ No successful workflow run found for PR #$PR_NUMBER (branch: $BRANCH_NAME)" + exit 1 + fi + + echo "Found successful workflow run: $RUN_ID" + echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT + + - name: Download PR artifact + env: + RUN_ID: ${{ steps.find-run.outputs.run_id }} + PLATFORM: ${{ matrix.platform }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "๐Ÿ“ฅ Downloading vscode-extension-build-$PLATFORM artifact from run $RUN_ID..." + + # Create temporary directory for download + mkdir -p ./temp-download + + # Download the artifact from the PR workflow run + if ! gh run download "$RUN_ID" \ + --repo "${{ github.repository }}" \ + --name "vscode-extension-build-$PLATFORM" \ + --dir "./temp-download"; then + echo "โŒ Failed to download artifact vscode-extension-build-$PLATFORM from run $RUN_ID" + exit 1 + fi + + echo "โœ… Successfully downloaded artifact" + + - name: Republish as main branch artifact + uses: actions/upload-artifact@v4 + with: + name: vscode-extension-build-${{ matrix.platform }} + path: ./temp-download/* diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ce1e59e66..2024b083b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -29,6 +29,7 @@ jobs: build: needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' + runs-on: ${{ matrix.os }} strategy: matrix: include: @@ -64,9 +65,33 @@ jobs: platform: darwin arch: arm64 npm_config_arch: arm64 - runs-on: ${{ matrix.os }} steps: - # 1. Check-out repository + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - uses: ./.github/actions/build-vscode-extension + with: + platform: ${{ matrix.platform }} + arch: ${{ matrix.arch }} + npm_config_arch: ${{ matrix.npm_config_arch }} + pre-release: false + env: + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: Upload .vsix artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix + path: "extensions/vscode/*.vsix" + + check-version: + runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@v4 with: @@ -80,107 +105,6 @@ jobs: cd extensions/vscode node scripts/versionCheck.js - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache extension node_modules - uses: actions/cache@v3 - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - - name: Build packages (Windows) - run: ./scripts/build-packages.ps1 - if: matrix.os == 'windows-latest' - - - name: Build packages (Unix) - run: ./scripts/build-packages.sh - if: matrix.os != 'windows-latest' - - - name: Install extension Dependencies - run: | - cd extensions/vscode - npm ci - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - name: Install gui Dependencies - run: | - cd gui - npm ci - - # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - - name: Install Core Dependencies - run: | - cd core - npm ci - npm i vectordb - - # - name: Run core tests - # run: | - # cd core - # npm run test - # env: - # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - - # 2.5. Pre package - - name: Set var for environment info - shell: pwsh - run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV - - - name: Prepackage the extension - run: | - cd extensions/vscode - npm run prepackage -- --target ${{ env.target }} - - # 3. Re-install esbuild (for cases that we force installed for another arch in prepackage.js) - - name: Re-install esbuild - run: | - cd extensions/vscode - npm install -f esbuild - - # 4. Run tests for the extension - # - name: Install Xvfb for Linux and run tests - # run: | - # sudo apt-get install -y xvfb # Install Xvfb - # Xvfb :99 & # Start Xvfb - # export DISPLAY=:99 # Export the display number to the environment - # cd extensions/vscode - # npm run test - # if: matrix.os == 'ubuntu-latest' - - # - name: Run extension tests - # run: | - # cd extensions/vscode - # npm run test - # if: matrix.os != 'ubuntu-latest' - - # 5. Package the extension - - name: Package the extension - run: cd extensions/vscode && npx vsce package --no-dependencies --target ${{ env.target }} - - # 6. Upload the .vsix as an artifact - - uses: actions/upload-artifact@v4 - with: - name: ${{ env.target }}-vsix - path: "extensions/vscode/*.vsix" - release: permissions: contents: write diff --git a/.github/workflows/pr-build-upload-vsix.yaml b/.github/workflows/pr-build-upload-vsix.yaml new file mode 100644 index 000000000..17a3dc5ba --- /dev/null +++ b/.github/workflows/pr-build-upload-vsix.yaml @@ -0,0 +1,52 @@ +name: PR Build And Upload VSIX + +# Builds and uploads VSIX artifacts for the `oneper` script across Linux, Windows, and macOS ARM platforms +on: + pull_request: + branches: + - main + +jobs: + build-and-upload-vsix: + runs-on: ${{ matrix.runner }} + timeout-minutes: 10 + strategy: + matrix: + include: + - platform: linux + arch: x64 + runner: ubuntu-latest + - platform: win32 + arch: x64 + runner: windows-latest + - platform: darwin + arch: arm64 + runner: macos-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Build VS Code extension + uses: ./.github/actions/build-vscode-extension + with: + platform: ${{ matrix.platform }} + arch: ${{ matrix.arch }} + npm_config_arch: ${{ matrix.arch }} + pre-release: false + commit-sha: ${{ github.sha }} + env: + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: vscode-extension-build-${{ matrix.platform }}-${{ matrix.arch }} + path: extensions/vscode/build + + - name: Upload .vsix artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix + path: "extensions/vscode/*.vsix" diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml new file mode 100644 index 000000000..9ea007d5f --- /dev/null +++ b/.github/workflows/pr-checks.yaml @@ -0,0 +1,337 @@ +name: PR Checks + +# PR Checks run on all PRs to the main branch and must pass before merging. +on: + pull_request: + branches: + - main + + push: + branches: + - main + +jobs: + prettier-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - uses: actions/cache@v4 + id: root-cache + with: + path: node_modules + key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install root dependencies + if: steps.root-cache.outputs.cache-hit != 'true' + run: npm ci + + - name: Check code formatting with Prettier + run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" --ignore-path .gitignore --ignore-path .prettierignore + + core-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup packages + uses: ./.github/actions/setup-packages + - name: Setup core component + uses: ./.github/actions/setup-component + with: + component: core + include-root: true + + - name: Type check and lint + run: | + cd core + npx tsc --noEmit + npm run lint + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + + - name: Run tests + run: | + cd core + npm test + npm run vitest + env: + IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} + MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} + AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} + AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }} + AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} + AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} + + gui-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup packages + uses: ./.github/actions/setup-packages + - name: Setup core component + uses: ./.github/actions/setup-component + with: + component: core + include-root: true + - name: Setup gui component + uses: ./.github/actions/setup-component + with: + component: gui + include-packages: false + env: + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: Type check and lint + run: | + cd gui + npx tsc --noEmit + npm run lint + + - name: Run tests + run: | + cd gui + npm test + + binary-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup packages + uses: ./.github/actions/setup-packages + - name: Setup core component + uses: ./.github/actions/setup-component + with: + component: core + include-root: true + - name: Setup binary component + uses: ./.github/actions/setup-component + with: + component: binary + include-packages: false + + - name: Type check + run: | + cd binary + npx tsc --noEmit + + vscode-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup packages + uses: ./.github/actions/setup-packages + - name: Setup core component + uses: ./.github/actions/setup-component + with: + component: core + include-root: true + - name: Setup vscode component + uses: ./.github/actions/setup-component + with: + component: vscode + include-packages: false + env: + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: Type check and lint + run: | + cd extensions/vscode + npm run write-build-timestamp + npx tsc --noEmit + npm run lint + + - name: Run vitest tests + run: | + cd extensions/vscode + npm run vitest + + get-packages-matrix: + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.get-packages.outputs.packages }} + steps: + - uses: actions/checkout@v4 + - name: Get package list + id: get-packages + run: | + packages=$(find packages/ -maxdepth 1 -type d -not -path packages/ -exec basename {} \; | sort | jq -R -s -c 'split("\n")[:-1]') + echo "packages=$packages" >> $GITHUB_OUTPUT + echo "Found packages: $packages" + + packages-checks: + needs: get-packages-matrix + runs-on: ubuntu-latest + strategy: + matrix: + package: ${{ fromJson(needs.get-packages-matrix.outputs.packages) }} + steps: + - uses: actions/checkout@v4 + - name: Setup packages + uses: ./.github/actions/setup-packages + + - name: Test and check ${{ matrix.package }} + run: | + cd packages/${{ matrix.package }} + npm ci + npm test + env: + IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} + MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} + AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} + AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }} + AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} + 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@v4 + - 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@v4 + 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 }} + env: + GITHUB_TOKEN: ${{ secrets.CI_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@v4 + - 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]' }} + + jetbrains-tests: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - name: Run JetBrains tests + uses: ./.github/actions/run-jetbrains-tests + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + ci-github-token: ${{ secrets.CI_GITHUB_TOKEN }} + + # GitHub does not have a way of requiring that all checks pass (you must manually select each job) + # This action at least lets us manage the list of required tests via source control + # so that creators of new jobs can add them to this list + require-all-checks-to-pass: + if: always() + runs-on: ubuntu-latest + needs: + - prettier-check + - core-checks + - gui-checks + - binary-checks + - vscode-checks + - get-packages-matrix + - packages-checks + - vscode-get-test-file-matrix + - vscode-package-extension-linux + - vscode-e2e-tests + - jetbrains-tests + + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml deleted file mode 100644 index a88dad8c0..000000000 --- a/.github/workflows/pr_checks.yaml +++ /dev/null @@ -1,1117 +0,0 @@ -name: PR checks - -# PR Checks run on all PRs to the main branch and must pass before merging. -on: - pull_request: - branches: - - main - - push: - branches: - - main - -jobs: - install-root: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: root-cache - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - name: Install root dependencies - if: steps.root-cache.outputs.cache-hit != 'true' - run: npm ci - - prettier-check: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - name: Check code formatting with Prettier - run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" --ignore-path .gitignore --ignore-path .prettierignore - - install-config-yaml: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Install config-yaml dependencies - if: steps.config-yaml-cache.outputs.cache-hit != 'true' - run: | - cd packages/config-yaml - npm ci - - install-openai-adapters: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Install openai-adapters dependencies - if: steps.openai-adapters-cache.outputs.cache-hit != 'true' - run: | - cd packages/openai-adapters - npm ci - - config-yaml-checks: - needs: install-config-yaml - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build and check config-yaml - run: | - cd packages/config-yaml - npx tsc --noEmit - # Tests are currently failing, commenting out for now - # npm test - npm run build - - install-core: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: root-cache - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: core-cache - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - name: Install core dependencies - if: steps.core-cache.outputs.cache-hit != 'true' - run: | - cd core - npm ci - - core-checks: - needs: [install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: root-cache - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: core-cache - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - name: Type check and lint - run: | - cd core - npx tsc --noEmit - npm run lint - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - - install-gui: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: gui-cache - with: - path: gui/node_modules - key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install gui dependencies - if: steps.gui-cache.outputs.cache-hit != 'true' - run: | - cd gui - npm ci - - gui-checks: - needs: install-gui - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: gui-cache - with: - path: gui/node_modules - key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Type check and lint - run: | - cd gui - npx tsc --noEmit - npm run lint - - binary-checks: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: binary-cache - with: - path: binary/node_modules - key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install binary dependencies - if: steps.binary-cache.outputs.cache-hit != 'true' - run: | - cd binary - npm ci - - - name: Type check - run: | - cd binary - npx tsc --noEmit - - install-vscode: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - 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') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install vscode dependencies - if: steps.vscode-cache.outputs.cache-hit != 'true' - run: | - cd extensions/vscode - npm ci - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - vscode-checks: - needs: install-vscode - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - 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') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Type check and lint - run: | - cd extensions/vscode - npm run write-build-timestamp - npx tsc --noEmit - npm run lint - - - name: Run vitest tests - run: | - cd extensions/vscode - npm run vitest - - core-tests: - needs: [install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Run core tests - run: | - cd core - npm test - npm run vitest - env: - IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} - MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} - AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} - AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }} - AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} - AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} - - package-tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Install dependencies - run: | - cd packages/config-yaml - npm ci - - - name: Run config-yaml tests - run: | - cd packages/config-yaml - npm test - - openai-adapters-tests: - needs: install-openai-adapters - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Run openai-adapters tests - run: | - cd packages/openai-adapters - npm test - env: - IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} - MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} - AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} - AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }} - AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} - 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 - needs: [install-root, install-vscode, install-config-yaml] - outputs: - test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} - steps: - - uses: actions/checkout@v4 - - - name: Cache node modules - uses: actions/cache@v4 - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Get test files - id: vscode-get-test-file-matrix - run: | - 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: - runs-on: ubuntu-latest - needs: - [ - install-vscode, - install-core, - install-config-yaml, - install-openai-adapters, - ] - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: vscode-node-modules-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: core-node-modules-cache - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Package extension - run: | - cd extensions/vscode - npm run package - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: vscode-extension-build - path: extensions/vscode/build - - vscode-download-e2e-dependencies: - runs-on: ubuntu-latest - needs: - [ - install-vscode, - install-core, - install-config-yaml, - install-openai-adapters, - ] - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: vscode-node-modules-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: storage-cache - with: - path: extensions/vscode/e2e/storage - key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Download Dependencies - if: steps.storage-cache.outputs.cache-hit != 'true' - run: | - cd extensions/vscode - npm run e2e:ci:download - - - name: Upload e2e dependencies - uses: actions/upload-artifact@v4 - with: - name: vscode-e2e-dependencies - path: extensions/vscode/e2e/storage - - vscode-e2e-tests: - name: ${{ matrix.test_file || 'unknown' }} (${{ matrix.command }}) - needs: - [ - vscode-download-e2e-dependencies, - vscode-get-test-file-matrix, - vscode-package-extension, - install-vscode, - install-core, - install-config-yaml, - install-openai-adapters, - ] - runs-on: ubuntu-latest - # 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@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: vscode-node-modules-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - # We don't want to cache the Continue extension, so it is deleted at the end of the job - - uses: actions/cache@v4 - id: test-extensions-cache - with: - path: extensions/vscode/e2e/.test-extensions - key: CONSTANT - - - name: Download build artifact - uses: actions/download-artifact@v4 - with: - name: vscode-extension-build - path: extensions/vscode/build - - - name: Download e2e dependencies - uses: actions/download-artifact@v4 - with: - name: vscode-e2e-dependencies - path: extensions/vscode/e2e/storage - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Fix VSCode binary permissions - run: | - chmod +x extensions/vscode/e2e/storage/VSCode-linux-x64/code - chmod +x extensions/vscode/e2e/storage/chromedriver-linux64/chromedriver - - - name: Set up SSH - env: - SSH_KEY: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} - SSH_HOST: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }} - run: | - mkdir -p ~/.ssh - echo "$SSH_KEY" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts - echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config - if: ${{ github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' }} - - - name: Set up Xvfb - run: | - Xvfb :99 & - export DISPLAY=:99 - - - name: Run e2e tests - run: | - cd extensions/vscode - IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} - env: - DISPLAY: :99 - - - name: Delete continue from test extensions - run: | - cd extensions/vscode - rm -rf e2e/.test-extensions/continue* - - - name: Sanitize test file name - id: sanitize_filename - if: always() - run: | - FILENAME="${{ matrix.test_file }}" - SANITIZED_FILENAME="${FILENAME//\//-}" # Replace / with - using bash parameter expansion - echo "sanitized_test_file=${SANITIZED_FILENAME}" >> $GITHUB_OUTPUT - - - name: Upload e2e test screenshots - if: failure() - uses: actions/upload-artifact@v4 - with: - name: e2e-failure-screenshots-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ matrix.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }} - path: extensions/vscode/e2e/storage/screenshots - - - name: Find e2e log file - if: always() - run: | - echo "Searching for e2e.log file..." - find $GITHUB_WORKSPACE -name "e2e.log" -type f - - - name: Upload e2e logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: e2e-logs-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ matrix.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }} - path: extensions/vscode/e2e.log - - gui-tests: - needs: - [install-gui, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: gui-cache - with: - path: gui/node_modules - key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install GUI dependencies - if: steps.gui-cache.outputs.cache-hit != 'true' - run: cd gui && npm ci - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - name: Run gui tests - run: | - cd gui - npm test - - jetbrains-tests: - needs: - [install-root, core-checks, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Setup Java - uses: actions/setup-java@v4.5.0 - with: - distribution: zulu - java-version: 17 - - - name: Setup FFmpeg - uses: AnimMouse/setup-ffmpeg@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: gui-cache - with: - path: gui/node_modules - key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - # We can shave off another minute off our CI script by finding a way to share this with vscode-tests - - name: Run prepackage script - run: | - cd extensions/vscode - npm ci - npm run prepackage - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - uses: actions/cache@v4 - id: binary-cache - with: - path: binary/node_modules - key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} - - - name: Build the binaries - run: | - cd binary - npm run build - - - name: Start test IDE - run: | - cd extensions/intellij - export DISPLAY=:99.0 - Xvfb -ac :99 -screen 0 1920x1080x24 & - sleep 10 - mkdir -p build/reports - ./gradlew runIdeForUiTests & - - - name: Wait for JB connection - uses: jtalk/url-health-check-action@v3 - with: - url: http://127.0.0.1:8082 - max-attempts: 15 - retry-delay: 30s - - - name: Run tests - run: | - cd extensions/intellij - export DISPLAY=:99.0 - ./gradlew test - - - name: Move video - if: ${{ failure() }} - run: | - cd extensions/intellij - mv video build/reports - - - name: Copy logs - if: ${{ failure() }} - run: | - cd extensions/intellij - mv build/idea-sandbox/system/log/ build/reports - - - name: Save fails report - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: jb-failure-report - path: | - ${{ github.workspace }}/extensions/intellij/build/reports - - # GitHub does not have a way of requiring that all checks pass (you must manually select each job) - # This action at least lets us manage the list of required tests via source control - # so that creators of new jobs can add them to this list - require-all-checks-to-pass: - if: always() - runs-on: ubuntu-latest - needs: - - install-root - - prettier-check - - install-core - - core-checks - - install-gui - - gui-checks - - binary-checks - - install-vscode - - vscode-checks - - core-tests - - package-tests - - vscode-get-test-file-matrix - - vscode-package-extension - - vscode-download-e2e-dependencies - - vscode-e2e-tests - - gui-tests - - jetbrains-tests - - config-yaml-checks - - install-config-yaml - - install-openai-adapters - - openai-adapters-tests - - steps: - - name: Decide whether the needed jobs succeeded or failed - uses: re-actors/alls-green@release/v1 - with: - jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 3ef4920ed..611a96f5e 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -29,6 +29,7 @@ jobs: build: needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' + runs-on: ${{ matrix.os }} strategy: matrix: include: @@ -64,116 +65,28 @@ jobs: platform: darwin arch: arm64 npm_config_arch: arm64 - runs-on: ${{ matrix.os }} steps: - # 1. Check-out repository - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: - fetch-depth: 0 # This ensures all tags are fetched + fetch-depth: 0 - - name: Checkout tag - run: git checkout ${GITHUB_REF#refs/tags/} - - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" - - name: Cache extension node_modules - uses: actions/cache@v3 + - uses: ./.github/actions/build-vscode-extension with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - - name: Build packages (Windows) - run: ./scripts/build-packages.ps1 - if: matrix.os == 'windows-latest' - - - name: Build packages (Unix) - run: ./scripts/build-packages.sh - if: matrix.os != 'windows-latest' - - - name: Install extension Dependencies - run: | - cd extensions/vscode - npm ci + platform: ${{ matrix.platform }} + arch: ${{ matrix.arch }} + npm_config_arch: ${{ matrix.npm_config_arch }} + pre-release: true env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - name: Install gui Dependencies - run: | - cd gui - npm ci - - # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - - name: Install Core Dependencies - run: | - cd core - npm ci - npm i vectordb - - # - name: Run core tests - # run: | - # cd core - # npm run test - # env: - # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - - # 2.5. Pre package - - name: Set var for environment info - shell: pwsh - run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV - - - name: Prepackage the extension - run: | - cd extensions/vscode - npm run prepackage -- --target ${{ env.target }} - - # 3. Re-install esbuild (for cases that we force installed for another arch in prepackage.js) - - name: Re-install esbuild - run: | - cd extensions/vscode - npm install -f esbuild - - # 4. Run tests for the extension - # - name: Install Xvfb for Linux and run tests - # run: | - # sudo apt-get install -y xvfb # Install Xvfb - # Xvfb :99 & # Start Xvfb - # export DISPLAY=:99 # Export the display number to the environment - # cd extensions/vscode - # npm run test - # if: matrix.os == 'ubuntu-latest' - - # - name: Run extension tests - # run: | - # cd extensions/vscode - # npm run test - # if: matrix.os != 'ubuntu-latest' - - # 5. Package the extension - - name: Package the extension - run: cd extensions/vscode && npx vsce package --pre-release --no-dependencies --target ${{ env.target }} - - # 6. Upload the .vsix as an artifact - - uses: actions/upload-artifact@v4 + - name: Upload .vsix artifact + uses: actions/upload-artifact@v4 with: - name: ${{ env.target }}-vsix + name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix path: "extensions/vscode/*.vsix" release: diff --git a/.github/workflows/vscode-version-bump.yml b/.github/workflows/vscode-version-bump.yml index c05da185f..a7aaee3d5 100644 --- a/.github/workflows/vscode-version-bump.yml +++ b/.github/workflows/vscode-version-bump.yml @@ -1,8 +1,9 @@ name: Create VS Code main release draft on: - schedule: - # Runs at 7 AM PST (15:00 UTC) every Friday - - cron: "0 15 * * 5" + # Not using this now because making drafts was just noisy. Will be useful when we are ready for automated releases. + # schedule: + # # Runs at 7 AM PST (15:00 UTC) every Friday + # - cron: "0 15 * * 5" workflow_dispatch: # Allows manual triggering diff --git a/.idea/gradle.xml b/.idea/gradle.xml index c277e816e..324ac997a 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -5,7 +5,7 @@