-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build .vsix per target platform (#15)
* working draft * add bin/ to gitignore * add github actions for packaging * make vsce a devDependency * fix typo * fix order of building and cleaning intermediary files * fix macos -> darwin typo * fix wrong environment variables * fix upload-artifact@v3 deprecation * fix setup-go caching fails
- Loading branch information
Showing
7 changed files
with
3,730 additions
and
117 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`; | ||
} | ||
}); |
Oops, something went wrong.