Skip to content

Commit

Permalink
fixup! refactor: CI pipeline to build CPP SDKs
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKasar committed Oct 15, 2024
1 parent 382b02d commit ec360b5
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 61 deletions.
81 changes: 48 additions & 33 deletions .github/workflows/cxx-build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: CXX build
on:
workflow_dispatch:
push:
branches:
- 'feature/cxx-build-workflow'
pull_request:
branches:
- 'main'
Expand Down Expand Up @@ -73,32 +76,20 @@ jobs:
- name: Upload Core SDK
uses: actions/upload-artifact@v3
with:
name: core-sdk
path: |
package.json
package-lock.json
dist
src/sdks/core
name: core
path: src/sdks/core

- name: Upload Manage SDK
uses: actions/upload-artifact@v3
with:
name: manage-sdk
path: |
package.json
package-lock.json
dist
src/sdks/manage
name: manage
path: src/sdks/manage

- name: Upload Discovery SDK
uses: actions/upload-artifact@v3
with:
name: discovery-sdk
path: |
package.json
package-lock.json
dist
src/sdks/discovery
name: discovery
path: src/sdks/discovery

core_sdk:
name: Build Core SDK
Expand All @@ -113,23 +104,31 @@ jobs:
- name: Download Core SDK
uses: actions/download-artifact@v3
with:
name: core-sdk
path: /__w/core-sdk/
name: core
path: /__w/firebolt-apis/src/sdks/core

- name: Download Thunder
uses: actions/download-artifact@v3
with:
name: thunder
path: /__w/thunder/install/

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: deps-node-modules-${{ hashFiles('package-lock.json') }}

- name: Install npm dependencies
run: npm ci

- name: Generate core SDK source code
run: |
cd /__w/core-sdk/
npm ci
.github/workflows/utils.sh generate_cpp_core_sdk_source_code
- name: Build CXX Core SDK
run: |
.github/workflows/utils.sh buildCoreCPPSDK
.github/workflows/utils.sh build_core_cpp_sdk
manage_sdk:
name: Build Manage SDK
Expand All @@ -144,23 +143,31 @@ jobs:
- name: Download Manage SDK
uses: actions/download-artifact@v3
with:
name: manage-sdk
path: /__w/manage-sdk/
name: manage
path: /__w/firebolt-apis/src/sdks/manage

- name: Download Thunder
uses: actions/download-artifact@v3
with:
name: thunder
path: /__w/thunder/install/

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: deps-node-modules-${{ hashFiles('package-lock.json') }}

- name: Install npm dependencies
run: npm ci

- name: Generate manage SDK source code
run: |
cd /__w/manage-sdk/
npm ci
.github/workflows/utils.sh generate_cpp_manage_sdk_source_code
- name: Build CXX manage SDK
run: |
.github/workflows/utils.sh buildManageCPPSDK
.github/workflows/utils.sh build_manage_cpp_sdk
dicovery_sdk:
name: Build Discovery SDK
Expand All @@ -175,20 +182,28 @@ jobs:
- name: Download Discovery SDK
uses: actions/download-artifact@v3
with:
name: discovery-sdk
path: /__w/discovery-sdk/
name: discovery
path: /__w/firebolt-apis/src/sdks/discovery

- name: Download Thunder
uses: actions/download-artifact@v3
with:
name: thunder
path: /__w/thunder/install/

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: deps-node-modules-${{ hashFiles('package-lock.json') }}

- name: Install npm dependencies
run: npm ci

- name: Generate discovery SDK source code
run: |
cd /__w/discovery-sdk/
npm ci
.github/workflows/utils.sh generate_cpp_discovery_sdk_source_code
- name: Build CXX Discovery SDK
run: |
.github/workflows/utils.sh buildDiscoveryCPPSDK
.github/workflows/utils.sh build_discovery_cpp_sdk
56 changes: 28 additions & 28 deletions .github/workflows/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,44 +224,44 @@ function cloneAndInstallThunder() {
cmake --build build/Thunder --target install && echo "Thunder Build succeeded" || exit 9999
}


function generate_cpp_sdk_source_code(){
local sdk_name=$1

echo " ************ Genrate Source Code for ${sdk_name^} CPP SDK ************"

FIREBOLT_VERSION=1.3.0-next.1
# cp -rf /__w/${sdk_name}-sdk/src/sdks/${sdk_name}/ src/sdks/
cd src/sdks/${sdk_name}
npm run cpp
}

function buildCPPSDK() {
FIREBOLT_VERSION=1.3.0-next.1
local sdk_name=$1

echo " ************ Build ${sdk_name^} CPP SDK ************"

FIREBOLT_VERSION=1.3.0-next.1
cd /__w/${sdk_name}-sdk/src/sdks/${sdk_name}/
npm run cpp

mkdir -p /__w/${sdk_name}-sdk/data
tar -zxvf build/cpp/src/firebolt-${sdk_name}-native-sdk-${FIREBOLT_VERSION}.tgz -C /__w/${sdk_name}-sdk/data
cd /__w/${sdk_name}-sdk/data/firebolt-${sdk_name}-native-sdk-${FIREBOLT_VERSION}/
cd /__w/firebolt-apis/src/sdks/${sdk_name}/build/cpp/src/firebolt-${sdk_name}-native-sdk-${FIREBOLT_VERSION}/
chmod +x ./build.sh
sed -i -e 's/prefix=/prefix /g' build.sh

./build.sh -s "/__w/thunder/install/" || exit 9999
}

# Check argument and call corresponding function
if [ "$1" == "runTests" ]; then
runTests
elif [ "$1" == "getResults" ]; then
getResults
elif [ "$1" == "getArtifactData" ]; then
getArtifactData
elif [ "$1" == "unzipArtifact" ]; then
unzipArtifact
elif [ "$1" == "generateSource" ]; then
generateSource
elif [ "$1" == "cloneAndInstallThunder" ]; then
cloneAndInstallThunder
elif [ "$1" == "buildCoreCPPSDK" ]; then
buildCPPSDK "core"
elif [ "$1" == "buildManageCPPSDK" ]; then
buildCPPSDK "manage"
elif [ "$1" == "buildDiscoveryCPPSDK" ]; then
buildCPPSDK "discovery"
else
case "$1" in
runTests) runTests ;;
getResults) getResults ;;
getArtifactData) getArtifactData ;;
generate_cpp_core_sdk_source_code) generate_cpp_sdk_source_code "core" ;;
generate_cpp_manage_sdk_source_code) generate_cpp_sdk_source_code "manage" ;;
generate_cpp_discovery_sdk_source_code) generate_cpp_sdk_source_code "discovery" ;;
cloneAndInstallThunder) cloneAndInstallThunder ;;
build_core_cpp_sdk) build_cpp_sdk "core" ;;
build_manage_cpp_sdk) build_cpp_sdk "manage" ;;
build_discovery_cpp_sdk) build_cpp_sdk "discovery" ;;
*)
echo "Invalid function specified."
exit 1
fi
;;
esac

0 comments on commit ec360b5

Please sign in to comment.