diff --git a/.github/workflows/cxx-build.yml b/.github/workflows/cxx-build.yml index 145fea0cd..eff50865d 100644 --- a/.github/workflows/cxx-build.yml +++ b/.github/workflows/cxx-build.yml @@ -1,6 +1,9 @@ name: CXX build on: workflow_dispatch: + push: + branches: + - 'feature/cxx-build-workflow' pull_request: branches: - 'main' @@ -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 @@ -113,8 +104,8 @@ 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 @@ -122,14 +113,22 @@ jobs: 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 @@ -144,8 +143,8 @@ 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 @@ -153,14 +152,22 @@ jobs: 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 @@ -175,8 +182,8 @@ 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 @@ -184,11 +191,19 @@ jobs: 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 diff --git a/.github/workflows/utils.sh b/.github/workflows/utils.sh index 1c4ef9b57..f9427e546 100755 --- a/.github/workflows/utils.sh +++ b/.github/workflows/utils.sh @@ -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 \ No newline at end of file + ;; +esac \ No newline at end of file