Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Document Synchronization integration tests #1805

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
76ed7da
merged origin/main
steveyegge Jul 1, 2024
01012b3
spotless
steveyegge Jul 1, 2024
1d8360a
refactored tests to share test file name
steveyegge Jun 25, 2024
9340583
more work on doc sync tests
steveyegge Jun 25, 2024
7dc23a4
more progress on integration test
steveyegge Jun 26, 2024
9679de4
got first doc-sync test actually passing, verified
steveyegge Jun 26, 2024
ce45bf4
Refactored doc-sync code into a new fixture
steveyegge Jun 26, 2024
0152566
implemented some more tests; not all are passing yet
steveyegge Jun 26, 2024
a6aa110
Got all 11 document synchronization tests working
steveyegge Jun 26, 2024
6e38115
added some assertions
steveyegge Jun 26, 2024
78fc6bb
some minor refactoring of doc sync tests
steveyegge Jun 27, 2024
dfbcd8a
removed old file
steveyegge Jun 27, 2024
cfe5bda
addressed PR feedback
steveyegge Jun 27, 2024
cf9e3b9
spotless
steveyegge Jun 27, 2024
b00c265
more cleanup on doc-sync tests
steveyegge Jun 27, 2024
17f6c4b
turn on CODY_RECORD_IF_MISSING for integration tests
steveyegge Jun 27, 2024
6b575ea
updated recording
steveyegge Jun 27, 2024
334c13f
better error messaging around agent startup failures
steveyegge Jun 27, 2024
41f126e
spotless
steveyegge Jun 27, 2024
3b7590b
fixed a bug in copying the agent binary to a temp location
steveyegge Jun 27, 2024
c92b9ab
improved error messaging around remote agent
steveyegge Jun 27, 2024
f6e8529
re-enabled DocumentCodeTest
steveyegge Jun 27, 2024
69974f5
re-enabled DocumentCodeTest
steveyegge Jun 27, 2024
a53d1ad
fixed an NPE during integration testing
steveyegge Jun 27, 2024
34450ae
got the DocumentSynchronizationTest working again
steveyegge Jun 27, 2024
9ba9d00
re-enabled DocumentSynchronizationTest
steveyegge Jun 27, 2024
1867ba9
put DocumentCodeTests back
steveyegge Jun 28, 2024
75a0b0a
spotless
steveyegge Jul 1, 2024
dddffa7
updated pinned Cody commit
steveyegge Jul 1, 2024
bc313a0
improved test failure message when error lens is displayed
steveyegge Jul 2, 2024
98a8cbc
Few changes to make tests work
pkukielka Jul 2, 2024
24e83df
added more error handling when finding repo roots
steveyegge Jul 2, 2024
8af3bc8
Bump cody commit
pkukielka Jul 2, 2024
748fe16
Do not list the same account twice (#1864)
mkondratek Jul 3, 2024
e9e9d99
Do not open subscription page when updating invalid pro account token…
mkondratek Jul 3, 2024
eb5dbd0
Add auth telemetry events (#1863)
pkukielka Jul 3, 2024
3b62b3a
Simplify SignInWithSourcegraphPanel.kt (#1865)
mkondratek Jul 3, 2024
ec50472
Show the login screen when the token is missing (#1867)
mkondratek Jul 3, 2024
763c249
Minor code imporvements (#1870)
mkondratek Jul 3, 2024
b49f1d2
Improve action discoverability by adding Cody: prefix in Search Every…
pkukielka Jul 3, 2024
f08dba3
Small improvements to the CI workflow (#1851)
odisseus Jul 3, 2024
c3526a2
Bump cody commit, add startup telemetry (#1873)
pkukielka Jul 3, 2024
72e484b
README: fix typo (#1875)
abeatrix Jul 3, 2024
28460c5
Manual Stable Release (#1862)
mkondratek Jul 4, 2024
75f3406
Add proper groups for Cody actions (#1884)
pkukielka Jul 5, 2024
a670b86
Bump cody commit, adjust agent launch params (#1887)
pkukielka Jul 8, 2024
9d5fa88
updated recording
steveyegge Jun 27, 2024
d1d43f3
updated pinned Cody commit
steveyegge Jul 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release to Marketplace
name: Nightly Release
on:
push:
tags: [ "*" ]
Expand Down Expand Up @@ -28,11 +28,7 @@ jobs:
- run: |
echo "RELEASE_VERSION=$(./scripts/version-from-git-tag.sh)" >> $GITHUB_ENV
- run: echo "Publishing version $RELEASE_VERSION"
- run: ./gradlew "-PpluginVersion=$RELEASE_VERSION" publishPlugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
- name: Publish nightly version
if: "!endsWith(env.RELEASE_VERSION, '-nightly')"
run: |
echo "Publishing nightly version ${RELEASE_VERSION}-nightly"
./gradlew "-PpluginVersion=${RELEASE_VERSION}-nightly" publishPlugin
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/stable-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Stable Release
on:
workflow_dispatch
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle
# See note about QEMU and binfmt requirement here https://github.com/vercel/pkg#targets
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v3
- run: yarn global add [email protected]
- run: |
echo "RELEASE_VERSION=$(./scripts/version-from-git-tag.sh)" >> $GITHUB_ENV
- run: echo "Publishing version $RELEASE_VERSION"
- run: ./gradlew "-PpluginVersion=$RELEASE_VERSION" publishPlugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
19 changes: 13 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: JetBrains Tests
name: Build, test and verify
on:
pull_request:
push:
Expand Down Expand Up @@ -46,18 +46,22 @@ jobs:
- run: echo "SKIP_CODE_SEARCH_BUILD=true" >> $GITHUB_ENV
- run: ./gradlew spotlessCheck
- run: ./gradlew check
- name: Upload test report
- name: Upload the test report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report
path: build/reports/tests/
compression-level: 9
- run: ./gradlew buildPlugin
- run: ./gradlew --stop
- uses: actions/upload-artifact@v4
- name: Upload the plugin package
uses: actions/upload-artifact@v4
with:
name: plugin.zip
name: plugin
path: './build/distributions/Sourcegraph-*.zip'
compression-level: 0
retention-days: 7
plugin-verifier:
name: IntelliJ Plugin Verifier
runs-on: ubuntu-latest
Expand All @@ -66,7 +70,7 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: plugin.zip
name: plugin
- name: Verify Plugin on IntelliJ Platforms
id: verify
uses: ChrisCarini/[email protected]
Expand All @@ -85,8 +89,11 @@ jobs:
PLUGIN_STRUCTURE_WARNINGS
MISSING_DEPENDENCIES
INVALID_PLUGIN
- uses: actions/upload-artifact@v4
- name: Upload the verification reports
if: always()
uses: actions/upload-artifact@v4
with:
name: plugin-verifier-reports
path: 'verification-*'
compression-level: 9

42 changes: 25 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,33 @@ After doing that:

## Publishing a New Release

### Historical context
We used to publish both stable and nightly channel versions at once.
In that approach QA testing and JB approval happened in parallel.
However, it consumed a lot of CI time and JB time for the releases that did not pass our QA
(and did not go public eventually). Hence, we decided to use a sequential process.
We trigger the stable channel release only after the nightly channel release passes QA.

```mermaid
graph TD;
Title["JetBrains plugin release"] --> stable;
Title --> nightly;
stable --> push_stable["push git tag"];
push_stable --> release_job_stable["wait for release job to complete"];
release_job_stable --> marketplace_approval["wait for marketplace approval"];
marketplace_approval -->|Automated approval, up to 48hr| unhide["unhide"];
unhide --> available_to_end_users_stable["available for download"];
marketplace_approval -->|Manual quick-approve| slack_approval["request JetBrains Marketplace team to manually approve update via Slack"];
slack_approval --> unhide["unhide approved release (requires admin access)"];
nightly --> push_nightly["push git tag\nwith '-nightly' suffix"];
push_nightly --> release_job_nightly["wait for release job to complete"];
release_job_nightly --> available_to_end_users_nightly["available for download"];
Title --> nightly["Nightly Release"];
Title["JetBrains Plugin Release"] --> stable["Stable Release"];
stable --> trigger_stable["Manually trigger 'Stable Release' workflow\nin GitHub Actions"];
release_stable --> marketplace_approval["Wait for JetBrains approval"];
marketplace_approval --> |Automated approval, up to 48hr| unhide["unhide"];
unhide --> available_to_end_users_stable["Available for download"];
marketplace_approval --> |Manual quick-approve| slack_approval["Request JetBrains Marketplace team\nto manually approve it via Slack"];
slack_approval --> unhide["Unhide the approved release\n(requires admin access)"];
nightly --> push_nightly["Run `push-git-tag-for-next-release.sh`"];
trigger_stable --> release_stable["Wait for 'Stable Release' workflow to complete"];
push_nightly --> release_nightly["Wait for 'Nightly Release' workflow to complete"];
release_nightly --> available_to_end_users_nightly["Available for download"];
```

We aim to cut a new Stable release every other week on Mondays.
The release cadence is irregular for Nightly versions.

### 1. Push a Git Tag

First, choose whether to publish a new version of nightly or stable.
### 1. Push a git tag & publish a nightly release

Use the following command for a **patch** release:

Expand All @@ -162,11 +167,14 @@ Or this one for a **major** release
This script runs `verify-release.sh`, which takes a long time to run with a clean cache, which is why we don't run it in
CI. When you have a local cache of IDEA installations then this script can run decently fast (~1-2min).

After successfully pushing the new tag (for example: `v5.2.4819` or `v5.2.4249-nightly`), we are now able to publish.
After successfully pushing the new tag (for example: `v6.0.15`), we are now able to publish.

Wait for the `Release to Marketplace` GitHub workflow to complete.

### 2. For Stable releases, wait for Marketplace approval
### 2. Publish a stable release

Go to [Stable Release workflow](https://github.com/sourcegraph/jetbrains/actions/workflows/stable-release.yml),
click `Run workflow` and select the tag that has been pushed before (and tested by QA team), run it.

It can take up to 48hr for stable releases to get approved by the JetBrains Marketplace team.
It's possible to expedite this process by posting a message in the `#marketplace` channel in
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Experience experimental chat and command support with Ollama running locally:
1. Install and run [Ollama](https://ollama.com/download).
2. Set the [OLLAMA_HOST](https://sourcegraph.com/github.com/ollama/ollama@main/-/blob/docs/faq.md#how-do-i-configure-ollama-server) to `0.0.0.0`.
1. Please refer to the [official Ollama docs](https://sourcegraph.com/github.com/ollama/ollama@main/-/blob/docs/faq.md#setting-environment-variables-on-windows) for how to set environment variables on your platform.
3. Set the [OLLAMA_ORIGINS](https://sourcegraph.com/github.com/ollama/ollama@main/-/blob/docs/faq.md#how-can-i-allow-additional-web-origins-to-access-ollama).
3. Set the [OLLAMA_ORIGINS](https://sourcegraph.com/github.com/ollama/ollama@main/-/blob/docs/faq.md#how-can-i-allow-additional-web-origins-to-access-ollama) to `*`.
4. Install or restart your Ollama app.
5. Select a chat model (a model that includes `instruct` or `chat`, e.g., [codegemma:instruct](https://ollama.com/library/codegemma:instruct), [llama3:instruct](https://ollama.com/library/llama3:instruct)) from the [Ollama Library](https://ollama.com/library).
6. Pull the chat model locally (Example: `ollama pull codegemma:instruct`).
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:2.0.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.3.1")
testImplementation("junit:junit:4.13.2")
}

spotless {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ kotlin.stdlib.default.dependency=false
nodeBinaries.commit=8755ae4c05fd476cd23f2972049111ba436c86d4
nodeBinaries.version=v20.12.2
cody.autocomplete.enableFormatting=true
cody.commit=cec3e5b0f1a6598ca29bb56496dadc4783fd773c
cody.commit=06c1c0e5185810ca565d10d820fd8a79252b4ba8
6 changes: 0 additions & 6 deletions scripts/next-release.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#!/usr/bin/env bash
# This script implements the time-based version scheme from RFC 795
# Simplified: versions should be MAJOR.MINOR.PATCH where
# - MAJOR.MINOR: Latest Sourcegraph quarterly release
# - PATCH: time-based number from simplified formula (MINUTES_SINCE_LAST_RELEASE / MINUTES_IN_ONE_YEAR * 65535)
# The scheme gives generates a unique version number every 10 minutes.
# https://docs.google.com/document/d/11cw-7dAp93JmasITNSNCtx31xrQsNB1L2OoxVE6zrTc/edit#bookmark=id.ufwe0bqp83z1
set -eu

# Check the number of arguments
Expand Down
6 changes: 0 additions & 6 deletions scripts/publish-stable-version.sh

This file was deleted.

20 changes: 15 additions & 5 deletions src/integrationTest/kotlin/com/sourcegraph/cody/AllSuites.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.sourcegraph.cody

import com.intellij.openapi.diagnostic.Logger
import com.sourcegraph.cody.agent.CodyAgentService
import com.sourcegraph.cody.edit.DocumentCodeTest
import com.sourcegraph.cody.util.CodyIntegrationTextFixture
import com.sourcegraph.cody.util.CodyIntegrationTestFixture
import java.util.concurrent.TimeUnit
import org.junit.AfterClass
import org.junit.runner.RunWith
Expand All @@ -18,16 +19,25 @@ import org.junit.runners.Suite
* automatically after the platform version bump.
*
* Multiple recording files can be used, but each should have its own suite with tearDown() method
* nad define unique CODY_RECORDING_NAME.
* and define a unique CODY_RECORDING_NAME.
*/
@RunWith(Suite::class)
@Suite.SuiteClasses(DocumentCodeTest::class)
@Suite.SuiteClasses(DocumentCodeTest::class, DocumentSynchronizationTest::class)
class AllSuites {
companion object {
private val logger = Logger.getInstance(AllSuites::class.java)

@AfterClass
@JvmStatic
internal fun tearDown() {
CodyAgentService.withAgent(CodyIntegrationTextFixture.myProject!!) { agent ->
val project = CodyIntegrationTestFixture.myProject
// Can happen if a test or fixture introduces a bug, and it makes it hard to read test output
// if we are throwing an NPE.
if (project == null) {
logger.warn("No project found - unable to shut down agent gracefully.")
return
}
CodyAgentService.withAgent(project) { agent ->
val errors = agent.server.testingRequestErrors().get()
// We extract polly.js errors to notify users about the missing recordings, if any
val missingRecordings = errors.filter { it.error?.contains("`recordIfMissing` is") == true }
Expand All @@ -46,7 +56,7 @@ class AllSuites {

agent.server
.shutdown()
.get(CodyIntegrationTextFixture.ASYNC_WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS)
.get(CodyIntegrationTestFixture.ASYNC_WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS)
agent.server.exit()
}
}
Expand Down
Loading
Loading