From bdee71723c88ead081eeb9f009f506fea5f763d3 Mon Sep 17 00:00:00 2001 From: kdivya153 <121901963+kdivya153@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:10:21 -0500 Subject: [PATCH] Fix: Do not hard-code SDK versions in CI (#339) * Fixed hardcoded Firebolt version in CI for build CPP SDK * Update cxx-build.yml * Update cxx-build.yml * Reverted back * Update cxx-build.yml * Update utils.sh --- .github/workflows/cxx-build.yml | 2 +- .github/workflows/utils.sh | 6 +++--- src/sdks/core/package.json | 5 +++-- src/sdks/discovery/package.json | 5 +++-- src/sdks/manage/package.json | 5 +++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cxx-build.yml b/.github/workflows/cxx-build.yml index 221ef8b3..b87ed6c6 100644 --- a/.github/workflows/cxx-build.yml +++ b/.github/workflows/cxx-build.yml @@ -207,4 +207,4 @@ jobs: - name: Build CXX Discovery SDK run: | - .github/workflows/utils.sh build_discovery_cpp_sdk + .github/workflows/utils.sh build_discovery_cpp_sdk \ No newline at end of file diff --git a/.github/workflows/utils.sh b/.github/workflows/utils.sh index 53533036..b385fe38 100755 --- a/.github/workflows/utils.sh +++ b/.github/workflows/utils.sh @@ -1,7 +1,6 @@ #!/bin/bash set -o pipefail -FIREBOLT_VERSION=1.0.0-next.0 current_apis_dir=$(pwd) cd .. @@ -258,13 +257,14 @@ function generate_cpp_sdk_source_code(){ echo " ************ Genrate Source Code for ${sdk_name^} CPP SDK ************" - FIREBOLT_VERSION=1.3.0-next.1 cd src/sdks/${sdk_name} npm run cpp } function build_cpp_sdk() { - FIREBOLT_VERSION=1.3.0-next.1 + + FIREBOLT_VERSION=$(node -p "require('./package.json').version") + echo "The version from package.json is $FIREBOLT_VERSION" local sdk_name=$1 echo " ************ Build ${sdk_name^} CPP SDK ************" diff --git a/src/sdks/core/package.json b/src/sdks/core/package.json index 60dfecc5..308d411a 100644 --- a/src/sdks/core/package.json +++ b/src/sdks/core/package.json @@ -11,7 +11,7 @@ "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-core-open-rpc.json --template ./src/cpp --output ./build/c/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/c", "cpp": "npm run cpp:compile && cp ./dist/firebolt-core-open-rpc.json ./build/cpp/src && npm run cpp:install", "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-core-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", - "cpp:install": "./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m core", + "cpp:install": "chmod +x ./build/cpp/src/scripts/install.sh && sdkVersion=$(npm run -s getVersion) && ./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m core -v $sdkVersion", "compile": "cd ../../.. && npm run compile", "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-core-open-rpc.json", "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-core-open-rpc.json --output build/docs/markdown --as-path", @@ -26,7 +26,8 @@ "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", "prepack": "node ../../js/version.mjs validate && npm run broilerplate", "broilerplate": "rm ./CONTRIBUTING.md && cp ../../../CONTRIBUTING.md ./CONTRIBUTING.md && rm ./LICENSE && cp ../../../LICENSE ./LICENSE && rm ./NOTICE && cp ../../../NOTICE ./NOTICE", - "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown" + "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown", + "getVersion": "node -p \"require('./package.json').version\"" }, "repository": { "type": "git", diff --git a/src/sdks/discovery/package.json b/src/sdks/discovery/package.json index 5e722ba4..a467ce3b 100644 --- a/src/sdks/discovery/package.json +++ b/src/sdks/discovery/package.json @@ -11,7 +11,7 @@ "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/js --output ./build/c/src --language ../../../node_modules/@firebolt-js/openrpc/languages/c", "cpp": "npm run cpp:compile && cp ./dist/firebolt-discovery-open-rpc.json ./build/cpp/src && npm run cpp:install", "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", - "cpp:install": "./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m discovery", + "cpp:install": "chmod +x ./build/cpp/src/scripts/install.sh && sdkVersion=$(npm run -s getVersion) && ./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m discovery -v $sdkVersion", "compile": "cd ../../.. && npm run compile", "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-discovery-open-rpc.json", "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-discovery-open-rpc.json --output build/docs/markdown --as-path", @@ -26,7 +26,8 @@ "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", "prepack": "node ../../js/version.mjs validate && npm run broilerplate", "broilerplate": "rm ./CONTRIBUTING.md && cp ../../../CONTRIBUTING.md ./CONTRIBUTING.md && rm ./LICENSE && cp ../../../LICENSE ./LICENSE && rm ./NOTICE && cp ../../../NOTICE ./NOTICE", - "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown" + "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown", + "getVersion": "node -p \"require('./package.json').version\"" }, "repository": { "type": "git", diff --git a/src/sdks/manage/package.json b/src/sdks/manage/package.json index c8ca4b56..66d628e0 100644 --- a/src/sdks/manage/package.json +++ b/src/sdks/manage/package.json @@ -11,7 +11,7 @@ "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-manage-open-rpc.json --template ./src/js --output ./build/c/src --language ../../../node_modules/@firebolt-js/openrpc/languages/c", "cpp": "npm run cpp:compile && cp ./dist/firebolt-manage-open-rpc.json ./build/cpp/src && npm run cpp:install", "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-manage-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", - "cpp:install": "./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m manage", + "cpp:install": "chmod +x ./build/cpp/src/scripts/install.sh && sdkVersion=$(npm run -s getVersion) && ./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m manage -v $sdkVersion", "compile": "cd ../../.. && npm run compile", "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-manage-open-rpc.json", "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-manage-open-rpc.json --output build/docs/markdown --as-path", @@ -26,7 +26,8 @@ "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", "prepack": "node ../../js/version.mjs validate && npm run broilerplate", "broilerplate": "rm ./CONTRIBUTING.md && cp ../../../CONTRIBUTING.md ./CONTRIBUTING.md && rm ./LICENSE && cp ../../../LICENSE ./LICENSE && rm ./NOTICE && cp ../../../NOTICE ./NOTICE", - "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown" + "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.md --write --parser markdown", + "getVersion": "node -p \"require('./package.json').version\"" }, "repository": { "type": "git",