Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add release CI (#74)
Browse files Browse the repository at this point in the history
* feat: add release CI

* fix: update package-lock.json
McPatate authored Sep 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 187d29c commit 95800c8
Showing 5 changed files with 2,270 additions and 56 deletions.
151 changes: 151 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: release
on:
workflow_dispatch:

push:
branches:
- 'release/**'

env:
FETCH_DEPTH: 0 # pull in the tags for the version string
LLM_LS_VERSION: 0.2.0

jobs:
package:
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
code-target: win32-x64
- target: i686-pc-windows-msvc
code-target: win32-ia32
# - os: windows-latest
# target: aarch64-pc-windows-msvc
# code-target: win32-arm64
- target: x86_64-unknown-linux-gnu
code-target: linux-x64
- target: aarch64-unknown-linux-gnu
code-target: linux-arm64
- target: arm-unknown-linux-gnueabihf
code-target: linux-armhf
- target: x86_64-apple-darwin
code-target: darwin-x64
- target: aarch64-apple-darwin
code-target: darwin-arm64
- target: x86_64-unknown-linux-musl
code-target: alpine-x64

env:
LLM_LS_TARGET: ${{ matrix.target }}

name: package (${{ matrix.target }})
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: ${{ env.FETCH_DEPTH }}

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: robinraju/release-downloader@v1.8
with:
repository: "huggingface/llm-ls"
tag: ${{ env.LLM_LS_VERSION }}
fileName: "llm-ls-${{ matrix.target }}.gz"

- name: Unzip llm-ls
if: contains(matrix.code-target, 'win32')
run: mkdir server && gunzip -c llm-ls-${{ matrix.target }}.gz > server/llm-ls.exe && chmod +x server/llm-ls.exe

- name: Unzip llm-ls
if: ${{ !contains(matrix.code-target, 'win32') }}
run: mkdir server && gunzip -c llm-ls-${{ matrix.target }}.gz > server/llm-ls && chmod +x server/llm-ls

- name: Install dependencies
run: npm ci

- name: Package Extension
run: npx vsce package -o "./llm-ls-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}

- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: pkg-${{ matrix.target }}
path: ./llm-ls-${{ matrix.code-target }}.vsix

publish:
name: publish
runs-on: ubuntu-latest
needs: ["package"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: ${{ env.FETCH_DEPTH }}

- name: Install Nodejs
uses: actions/setup-node@v3
with:
node-version: 16

- run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- run: 'echo "HEAD_SHA: $HEAD_SHA"'

- name: Split branch name
env:
BRANCH: ${{ github.ref_name }}
id: split
run: echo "::set-output name=tag::${BRANCH##*/}"

- uses: actions/download-artifact@v1
with:
name: pkg-aarch64-apple-darwin
path: pkg
- uses: actions/download-artifact@v1
with:
name: pkg-x86_64-apple-darwin
path: pkg
- uses: actions/download-artifact@v1
with:
name: pkg-x86_64-unknown-linux-gnu
path: pkg
- uses: actions/download-artifact@v1
with:
name: pkg-x86_64-unknown-linux-musl
path: pkg
- uses: actions/download-artifact@v1
with:
name: pkg-aarch64-unknown-linux-gnu
path: pkg
- uses: actions/download-artifact@v1
with:
name: pkg-arm-unknown-linux-gnueabihf
path: pkg
- uses: actions/download-artifact@v1
with:
name: pkg-x86_64-pc-windows-msvc
path: pkg
- uses: actions/download-artifact@v1
with:
name: pkg-i686-pc-windows-msvc
path: pkg
# - uses: actions/download-artifact@v1
# with:
# name: pkg-aarch64-pc-windows-msvc
# path: pkg
- run: ls -al ./pkg

- run: npm ci

- name: Publish Extension (Code Marketplace, release)
# token from https://dev.azure.com/huggingface/
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ./pkg/llm-ls-*.vsix

- name: Publish Extension (OpenVSX, release)
run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ./pkg/llm-ls-*.vsix
timeout-minutes: 2
22 changes: 22 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Mark inactive issues as stale
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 30
days-before-issue-close: -1
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for X days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
2,117 changes: 2,073 additions & 44 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "huggingface-vscode",
"displayName": "llm-vscode",
"description": "LLM powered development for VS Code",
"version": "0.0.39",
"version": "0.1.0",
"publisher": "HuggingFace",
"icon": "small_logo.png",
"engines": {
@@ -190,8 +190,11 @@
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"package": "vsce package -o llm-vscode.vsix"
"test": "node ./out/test/runTest.js"
},
"dependencies": {
"undici": "^5.25.2",
"vscode-languageclient": "^8.1.0"
},
"devDependencies": {
"@types/mocha": "^10.0.1",
@@ -200,11 +203,11 @@
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"@vscode/test-electron": "^2.3.4",
"@vscode/vsce": "^2.21.0",
"eslint": "^8.47.0",
"glob": "^10.3.3",
"mocha": "^10.2.0",
"typescript": "^5.1.6",
"undici": "^5.25.2",
"vscode-languageclient": "^8.1.0"
"ovsx": "^0.8.3",
"typescript": "^5.1.6"
}
}
}
19 changes: 14 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ import { homedir } from 'os';
import * as path from 'path';
import { fetch } from 'undici';


interface Completion {
generated_text: string;
}
@@ -23,18 +22,28 @@ export function activate(context: vscode.ExtensionContext) {
ctx = context;
handleConfigTemplateChange(ctx);
const config = vscode.workspace.getConfiguration("llm");
// TODO: bundle llm-ls with vscode extension
const binaryPath: string = config.get("lsp.binaryPath") as string;
const binaryPath: string | null = config.get("lsp.binaryPath") as string | null;
let command: string;
if (binaryPath) {
command = binaryPath;
} else {
const ext = process.platform === "win32" ? ".exe" : "";
command = vscode.Uri.joinPath(context.extensionUri, "server", `llm-ls${ext}`).fsPath;
}
if (command.startsWith("~/")) {
command = homedir() + command.slice("~".length);
}
console.log(`command: ${command}`);
const serverOptions: ServerOptions = {
run: {
command: binaryPath, transport: TransportKind.stdio, options: {
command, transport: TransportKind.stdio, options: {
env: {
"LLM_LOG_LEVEL": config.get("lsp.logLevel") as string,
}
}
},
debug: {
command: binaryPath,
command,
transport: TransportKind.stdio,
options: {
env: {

0 comments on commit 95800c8

Please sign in to comment.