ci: 💚 testing testing in ci

This commit is contained in:
Nate Sesti 2023-08-09 18:06:11 -07:00
parent 23df57edae
commit 855de8f09e
4 changed files with 65 additions and 67 deletions

View file

@ -3,8 +3,7 @@ name: Publish Extension
on:
push:
branches:
- main
- package-python
- ci-testing
jobs:
pyinstaller:
@ -99,43 +98,48 @@ jobs:
cd extension/react-app
npm ci --legacy-peer-deps
- name: Build and Publish
- name: Test extension
run: |
cd extension
npm run package
npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }}
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "ci: 💚 Update package.json version [skip ci]"
npm run test
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
# - name: Build and Publish
# run: |
# cd extension
# npm run package
# npx vsce publish patch -p ${{ secrets.VSCE_TOKEN }}
# - name: Commit changes
# run: |
# git config --local user.email "action@github.com"
# git config --local user.name "GitHub Action"
# git commit -am "ci: 💚 Update package.json version [skip ci]"
- name: Upload .vsix artifact
uses: actions/upload-artifact@v2
with:
name: vsix-artifact
path: extension/build/*
# - name: Push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
# - name: Upload .vsix artifact
# uses: actions/upload-artifact@v2
# with:
# name: vsix-artifact
# path: extension/build/*
- name: Upload binaries to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: continue-server-binaries
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-west-1"
SOURCE_DIR: "exe"
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: us-west-2
# - name: Upload binaries to S3
# uses: jakejarvis/s3-sync-action@master
# with:
# args: --acl public-read --follow-symlinks --delete
# env:
# AWS_S3_BUCKET: continue-server-binaries
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: "us-west-1"
# SOURCE_DIR: "exe"

31
.vscode/launch.json vendored
View file

@ -7,18 +7,12 @@
{
"name": "Server + Extension (VSCode)",
"stopAll": true,
"configurations": [
"Server",
"Extension (VSCode)"
]
"configurations": ["Server", "Extension (VSCode)"]
},
{
"name": "Server + Tests (VSCode)",
"stopAll": true,
"configurations": [
"Server",
"Tests (VSCode)"
]
"configurations": ["Server", "Tests (VSCode)"]
}
],
"configurations": [
@ -27,12 +21,9 @@
"type": "python",
"request": "launch",
"module": "continuedev.src.continuedev.server.main",
"args": [
"--port",
"8001"
],
"args": ["--port", "8001"],
"justMyCode": false,
"subProcess": false,
"subProcess": false
// Does it need a build task?
// What about a watch task? - type errors?
},
@ -45,11 +36,9 @@
// Pass a directory to manually test in
"${workspaceFolder}/extension/manual-testing-sandbox",
"${workspaceFolder}/extension/manual-testing-sandbox/example.ts",
"--extensionDevelopmentPath=${workspaceFolder}/extension",
],
"outFiles": [
"${workspaceFolder}/extension/out/**/*.js"
"--extensionDevelopmentPath=${workspaceFolder}/extension"
],
"outFiles": ["${workspaceFolder}/extension/out/**/*.js"],
"preLaunchTask": "vscode-extension:build",
"env": {
"CONTINUE_SERVER_URL": "http://localhost:8001"
@ -77,10 +66,10 @@
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "vscode-extension:tests:build",
"env": {
"CONTINUE_SERVER_URL": "http://localhost:8001",
"CONTINUE_SERVER_URL": "http://localhost:65432",
// Avoid timing out when stopping on breakpoints during debugging in VSCode
"MOCHA_TIMEOUT": "0",
},
"MOCHA_TIMEOUT": "0"
}
}
]
}
}

View file

@ -12,7 +12,7 @@ import {
rejectSuggestionCommand,
} from "./suggestions";
import { FileEditWithFullContents } from "../schema/FileEditWithFullContents";
import * as fs from 'fs';
import * as fs from "fs";
import { WebsocketMessenger } from "./util/messenger";
import { diffManager } from "./diffs";
const os = require("os");
@ -30,13 +30,12 @@ class IdeProtocolClient {
private _lastReloadTime: number = 16;
private _reconnectionTimeouts: NodeJS.Timeout[] = [];
private _sessionId: string | null = null;
sessionId: string | null = null;
private _serverUrl: string;
private _newWebsocketMessenger() {
const requestUrl =
this._serverUrl +
(this._sessionId ? `?session_id=${this._sessionId}` : "");
this._serverUrl + (this.sessionId ? `?session_id=${this.sessionId}` : "");
const messenger = new WebsocketMessenger(requestUrl);
this.messenger = messenger;
@ -383,7 +382,9 @@ class IdeProtocolClient {
async getUserSecret(key: string) {
// Check if secret already exists in VS Code settings (global)
let secret = vscode.workspace.getConfiguration("continue").get(key);
if (typeof secret !== "undefined" && secret !== null) {return secret;}
if (typeof secret !== "undefined" && secret !== null) {
return secret;
}
// If not, ask user for secret
secret = await vscode.window.showInputBox({
@ -420,7 +421,7 @@ class IdeProtocolClient {
console.log("Getting session ID");
const resp = await this.messenger?.sendAndReceive("getSessionId", {});
console.log("New Continue session with ID: ", resp.sessionId);
this._sessionId = resp.sessionId;
this.sessionId = resp.sessionId;
return resp.sessionId;
}

View file

@ -2,18 +2,22 @@ import { test, describe } from "mocha";
import * as assert from "assert";
import { getContinueServerUrl } from "../bridge";
import { startContinuePythonServer } from "../activation/environmentSetup";
import { ideProtocolClient } from "../activation/activate";
import fetch from "node-fetch";
import fkill from "fkill";
describe("Can start python server", () => {
test("Can start python server in under 10 seconds", async function () {
this.timeout(17_000);
await startContinuePythonServer();
fkill(65432, { force: true, silent: true });
const allowedTime = 10_000;
this.timeout(allowedTime + 1000);
await new Promise((resolve) => setTimeout(resolve, 15_000));
// If successful, the server is started by the extension while we wait
await new Promise((resolve) => setTimeout(resolve, allowedTime));
// Check if server is running
const serverUrl = getContinueServerUrl();
console.log("Server URL: ", serverUrl);
const response = await fetch(`${serverUrl}/health`);
assert.equal(response.status, 200);
});