From 0c563fc28fefa0cd7181fd78c579c3a86faaa4f9 Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Wed, 23 Aug 2023 14:44:33 -0700 Subject: Testing gh workflow (#401) * testing * logging again * log home dir * build m1 script * correctly parse dates in history.tsx * logging * add redbaron to requirements.txt * tweaks before merging to main --- .github/workflows/main.yaml | 8 ++++- Dockerfile | 22 +++++++++++++ buildm1.sh | 11 +++++++ continuedev/requirements.txt | 3 +- continuedev/src/continuedev/core/context.py | 10 +++--- extension/package-lock.json | 4 +-- extension/react-app/src/pages/history.tsx | 20 +++++++++--- extension/src/activation/environmentSetup.ts | 1 - run.m1.spec | 47 ++++++++++++++++++++++++++++ 9 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 Dockerfile create mode 100644 buildm1.sh create mode 100644 run.m1.spec diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 33d8ecd7..bbb85f9a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -157,9 +157,15 @@ jobs: uses: actions/upload-artifact@v2 with: name: continue-log - path: ${{ env.HOME }}/.continue/continue.log + path: /home/runner/.continue/continue.log if: always() + - name: Try to run linux binary + run: | + cd extension/server/exe + ./run + if: always() && matrix.os == 'ubuntu-20.04' + publish: needs: test-and-package runs-on: ubuntu-20.04 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..73eda76c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# A Dockerfile for quickly building and testing the pyinstaller binary + +FROM python:3.9 + +# Set the working directory to /app + +WORKDIR /app + +# Copy the current directory contents into the container at /app + +COPY . /app + +# Install any needed packages specified in requirements.txt +RUN pip install pyinstaller + +RUN pip install -r /app/continuedev/requirements.txt + +RUN pyinstaller run.spec + +RUN chmod +x /app/dist/run + +CMD ["/app/dist/run"] diff --git a/buildm1.sh b/buildm1.sh new file mode 100644 index 00000000..356026c0 --- /dev/null +++ b/buildm1.sh @@ -0,0 +1,11 @@ + +#!/bin/sh + +# 1. Remove continuedev/.venv +rm -rf continuedev/.venv + +# 2. Run pyinstaller run.m1.spec +pyinstaller run.m1.spec + +# 3. Reinstall poetry deps +cd continuedev && poetry install \ No newline at end of file diff --git a/continuedev/requirements.txt b/continuedev/requirements.txt index 8edcf70e..0cf909d5 100644 --- a/continuedev/requirements.txt +++ b/continuedev/requirements.txt @@ -21,4 +21,5 @@ meilisearch-python-async==1.4.8 socksio==1.0.0 ripgrepy==2.0.0 replicate==0.11.0 -bs4==0.0.1 \ No newline at end of file +bs4==0.0.1 +redbaron==0.9.2 \ No newline at end of file diff --git a/continuedev/src/continuedev/core/context.py b/continuedev/src/continuedev/core/context.py index 326fb441..d47ad942 100644 --- a/continuedev/src/continuedev/core/context.py +++ b/continuedev/src/continuedev/core/context.py @@ -248,10 +248,12 @@ class ContextManager: for item in context_items ] async with Client("http://localhost:7700") as search_client: - await asyncio.wait_for( - search_client.index(SEARCH_INDEX_NAME).add_documents(documents), - timeout=5, - ) + + async def add_docs(): + index = await search_client.get_index(SEARCH_INDEX_NAME) + await index.add_documents(documents) + + await asyncio.wait_for(add_docs(), timeout=5) @staticmethod async def delete_documents(ids): diff --git a/extension/package-lock.json b/extension/package-lock.json index 7f4dab5f..802d96e5 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.321", + "version": "0.0.322", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.321", + "version": "0.0.322", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/react-app/src/pages/history.tsx b/extension/react-app/src/pages/history.tsx index edf4d39f..2eb895b1 100644 --- a/extension/react-app/src/pages/history.tsx +++ b/extension/react-app/src/pages/history.tsx @@ -14,6 +14,14 @@ const Tr = styled.tr` } `; +const parseDate = (date: string): Date => { + let dateObj = new Date(date); + if (isNaN(dateObj.getTime())) { + dateObj = new Date(parseInt(date) * 1000); + } + return dateObj; +}; + const TdDiv = styled.div` cursor: pointer; padding-left: 1rem; @@ -46,6 +54,8 @@ function History() { fetchSessions(); }, [client]); + console.log(sessions.map((session) => session.date_created)); + return (
@@ -72,9 +86,7 @@ function History() {
>
{session.title}
- {new Date(
- parseInt(session.date_created) * 1000
- ).toLocaleString("en-US", {
+ {parseDate(session.date_created).toLocaleString("en-US", {
weekday: "short",
year: "numeric",
month: "long",
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts
index fe0c8c0b..53ca8dc6 100644
--- a/extension/src/activation/environmentSetup.ts
+++ b/extension/src/activation/environmentSetup.ts
@@ -258,7 +258,6 @@ export async function startContinuePythonServer(redownload: boolean = true) {
};
const settings: any =
os.platform() === "win32" ? windowsSettings : macLinuxSettings;
-
// Spawn the server
const child = spawn(destination, settings);
diff --git a/run.m1.spec b/run.m1.spec
new file mode 100644
index 00000000..3eeea867
--- /dev/null
+++ b/run.m1.spec
@@ -0,0 +1,47 @@
+# -*- mode: python ; coding: utf-8 -*-
+import certifi
+
+block_cipher = None
+
+
+a = Analysis(
+ ['run.py'],
+ pathex=[],
+ binaries=[],
+ datas=[
+ ('continuedev', 'continuedev'),
+ (certifi.where(), 'ca_bundle')
+ ],
+ hiddenimports=['anthropic', 'github', 'ripgrepy', 'bs4', 'redbaron'],
+ hookspath=[],
+ hooksconfig={},
+ runtime_hooks=[],
+ excludes=['numpy', 'jedi'],
+ win_no_prefer_redirects=False,
+ win_private_assemblies=False,
+ cipher=block_cipher,
+ noarchive=False,
+)
+pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
+
+exe = EXE(
+ pyz,
+ a.scripts,
+ a.binaries,
+ a.zipfiles,
+ a.datas,
+ [],
+ name='run',
+ debug=False,
+ bootloader_ignore_signals=False,
+ strip=False,
+ upx=True,
+ upx_exclude=[],
+ runtime_tmpdir=None,
+ console=True,
+ disable_windowed_traceback=False,
+ argv_emulation=False,
+ target_arch="arm64",
+ codesign_identity=None,
+ entitlements_file=None,
+)
--
cgit v1.2.3-70-g09d2
|