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

Build .vsix per target platform #15

Merged
merged 10 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 0 additions & 46 deletions .github/workflows/go.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/vsix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Package VSIX

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
cache-dependency-path: |
server/go.sum

- name: Prepare building environment
run: |
cd client
npm install

- name: Build for Linux x86_64
run: |
cd client
GOOS=linux GOARCH=amd64 npx vsce package -t linux-x64 -o vls-linux.vsix
rm -r bin

- name: Upload Linux x86_64 artifact
uses: actions/upload-artifact@v4
with:
name: vls-linux-amd64
path: client/vls-linux.vsix

- name: Build for Windows x86_64
run: |
cd client
GOOS=windows GOARCH=amd64 npx vsce package -t win32-x64 -o vls-windows.vsix
rm -r bin

- name: Upload Windows x86_64 artifact
uses: actions/upload-artifact@v4
with:
name: vls-windows-amd64
path: client/vls-windows.vsix

- name: Build for macOS x86_64
run: |
cd client
GOOS=darwin GOARCH=amd64 npx vsce package -t darwin-x64 -o vls-darwin.vsix
rm -r bin

- name: Upload macOS x86_64 artifact
uses: actions/upload-artifact@v4
with:
name: vls-darwin-amd64
path: client/vls-darwin.vsix
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dist-newstyle/
node_modules/
bun.lockb
bin/
out/
dist/
client/LICENSE
Expand Down
3 changes: 2 additions & 1 deletion client/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
.vscode/
.vscode-test/
SECURITY.md
bin/
build/
codereview.cfg
docs/
Expand All @@ -23,4 +22,6 @@ test/
third_party/
tools/
tsconfig.json
eslint.config.mjs
build.mjs
typings/
37 changes: 37 additions & 0 deletions client/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { spawn } from "child_process";
import * as path from "path";
import * as fs from "fs";
const fsp = fs.promises;
import * as process from "process";
import { fileURLToPath } from 'url';

function getExecutableFilename(basename) {
if (process.env["GOOS"] == "windows") {
return basename + ".exe";
} else {
return basename;
}
}

const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

// cd to repository root
process.chdir(path.join(dirname, ".."));

// Misc resource files
fsp.copyFile("README.md", path.join("client", "README.md"));
fsp.copyFile("LICENSE", path.join("client", "LICENSE"));

const goBuild = spawn(
"go",
["build", "-o", path.resolve("client", "bin", getExecutableFilename("verilog_language_server"))],
// Target OS and architecture should be specified to the node process running this script, e.g.
// bash -c 'GOOS=windows GOARCH=amd64 node build.mjs'
{ cwd: "server" },
);
goBuild.on('exit', exitCode => {
if (exitCode != 0) {
throw `go build failed with exit code ${exitCode}`;
}
});
Loading
Loading