fix(plugin-cli): isolate Go backend module builds
This commit is contained in:
14 files changed
+47
-38
No files matched your search
@@ -7,9 +7,9 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: "Plugin CLI version to publish, for example 0.1.5"
|
description: "Plugin CLI version to publish, for example 0.1.6"
|
||||||
required: true
|
required: true
|
||||||
default: "0.1.5"
|
default: "0.1.6"
|
||||||
npm-tag:
|
npm-tag:
|
||||||
description: "npm distribution tag"
|
description: "npm distribution tag"
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbx-app/plugin-cli-darwin-arm64",
|
"name": "@dbx-app/plugin-cli-darwin-arm64",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Precompiled DBX Plugin CLI binary for darwin arm64",
|
"description": "Precompiled DBX Plugin CLI binary for darwin arm64",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbx-app/plugin-cli-darwin-x64",
|
"name": "@dbx-app/plugin-cli-darwin-x64",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Precompiled DBX Plugin CLI binary for darwin x64",
|
"description": "Precompiled DBX Plugin CLI binary for darwin x64",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbx-app/plugin-cli-linux-arm64-gnu",
|
"name": "@dbx-app/plugin-cli-linux-arm64-gnu",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Precompiled DBX Plugin CLI binary for linux arm64",
|
"description": "Precompiled DBX Plugin CLI binary for linux arm64",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbx-app/plugin-cli-linux-x64-gnu",
|
"name": "@dbx-app/plugin-cli-linux-x64-gnu",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Precompiled DBX Plugin CLI binary for linux x64",
|
"description": "Precompiled DBX Plugin CLI binary for linux x64",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbx-app/plugin-cli-win32-arm64",
|
"name": "@dbx-app/plugin-cli-win32-arm64",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Precompiled DBX Plugin CLI binary for win32 arm64",
|
"description": "Precompiled DBX Plugin CLI binary for win32 arm64",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbx-app/plugin-cli-win32-x64",
|
"name": "@dbx-app/plugin-cli-win32-x64",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Precompiled DBX Plugin CLI binary for win32 x64",
|
"description": "Precompiled DBX Plugin CLI binary for win32 x64",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dbx-app/plugin-cli",
|
"name": "@dbx-app/plugin-cli",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"description": "Create and package DBX plugins without compiling the DBX plugin CLI",
|
"description": "Create and package DBX plugins without compiling the DBX plugin CLI",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"cli",
|
"cli",
|
||||||
@@ -34,12 +34,12 @@
|
|||||||
"prepublishOnly": "npm run build && npm test"
|
"prepublishOnly": "npm run build && npm test"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@dbx-app/plugin-cli-darwin-arm64": "0.1.5",
|
"@dbx-app/plugin-cli-darwin-arm64": "0.1.6",
|
||||||
"@dbx-app/plugin-cli-darwin-x64": "0.1.5",
|
"@dbx-app/plugin-cli-darwin-x64": "0.1.6",
|
||||||
"@dbx-app/plugin-cli-linux-arm64-gnu": "0.1.5",
|
"@dbx-app/plugin-cli-linux-arm64-gnu": "0.1.6",
|
||||||
"@dbx-app/plugin-cli-linux-x64-gnu": "0.1.5",
|
"@dbx-app/plugin-cli-linux-x64-gnu": "0.1.6",
|
||||||
"@dbx-app/plugin-cli-win32-arm64": "0.1.5",
|
"@dbx-app/plugin-cli-win32-arm64": "0.1.6",
|
||||||
"@dbx-app/plugin-cli-win32-x64": "0.1.5"
|
"@dbx-app/plugin-cli-win32-x64": "0.1.6"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.18.0"
|
"node": ">=18.18.0"
|
||||||
|
|||||||
Generated
+1
-1
@@ -119,7 +119,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dbx-plugin-cli"
|
name = "dbx-plugin-cli"
|
||||||
version = "0.1.5"
|
version = "0.1.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dbx-plugin-packager",
|
"dbx-plugin-packager",
|
||||||
"semver",
|
"semver",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dbx-plugin-cli"
|
name = "dbx-plugin-cli"
|
||||||
version = "0.1.5"
|
version = "0.1.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
description = "Scaffold and package DBX plugins"
|
description = "Scaffold and package DBX plugins"
|
||||||
|
|||||||
+22
-13
@@ -1139,25 +1139,34 @@ fn build_go_backend(
|
|||||||
return Err(format!("Go backend is missing {}/go.mod", backend_directory.display()));
|
return Err(format!("Go backend is missing {}/go.mod", backend_directory.display()));
|
||||||
}
|
}
|
||||||
let mut command = Command::new("go");
|
let mut command = Command::new("go");
|
||||||
command.current_dir(&backend_directory).arg("build").arg("-trimpath").arg("-o").arg(staged_executable).arg(".");
|
command.current_dir(&backend_directory).arg("build").arg("-trimpath");
|
||||||
if let Some(sdk_root) = sdk_root_from_environment()? {
|
if let Some(sdk_root) = sdk_root_from_environment()? {
|
||||||
let sdk = sdk_root.join("plugins/sdk/go/dbx-plugin-sdk");
|
let sdk = sdk_root.join("plugins/sdk/go/dbx-plugin-sdk");
|
||||||
if !sdk.join("go.mod").is_file() {
|
if !sdk.join("go.mod").is_file() {
|
||||||
return Err(format!("Go plugin SDK was not found at {}", sdk.display()));
|
return Err(format!("Go plugin SDK was not found at {}", sdk.display()));
|
||||||
}
|
}
|
||||||
fs::create_dir_all(build_directory).map_err(|error| error.to_string())?;
|
fs::create_dir_all(build_directory).map_err(|error| error.to_string())?;
|
||||||
let work_file = build_directory.join("go.work");
|
let mod_file = build_directory.join("go.mod");
|
||||||
fs::write(
|
fs::copy(backend_directory.join("go.mod"), &mod_file).map_err(|error| error.to_string())?;
|
||||||
&work_file,
|
let source_sum = backend_directory.join("go.sum");
|
||||||
format!(
|
if source_sum.is_file() {
|
||||||
"go 1.22\n\nuse (\n\t{}\n\t{}\n)\n",
|
fs::copy(source_sum, build_directory.join("go.sum")).map_err(|error| error.to_string())?;
|
||||||
serde_json::to_string(&go_work_path(&backend_directory)).map_err(|error| error.to_string())?,
|
}
|
||||||
serde_json::to_string(&go_work_path(&sdk)).map_err(|error| error.to_string())?
|
let mut replace = Command::new("go");
|
||||||
),
|
replace
|
||||||
)
|
.current_dir(&backend_directory)
|
||||||
.map_err(|error| error.to_string())?;
|
.arg("mod")
|
||||||
command.env("GOWORK", work_file);
|
.arg("edit")
|
||||||
|
.arg("-modfile")
|
||||||
|
.arg(&mod_file)
|
||||||
|
.arg(format!(
|
||||||
|
"-replace=github.com/t8y2/dbx/plugins/sdk/go/dbx-plugin-sdk={}",
|
||||||
|
go_work_path(&sdk)
|
||||||
|
));
|
||||||
|
run_command(&mut replace, "Go module setup")?;
|
||||||
|
command.env("GOWORK", "off").arg("-modfile").arg(&mod_file);
|
||||||
}
|
}
|
||||||
|
command.arg("-o").arg(staged_executable).arg(".");
|
||||||
run_command(&mut command, "Go backend build")
|
run_command(&mut command, "Go backend build")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1834,7 +1843,7 @@ mod tests {
|
|||||||
let workflow = std::fs::read_to_string(directory.join(".github/workflows/plugin-release.yml")).unwrap();
|
let workflow = std::fs::read_to_string(directory.join(".github/workflows/plugin-release.yml")).unwrap();
|
||||||
assert!(!workflow.contains("signing-key-id"));
|
assert!(!workflow.contains("signing-key-id"));
|
||||||
assert!(!workflow.contains("DBX_PLUGIN_SIGNING_KEY"));
|
assert!(!workflow.contains("DBX_PLUGIN_SIGNING_KEY"));
|
||||||
assert!(workflow.contains("plugin-cli-version: 0.1.5"));
|
assert!(workflow.contains("plugin-cli-version: 0.1.6"));
|
||||||
assert!(!workflow.contains("sdk-ref:"));
|
assert!(!workflow.contains("sdk-ref:"));
|
||||||
|
|
||||||
match template {
|
match template {
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ jobs:
|
|||||||
package-command: dbx-plugin package .
|
package-command: dbx-plugin package .
|
||||||
package-path: dist/*.dbxp
|
package-path: dist/*.dbxp
|
||||||
metadata-path: dist/*.artifact.json
|
metadata-path: dist/*.artifact.json
|
||||||
plugin-cli-version: 0.1.5
|
plugin-cli-version: 0.1.6
|
||||||
@@ -15,5 +15,5 @@ jobs:
|
|||||||
package-command: dbx-plugin package .
|
package-command: dbx-plugin package .
|
||||||
package-path: dist/*.dbxp
|
package-path: dist/*.dbxp
|
||||||
metadata-path: dist/*.artifact.json
|
metadata-path: dist/*.artifact.json
|
||||||
plugin-cli-version: 0.1.5
|
plugin-cli-version: 0.1.6
|
||||||
build-matrix: '{"include":[{"runner":"ubuntu-24.04","target":"universal"}]}'
|
build-matrix: '{"include":[{"runner":"ubuntu-24.04","target":"universal"}]}'
|
||||||
Generated
+6
-6
@@ -356,22 +356,22 @@ importers:
|
|||||||
packages/plugin-cli:
|
packages/plugin-cli:
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@dbx-app/plugin-cli-darwin-arm64':
|
'@dbx-app/plugin-cli-darwin-arm64':
|
||||||
specifier: 0.1.5
|
specifier: 0.1.6
|
||||||
version: link:../plugin-cli-darwin-arm64
|
version: link:../plugin-cli-darwin-arm64
|
||||||
'@dbx-app/plugin-cli-darwin-x64':
|
'@dbx-app/plugin-cli-darwin-x64':
|
||||||
specifier: 0.1.5
|
specifier: 0.1.6
|
||||||
version: link:../plugin-cli-darwin-x64
|
version: link:../plugin-cli-darwin-x64
|
||||||
'@dbx-app/plugin-cli-linux-arm64-gnu':
|
'@dbx-app/plugin-cli-linux-arm64-gnu':
|
||||||
specifier: 0.1.5
|
specifier: 0.1.6
|
||||||
version: link:../plugin-cli-linux-arm64-gnu
|
version: link:../plugin-cli-linux-arm64-gnu
|
||||||
'@dbx-app/plugin-cli-linux-x64-gnu':
|
'@dbx-app/plugin-cli-linux-x64-gnu':
|
||||||
specifier: 0.1.5
|
specifier: 0.1.6
|
||||||
version: link:../plugin-cli-linux-x64-gnu
|
version: link:../plugin-cli-linux-x64-gnu
|
||||||
'@dbx-app/plugin-cli-win32-arm64':
|
'@dbx-app/plugin-cli-win32-arm64':
|
||||||
specifier: 0.1.5
|
specifier: 0.1.6
|
||||||
version: link:../plugin-cli-win32-arm64
|
version: link:../plugin-cli-win32-arm64
|
||||||
'@dbx-app/plugin-cli-win32-x64':
|
'@dbx-app/plugin-cli-win32-x64':
|
||||||
specifier: 0.1.5
|
specifier: 0.1.6
|
||||||
version: link:../plugin-cli-win32-x64
|
version: link:../plugin-cli-win32-x64
|
||||||
|
|
||||||
packages/plugin-cli-darwin-arm64: {}
|
packages/plugin-cli-darwin-arm64: {}
|
||||||
|
|||||||
Reference in new issue
Block a user