Skip to content

Commit

Permalink
Merge pull request #3729 from continuedev/pe/jb-test-updates
Browse files Browse the repository at this point in the history
bugfix: binary build issues
  • Loading branch information
Patrick-Erichsen authored Jan 18, 2025
2 parents bf5c21c + eb0960b commit a242278
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 34 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/pr_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
paths:
- "extensions/intellij/**"
- "extensions/vscode/**"
- "core/**"
- "gui/**"
Expand Down Expand Up @@ -96,7 +97,7 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

install-gui:
needs: [install-root, install-core]
needs: [ install-root, install-core ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -157,7 +158,7 @@ jobs:
npx tsc --noEmit
binary-checks:
needs: [install-root, install-core]
needs: [ install-root, install-core ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -193,7 +194,7 @@ jobs:
npx tsc --noEmit
install-vscode:
needs: [install-root, install-core]
needs: [ install-root, install-core ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -282,7 +283,7 @@ jobs:

vscode-get-test-file-matrix:
runs-on: ubuntu-latest
needs: [install-root, install-vscode]
needs: [ install-root, install-vscode ]
outputs:
test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}
steps:
Expand Down Expand Up @@ -311,7 +312,7 @@ jobs:
vscode-package-extension:
runs-on: ubuntu-latest
needs: [install-vscode, install-core]
needs: [ install-vscode, install-core ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -343,7 +344,7 @@ jobs:

vscode-download-e2e-dependencies:
runs-on: ubuntu-latest
needs: [install-vscode, install-core]
needs: [ install-vscode, install-core ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -389,7 +390,7 @@ jobs:
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"]
command: [ "e2e:ci:run", "e2e:ci:run-yaml" ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -439,7 +440,6 @@ jobs:
run: |
cd extensions/vscode
TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }}
env:
DISPLAY: :99

Expand All @@ -451,7 +451,7 @@ jobs:
path: extensions/vscode/e2e/storage/screenshots

gui-tests:
needs: [install-gui, install-core]
needs: [ install-gui, install-core ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -482,7 +482,7 @@ jobs:
npm test
jetbrains-tests:
needs: [install-root, core-checks]
needs: [ install-root, core-checks ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -552,7 +552,7 @@ jobs:
with:
url: http://127.0.0.1:8082
max-attempts: 15
retry-delay: 5s
retry-delay: 30s

- name: Run tests
run: |
Expand All @@ -578,4 +578,4 @@ jobs:
with:
name: jb-failure-report
path: |
${{ github.workspace }}/extensions/intellij/build/reports
${{ github.workspace }}/extensions/intellij/build/reports
21 changes: 20 additions & 1 deletion binary/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,22 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
}

(async () => {
// Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
// This is only needed for our `pkg` command at build time
fs.writeFileSync(
"out/package.json",
JSON.stringify(
{
name: "binary",
version: "1.0.0",
author: "Continue Dev, Inc",
license: "Apache-2.0",
},
undefined,
2,
),
);

console.log("[info] Downloading prebuilt lancedb...");
for (const target of targets) {
if (targetToLanceDb[target]) {
Expand Down Expand Up @@ -263,9 +279,12 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {

// Informs the `continue-binary` of where to look for node_sqlite3.node
// https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found
fs.writeFileSync(`${targetDir}/package.json`, "");
// fs.writeFileSync(`${targetDir}/package.json`, "");
}

// Cleanup - this is needed when running locally
fs.rmSync("out/package.json");

const pathsToVerify = [];
for (const target of targets) {
const exe = target.startsWith("win") ? ".exe" : "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/../../binary" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/binary" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
Expand Down
2 changes: 1 addition & 1 deletion extensions/intellij/.run/Start GUI Dev Server.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/../../gui" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/gui" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/zsh" />
<option name="INTERPRETER_OPTIONS" value="" />
Expand Down
17 changes: 15 additions & 2 deletions extensions/intellij/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ This will generate a .zip file in `./build/distributions` with the version defin
The e2e tests are written using [intellij-ui-test-robot](`https://github.com/JetBrains/intellij-ui-test-robot`). The
README for this project has a lot of helpful info on how to use the library.
Note that these tests fully take control of your mouse while executing.
#### Setup
If you are on macOS, you'll need to give IntelliJ permission to control your computer in order to run the e2e tests.
Expand All @@ -174,7 +176,18 @@ to run.
#### Identifying selectors
While the `runIdeForUiTests` task is runnung, you can visit the following URL
While the `runIdeForUiTests` task is running, you can visit the following URL
to view the UI hierarchy of the running IDE:
http://127.0.0.1:8082/
http://127.0.0.1:8082/
#### Rebuilding the extension
To rebuild the extension with the latest source code, run the following:
```sh
./gradlew buildPlugin
```
This will update the contents of the extension that is loaded into the test IDE from
`build/idea-sandbox/plugins-uiTest/continue-intellij-extension`
34 changes: 24 additions & 10 deletions extensions/intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ dependencies {
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
testImplementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
implementation("com.automation-remarks:video-recorder-junit5:2.0")


// Exclude vulnerable Log4j from all dependencies
configurations.all {
resolutionStrategy {
eachDependency {
if (requested.group == "log4j" && requested.name == "log4j") {
useTarget("org.slf4j:log4j-over-slf4j:1.7.36")
}
}
}
}

// Add Log4j 2.x explicitly
implementation("org.apache.logging.log4j:log4j-core:2.20.0")
implementation("org.apache.logging.log4j:log4j-api:2.20.0")
}

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for
Expand Down Expand Up @@ -105,13 +121,10 @@ tasks {
wrapper { gradleVersion = properties("gradleVersion").get() }

patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's
// manifest
pluginDescription =
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
pluginDescription.set(
providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"
Expand All @@ -125,6 +138,7 @@ tasks {
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}
)
}

// Configure UI tests plugin
Expand All @@ -149,9 +163,9 @@ tasks {
// This is to ensure we load the GUI with OSR enabled. We have logic that
// renders with OSR disabled below a particular IDE version.
// See ContinueExtensionSettingsService.kt for more info.
intellij {
version.set("2024.1")
}
// intellij {
// version.set("2024.1")
// }
}

signPlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Autocomplete {
@AfterEach
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()

// @Test
@Test
@Video
fun displayCompletion(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
welcomeFrame {
Expand All @@ -50,7 +50,7 @@ class Autocomplete {
// Our "continue_tutorial.java.ft" tab loads first, but then "Main.java" takes focus.
waitFor(ofSeconds(20)) {
findAll<ComponentFixture>(
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
byXpath("//div[@accessiblename='Main.java' and @class='SingleHeightLabel']")
).isNotEmpty()
}

Expand All @@ -64,7 +64,7 @@ class Autocomplete {
enterText(" ")
}

waitFor(ofSeconds(10)) {
waitFor(ofSeconds(20)) {
editor.hasText("TEST_LLM_RESPONSE_0")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GUI {
@AfterEach
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()

// @Test
// @Test
@Video
fun highlightCode(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
welcomeFrame {
Expand All @@ -57,7 +57,7 @@ class GUI {
// while the `continue_tutorial.java` is loading.
waitFor(ofSeconds(20)) {
findAll<ComponentFixture>(
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
byXpath("//div[@accessiblename='Main.java' and @class='SingleHeightLabel']")
).isNotEmpty()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Onboarding {
fun closeProject(remoteRobot: RemoteRobot) = CommonSteps(remoteRobot).closeProject()


// @Test
// @Test
@Video
fun onboarding(remoteRobot: RemoteRobot): Unit = with(remoteRobot) {
welcomeFrame {
Expand All @@ -53,7 +53,7 @@ class Onboarding {
// So we need to wait for that to occur, and then focus on "continue_tutorial.java.ft"
waitFor(ofSeconds(20)) {
findAll<ComponentFixture>(
byXpath("//div[@accessiblename='Main.java' and @class='EditorTabLabel']")
byXpath("//div[@accessiblename='Main.java' and @class='SingleHeightLabel']")
).isNotEmpty()
}

Expand Down

0 comments on commit a242278

Please sign in to comment.