From e06f85919e26f4c7dc2eed3e6501f98ff8fd96de Mon Sep 17 00:00:00 2001 From: aasgoel Date: Wed, 12 Jun 2024 14:53:57 +0530 Subject: [PATCH 01/21] Initial commit and adding .DS_Store --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 0713f6375..961ae1e50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /node_modules .swagger-codegen-ignore .swagger-codegen + +#adding for mac ds file +.DS_Store \ No newline at end of file From 1c922425f54264c8563bad54e0bd539b4fefa85b Mon Sep 17 00:00:00 2001 From: aasgoel Date: Wed, 12 Jun 2024 14:58:01 +0530 Subject: [PATCH 02/21] initial workflow commit --- .github/workflows/workflow-node.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/workflow-node.yml diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml new file mode 100644 index 000000000..d8732ab86 --- /dev/null +++ b/.github/workflows/workflow-node.yml @@ -0,0 +1,35 @@ +name: Node workflow to run Node REST Samples +on: + push: +env: + CLIENT_FOLDER: 'cybersource-rest-client-node' + SAMPLE_FOLDER: 'cybersource-rest-samples-node' +jobs: + complete-job: + defaults: + run: + shell: bash + strategy: + matrix: + operating-system: [ubuntu-latest,macos-latest,windows-latest] + runs-on: ${{matrix.operating-system}} + continue-on-error: true + steps: + - name: Making separate folders + run: | + rm -rf $CLIENT_FOLDER + rm -rf $SAMPLE_FOLDER + mkdir $CLIENT_FOLDER $SAMPLE_FOLDER + - name: Adding client + uses: actions/checkout@v4 + with: + path: ${{env.CLIENT_FOLDER}} + ref: 'adding-workflows' + - name: Adding sample + uses: actions/checkout@v4 + with: + repository: 'CyberSource/${{env.SAMPLE_FOLDER}}' + ref: 'testing-branch' + path: ${{env.SAMPLE_FOLDER}} + - name: Checkout Successful + run: echo "Successful Checkout" From e502d949332fc68468885ca6a7e036f2bb8b6c72 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Wed, 12 Jun 2024 15:34:10 +0530 Subject: [PATCH 03/21] nom installing the client and sample --- .github/workflows/workflow-node.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index d8732ab86..8de9c786f 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -31,5 +31,14 @@ jobs: repository: 'CyberSource/${{env.SAMPLE_FOLDER}}' ref: 'testing-branch' path: ${{env.SAMPLE_FOLDER}} - - name: Checkout Successful - run: echo "Successful Checkout" + - name: Build the Project + run: | + cd $CLIENT_FOLDER + npm install + cd .. + cd $SAMPLE_FOLDER + npm install + cd .. + - name: Build successful + run: echo "RUN SUCCESS" + From 781abde668fad82b25b9c89580c648f1fedc2cdf Mon Sep 17 00:00:00 2001 From: aasgoel Date: Wed, 12 Jun 2024 15:40:49 +0530 Subject: [PATCH 04/21] running the sample tests and uploading the output.log file --- .github/workflows/workflow-node.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 8de9c786f..467903f64 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -38,7 +38,10 @@ jobs: cd .. cd $SAMPLE_FOLDER npm install - cd .. - - name: Build successful - run: echo "RUN SUCCESS" - + source ./sample_code_runner.sh + - name: Upload the log files and report pdf + uses: actions/upload-artifact@v4 + with: + name: log-files-${{matrix.operating-system}} + path: | + ${{env.SAMPLE_FOLDER}}/output.log From e8d6c2cfc911c6a867cb1832b3deec5b15468ac2 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Thu, 13 Jun 2024 15:54:14 +0530 Subject: [PATCH 05/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 76 +++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 467903f64..0690dd0d7 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -4,14 +4,16 @@ on: env: CLIENT_FOLDER: 'cybersource-rest-client-node' SAMPLE_FOLDER: 'cybersource-rest-samples-node' + NPM_CLIENT_FOLDER : 'npm-client-sdk' jobs: - complete-job: + run-samples: defaults: run: shell: bash strategy: matrix: operating-system: [ubuntu-latest,macos-latest,windows-latest] + node-ver: [14.x,15.x,16.x,17.x,18.x,19.x,20.x,21.x,22.x] runs-on: ${{matrix.operating-system}} continue-on-error: true steps: @@ -31,17 +33,73 @@ jobs: repository: 'CyberSource/${{env.SAMPLE_FOLDER}}' ref: 'testing-branch' path: ${{env.SAMPLE_FOLDER}} + - name: Installing Required Node Version on the Machine + uses: actions/setup-node@v4 + with: + node-version: ${{matrix.node-ver}} - name: Build the Project run: | cd $CLIENT_FOLDER npm install - cd .. - cd $SAMPLE_FOLDER + npm pack + rm -rf ../$NPM_CLIENT_FOLDER + mkdir ../$NPM_CLIENT_FOLDER + PACKAGE_VERSION=\$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1) + tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../$NPM_CLIENT_FOLDER + cd ../$NPM_CLIENT_FOLDER/package + npm link + cd ../../$SAMPLE_FOLDER + npm link cybersource-rest-client npm install - source ./sample_code_runner.sh - - name: Upload the log files and report pdf - uses: actions/upload-artifact@v4 + # bash ./sample_code_runner.sh + - name: Getting the Validation files + uses: actions/checkout@v4 with: - name: log-files-${{matrix.operating-system}} - path: | - ${{env.SAMPLE_FOLDER}}/output.log + repository: 'CyberSource/cybersource-rest-samples-python' + ref: 'testing-branch' + path: ${{env.SAMPLE_FOLDER}} + sparse-checkout: | + Validation + - name: Generating the Report + run: + pwd + ls + # cd $SAMPLE_FOLDER + # pip install json2html + # pip install xhtml2pdf + # pip install bs4 + # cd Validation + # python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/python_actual_results.json + # python response_code_validator.py -e ExpectedResults/python_expected_results.json -a ../../$SAMPLE_FOLDER/python_actual_results.json -o python_validation_results.json + # python json_to_prettified_html.py -i python_validation_results.json -o python_validation_results.html + + # - name: Upload the log files and report pdf + # uses: actions/upload-artifact@v4 + # with: + # name: log-files-${{matrix.operating-system}} + # path: | + # ${{env.SAMPLE_FOLDER}}/output.log + + + +# node-sdk +# 1. node client sdk +# 2. sample sdk +# 3. NpmClientSdk + +# go to node client folder +# npm install +# npm pack +# rm -rf ../NpmClientSdk +# mkdir ../NpmClientSdk +# PACKAGE_VERSION=\$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1) +# tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../NpmClientSdk +# cd ../NpmClientSdk/package +# npm link +# cd ../../cybersource-rest-samples-node +# npm link cybersource-rest-client +# npm install + + + + From 4f8512752e0c2886c642464169a143e8eaf42e74 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Thu, 13 Jun 2024 17:15:32 +0530 Subject: [PATCH 06/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 0690dd0d7..546ef09b7 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -41,29 +41,29 @@ jobs: run: | cd $CLIENT_FOLDER npm install - npm pack - rm -rf ../$NPM_CLIENT_FOLDER - mkdir ../$NPM_CLIENT_FOLDER - PACKAGE_VERSION=\$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1) - tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../$NPM_CLIENT_FOLDER - cd ../$NPM_CLIENT_FOLDER/package + # npm pack + # rm -rf ../$NPM_CLIENT_FOLDER + # mkdir ../$NPM_CLIENT_FOLDER + # PACKAGE_VERSION=\$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1) + # tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../$NPM_CLIENT_FOLDER + # cd ../$NPM_CLIENT_FOLDER/package npm link - cd ../../$SAMPLE_FOLDER + cd ../$SAMPLE_FOLDER npm link cybersource-rest-client npm install - # bash ./sample_code_runner.sh - - name: Getting the Validation files - uses: actions/checkout@v4 - with: - repository: 'CyberSource/cybersource-rest-samples-python' - ref: 'testing-branch' - path: ${{env.SAMPLE_FOLDER}} - sparse-checkout: | - Validation - - name: Generating the Report - run: - pwd - ls + bash ./sample_code_runner.sh + # - name: Getting the Validation files + # uses: actions/checkout@v4 + # with: + # repository: 'CyberSource/cybersource-rest-samples-python' + # ref: 'testing-branch' + # path: ${{env.SAMPLE_FOLDER}} + # sparse-checkout: | + # Validation + # - name: Generating the Report + # run: + # pwd + # ls # cd $SAMPLE_FOLDER # pip install json2html # pip install xhtml2pdf From 4ac7f8b7446914840f39fbd55d024289b00ac63f Mon Sep 17 00:00:00 2001 From: aasgoel Date: Sun, 16 Jun 2024 22:07:05 +0530 Subject: [PATCH 07/21] Running the Workflow with Report Generator --- .github/workflows/workflow-node.yml | 64 ++++++++++++++--------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 546ef09b7..426e04459 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -13,7 +13,10 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest,macos-latest,windows-latest] - node-ver: [14.x,15.x,16.x,17.x,18.x,19.x,20.x,21.x,22.x] + node-ver: [14.x,16.x,17.x,18.x,19.x,20.x,21.x,22.x] # Axios Doesn't support node version 15 + exclude: + - operating-system: macos-latest # No Node 14 image is there for the arm64 architecture of mac + node-ver: 14.x runs-on: ${{matrix.operating-system}} continue-on-error: true steps: @@ -41,44 +44,37 @@ jobs: run: | cd $CLIENT_FOLDER npm install - # npm pack - # rm -rf ../$NPM_CLIENT_FOLDER - # mkdir ../$NPM_CLIENT_FOLDER - # PACKAGE_VERSION=\$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1) - # tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../$NPM_CLIENT_FOLDER - # cd ../$NPM_CLIENT_FOLDER/package + npm pack + rm -rf ../$NPM_CLIENT_FOLDER + mkdir ../$NPM_CLIENT_FOLDER + PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1) + tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../$NPM_CLIENT_FOLDER + cd ../$NPM_CLIENT_FOLDER/package npm link cd ../$SAMPLE_FOLDER npm link cybersource-rest-client npm install bash ./sample_code_runner.sh - # - name: Getting the Validation files - # uses: actions/checkout@v4 - # with: - # repository: 'CyberSource/cybersource-rest-samples-python' - # ref: 'testing-branch' - # path: ${{env.SAMPLE_FOLDER}} - # sparse-checkout: | - # Validation - # - name: Generating the Report - # run: - # pwd - # ls - # cd $SAMPLE_FOLDER - # pip install json2html - # pip install xhtml2pdf - # pip install bs4 - # cd Validation - # python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/python_actual_results.json - # python response_code_validator.py -e ExpectedResults/python_expected_results.json -a ../../$SAMPLE_FOLDER/python_actual_results.json -o python_validation_results.json - # python json_to_prettified_html.py -i python_validation_results.json -o python_validation_results.html - - # - name: Upload the log files and report pdf - # uses: actions/upload-artifact@v4 - # with: - # name: log-files-${{matrix.operating-system}} - # path: | - # ${{env.SAMPLE_FOLDER}}/output.log + - name: Set Up python to build reports + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: + run: | + cd $SAMPLE_FOLDER + pip install json2html + pip install xhtml2pdf + pip install bs4 + cd Validation + python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/python_actual_results.json + python response_code_validator.py -e ExpectedResults/python_expected_results.json -a ../../$SAMPLE_FOLDER/python_actual_results.json -o python_validation_results.json + python json_to_prettified_html.py -i python_validation_results.json -o python_validation_results.html + - name: Upload the log files and report pdf + uses: actions/upload-artifact@v4 + with: + name: log-files-${{matrix.operating-system}}-ver${{matrix.node-ver}} + path: | + ${{env.SAMPLE_FOLDER}}/Validation/python_validation_results.pdf From 8cb8ed4878e2bb71ae20dafe2dc852980b6ee8e4 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Sun, 16 Jun 2024 22:48:30 +0530 Subject: [PATCH 08/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 426e04459..2282bd160 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -54,7 +54,8 @@ jobs: cd ../$SAMPLE_FOLDER npm link cybersource-rest-client npm install - bash ./sample_code_runner.sh + ls + #bash ./sample_code_runner.sh - name: Set Up python to build reports uses: actions/setup-python@v5 with: From 9db841e5385b9135d435bdf23c80a076aaa8c0b7 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Sun, 16 Jun 2024 22:51:35 +0530 Subject: [PATCH 09/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 2282bd160..33c9a2315 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -51,11 +51,10 @@ jobs: tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../$NPM_CLIENT_FOLDER cd ../$NPM_CLIENT_FOLDER/package npm link - cd ../$SAMPLE_FOLDER + cd ../../$SAMPLE_FOLDER npm link cybersource-rest-client npm install - ls - #bash ./sample_code_runner.sh + bash ./sample_code_runner.sh - name: Set Up python to build reports uses: actions/setup-python@v5 with: From b46b9755076bcad591f63621ddeebf0b84b336a2 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Sun, 16 Jun 2024 23:07:16 +0530 Subject: [PATCH 10/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 44 +++++++---------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 33c9a2315..4662cadb1 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -1,4 +1,4 @@ -name: Node workflow to run Node REST Samples +name: workflow for cybs rest client node sdk to run samples on: push: env: @@ -6,7 +6,7 @@ env: SAMPLE_FOLDER: 'cybersource-rest-samples-node' NPM_CLIENT_FOLDER : 'npm-client-sdk' jobs: - run-samples: + workflow-job: defaults: run: shell: bash @@ -20,27 +20,27 @@ jobs: runs-on: ${{matrix.operating-system}} continue-on-error: true steps: - - name: Making separate folders + - name: Creating separate folders for checkout repos run: | rm -rf $CLIENT_FOLDER rm -rf $SAMPLE_FOLDER mkdir $CLIENT_FOLDER $SAMPLE_FOLDER - - name: Adding client + - name: Checkout cybersource-rest-client-node repo uses: actions/checkout@v4 with: path: ${{env.CLIENT_FOLDER}} ref: 'adding-workflows' - - name: Adding sample + - name: Checkout cybersource-rest-samples-node repo uses: actions/checkout@v4 with: repository: 'CyberSource/${{env.SAMPLE_FOLDER}}' ref: 'testing-branch' path: ${{env.SAMPLE_FOLDER}} - - name: Installing Required Node Version on the Machine + - name: Install Node uses: actions/setup-node@v4 with: node-version: ${{matrix.node-ver}} - - name: Build the Project + - name: Building the projects and running the Test Cases run: | cd $CLIENT_FOLDER npm install @@ -55,11 +55,11 @@ jobs: npm link cybersource-rest-client npm install bash ./sample_code_runner.sh - - name: Set Up python to build reports + - name: Setup Python v3.12 for report generation only uses: actions/setup-python@v5 with: python-version: '3.12' - - name: + - name: Installing required python libraries and running the python programs to generate pdf report run: | cd $SAMPLE_FOLDER pip install json2html @@ -69,33 +69,9 @@ jobs: python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/python_actual_results.json python response_code_validator.py -e ExpectedResults/python_expected_results.json -a ../../$SAMPLE_FOLDER/python_actual_results.json -o python_validation_results.json python json_to_prettified_html.py -i python_validation_results.json -o python_validation_results.html - - name: Upload the log files and report pdf + - name: Upload Test Reports uses: actions/upload-artifact@v4 with: name: log-files-${{matrix.operating-system}}-ver${{matrix.node-ver}} path: | ${{env.SAMPLE_FOLDER}}/Validation/python_validation_results.pdf - - - -# node-sdk -# 1. node client sdk -# 2. sample sdk -# 3. NpmClientSdk - -# go to node client folder -# npm install -# npm pack -# rm -rf ../NpmClientSdk -# mkdir ../NpmClientSdk -# PACKAGE_VERSION=\$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1) -# tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../NpmClientSdk -# cd ../NpmClientSdk/package -# npm link -# cd ../../cybersource-rest-samples-node -# npm link cybersource-rest-client -# npm install - - - - From 87feb1585880d3e1ce324e0408a9cfa1c44b27a8 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Wed, 19 Jun 2024 15:03:20 +0530 Subject: [PATCH 11/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 4662cadb1..756c07999 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -1,6 +1,8 @@ name: workflow for cybs rest client node sdk to run samples on: push: + pull_request: + workflow_dispatch: env: CLIENT_FOLDER: 'cybersource-rest-client-node' SAMPLE_FOLDER: 'cybersource-rest-samples-node' @@ -17,6 +19,9 @@ jobs: exclude: - operating-system: macos-latest # No Node 14 image is there for the arm64 architecture of mac node-ver: 14.x + include: + - operating-system: macos-13 # No Node 14 image is there for the arm64 architecture of mac + node-ver: 14.x runs-on: ${{matrix.operating-system}} continue-on-error: true steps: @@ -62,6 +67,7 @@ jobs: - name: Installing required python libraries and running the python programs to generate pdf report run: | cd $SAMPLE_FOLDER + python -m pip install --upgrade pip pip install json2html pip install xhtml2pdf pip install bs4 From f664a3f381c7cfacf1ca0deda6040a3308967cce Mon Sep 17 00:00:00 2001 From: aasgoel Date: Wed, 19 Jun 2024 15:04:49 +0530 Subject: [PATCH 12/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 756c07999..9248c1328 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -13,6 +13,7 @@ jobs: run: shell: bash strategy: + fail-fast: false matrix: operating-system: [ubuntu-latest,macos-latest,windows-latest] node-ver: [14.x,16.x,17.x,18.x,19.x,20.x,21.x,22.x] # Axios Doesn't support node version 15 @@ -23,7 +24,6 @@ jobs: - operating-system: macos-13 # No Node 14 image is there for the arm64 architecture of mac node-ver: 14.x runs-on: ${{matrix.operating-system}} - continue-on-error: true steps: - name: Creating separate folders for checkout repos run: | From deabeb32c3f96267628df361aa4516dd6895a8c2 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Mon, 24 Jun 2024 09:57:01 +0530 Subject: [PATCH 13/21] Changed the name of reports to node from python --- .github/workflows/workflow-node.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 9248c1328..71a01fc7a 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -72,12 +72,12 @@ jobs: pip install xhtml2pdf pip install bs4 cd Validation - python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/python_actual_results.json - python response_code_validator.py -e ExpectedResults/python_expected_results.json -a ../../$SAMPLE_FOLDER/python_actual_results.json -o python_validation_results.json - python json_to_prettified_html.py -i python_validation_results.json -o python_validation_results.html + python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/node_actual_results.json + python response_code_validator.py -e ExpectedResults/node_expected_results.json -a ../../$SAMPLE_FOLDER/node_actual_results.json -o node_validation_results.json + python json_to_prettified_html.py -i node_validation_results.json -o node_validation_results.html - name: Upload Test Reports uses: actions/upload-artifact@v4 with: name: log-files-${{matrix.operating-system}}-ver${{matrix.node-ver}} path: | - ${{env.SAMPLE_FOLDER}}/Validation/python_validation_results.pdf + ${{env.SAMPLE_FOLDER}}/Validation/node_validation_results.pdf \ No newline at end of file From bc55fff982644b7697071d7a5b6abc36fe1aefd4 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Mon, 1 Jul 2024 16:49:46 +0530 Subject: [PATCH 14/21] Renaming the workflow and adding status badge [no ci] --- .github/workflows/workflow-node.yml | 3 +-- README.md | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 71a01fc7a..7cc81d9ad 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -1,4 +1,4 @@ -name: workflow for cybs rest client node sdk to run samples +name: NODE BUILDS on: push: pull_request: @@ -34,7 +34,6 @@ jobs: uses: actions/checkout@v4 with: path: ${{env.CLIENT_FOLDER}} - ref: 'adding-workflows' - name: Checkout cybersource-rest-samples-node repo uses: actions/checkout@v4 with: diff --git a/README.md b/README.md index e785a8267..c701602bc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Node.JS Client SDK for the CyberSource REST API +[![NODE BUILDS](https://github.com/CyberSource/cybersource-rest-client-node/actions/workflows/workflow-node.yml/badge.svg)](https://github.com/CyberSource/cybersource-rest-client-node/actions/workflows/workflow-node.yml) + ## Description The CyberSource Node client provides convenient access to the [CyberSource REST API](https://developer.cybersource.com/api/reference/api-reference.html) from your Node application. From 2f2b976d2df8d9ddba8e7c6a213b28d093bcf22b Mon Sep 17 00:00:00 2001 From: aasgoel Date: Mon, 1 Jul 2024 16:50:55 +0530 Subject: [PATCH 15/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 7cc81d9ad..f5c6e5933 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -79,4 +79,6 @@ jobs: with: name: log-files-${{matrix.operating-system}}-ver${{matrix.node-ver}} path: | - ${{env.SAMPLE_FOLDER}}/Validation/node_validation_results.pdf \ No newline at end of file + ${{env.SAMPLE_FOLDER}}/Validation/node_validation_results.pdf + +#Triggering the Workflow From 8dd149affb4a4cb23a03a77a45a2e9735098ed38 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Wed, 3 Jul 2024 15:25:58 +0530 Subject: [PATCH 16/21] Checking with Action --- .github/actions/generate-report/action.yml | 58 +++++++++++++++++ .github/workflows/workflow-node.yml | 72 +++++++++++++++++----- 2 files changed, 113 insertions(+), 17 deletions(-) create mode 100644 .github/actions/generate-report/action.yml diff --git a/.github/actions/generate-report/action.yml b/.github/actions/generate-report/action.yml new file mode 100644 index 000000000..b37875235 --- /dev/null +++ b/.github/actions/generate-report/action.yml @@ -0,0 +1,58 @@ +name: 'Generate the Report' +description: 'Generates the report using the log-file-name file present just inside the sample folder path provided , given Validation Folder is there inside the sample folder as well' +inputs: + lang: + description: 'The language or framework in which SDK is written needs to be given as an input' + required: true + sample-folder-name: + description: 'The name of the sample folder' + required: true + log-file-name: + description: 'The name of the generated log file' + required: true +outputs: + result-pdf-name: + description: 'the name of the final generated pdf report' + value: ${{steps.generate.outputs.pdfname}} +runs: + using: 'composite' + steps: + - name: Setup Python v3.12 for report generation only + uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Installing required python libraries and running the python programs to generate pdf report + id: generate + run : | + export EXPECTED_RES_LANG=${{inputs.lang}} + if [[ "${{inputs.lang}}" == "dotnet" ]] || [[ "${{inputs.lang}}" == "dotnetstandard" ]]; then + export EXPECTED_RES_LANG=csharp + fi + echo $EXPECTED_RES_LANG + python --version + echo "Before Running Report Generation" + cd ${{inputs.sample-folder-name}} + python -m pip install --upgrade pip + python -m venv newve + if [[ "$(uname -s)" == "Linux" ]]; then + echo "In LINUX" + source newve/bin/activate + elif [[ "$(uname -s)" == "Darwin" ]]; then + echo "In MAC" + source newve/bin/activate + else + echo "In Windows" + source newve/Scripts/activate + fi + echo $VIRTUAL_ENV + pip install json2html + pip install xhtml2pdf + pip install bs4 + cd Validation + python sample_code_log_processor.py -l ../../${{inputs.sample-folder-name}}/${{inputs.log-file-name}} -o ../../${{inputs.sample-folder-name}}/${{inputs.lang}}_actual_results.json + python response_code_validator.py -e ExpectedResults/${EXPECTED_RES_LANG}_expected_results.json -a ../../${{inputs.sample-folder-name}}/${{inputs.lang}}_actual_results.json -o ${{inputs.lang}}_validation_results.json + python json_to_prettified_html.py -i ${{inputs.lang}}_validation_results.json -o ${{inputs.lang}}_validation_results.html + cp ${{inputs.lang}}_validation_results.pdf ../ #copying the file to flaatten the directory of the upload artifact,Github Actions doesn't support that as of jun 2024 + echo "pdfname=${{inputs.lang}}_validation_results.pdf" >> $GITHUB_OUTPUT + shell: bash + diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index f5c6e5933..145393eb1 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -59,26 +59,64 @@ jobs: npm link cybersource-rest-client npm install bash ./sample_code_runner.sh - - name: Setup Python v3.12 for report generation only - uses: actions/setup-python@v5 + - name: Using Report Generation Action + id: report-generation + uses: ./cybersource-rest-client-node/.github/actions/generate-report with: - python-version: '3.12' - - name: Installing required python libraries and running the python programs to generate pdf report - run: | - cd $SAMPLE_FOLDER - python -m pip install --upgrade pip - pip install json2html - pip install xhtml2pdf - pip install bs4 - cd Validation - python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/node_actual_results.json - python response_code_validator.py -e ExpectedResults/node_expected_results.json -a ../../$SAMPLE_FOLDER/node_actual_results.json -o node_validation_results.json - python json_to_prettified_html.py -i node_validation_results.json -o node_validation_results.html + lang: node + sample-folder-name: ${{env.SAMPLE_FOLDER}} + log-file-name: output.log - name: Upload Test Reports uses: actions/upload-artifact@v4 with: - name: log-files-${{matrix.operating-system}}-ver${{matrix.node-ver}} + name: sample-run-report-${{matrix.operating-system}}-node-ver-${{matrix.node-ver}} path: | - ${{env.SAMPLE_FOLDER}}/Validation/node_validation_results.pdf + ${{env.SAMPLE_FOLDER}}/${{steps.report-generation.outputs.result-pdf-name}} + + + + + + + + + + + + + + + + + + + + + + + + + + -#Triggering the Workflow + # - name: Setup Python v3.12 for report generation only + # uses: actions/setup-python@v5 + # with: + # python-version: '3.12' + # - name: Installing required python libraries and running the python programs to generate pdf report + # run: | + # cd $SAMPLE_FOLDER + # python -m pip install --upgrade pip + # pip install json2html + # pip install xhtml2pdf + # pip install bs4 + # cd Validation + # python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/node_actual_results.json + # python response_code_validator.py -e ExpectedResults/node_expected_results.json -a ../../$SAMPLE_FOLDER/node_actual_results.json -o node_validation_results.json + # python json_to_prettified_html.py -i node_validation_results.json -o node_validation_results.html + # - name: Upload Test Reports + # uses: actions/upload-artifact@v4 + # with: + # name: log-files-${{matrix.operating-system}}-ver${{matrix.node-ver}} + # path: | + # ${{env.SAMPLE_FOLDER}}/Validation/node_validation_results.pdf From d933e67c6bde2e0fdf61bf8ce04103631a5fce45 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Mon, 8 Jul 2024 15:11:57 +0530 Subject: [PATCH 17/21] [no ci] --- .github/workflows/workflow-node.yml | 47 ----------------------------- 1 file changed, 47 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 145393eb1..49e44128e 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -73,50 +73,3 @@ jobs: path: | ${{env.SAMPLE_FOLDER}}/${{steps.report-generation.outputs.result-pdf-name}} - - - - - - - - - - - - - - - - - - - - - - - - - - - # - name: Setup Python v3.12 for report generation only - # uses: actions/setup-python@v5 - # with: - # python-version: '3.12' - # - name: Installing required python libraries and running the python programs to generate pdf report - # run: | - # cd $SAMPLE_FOLDER - # python -m pip install --upgrade pip - # pip install json2html - # pip install xhtml2pdf - # pip install bs4 - # cd Validation - # python sample_code_log_processor.py -l ../../$SAMPLE_FOLDER/output.log -o ../../$SAMPLE_FOLDER/node_actual_results.json - # python response_code_validator.py -e ExpectedResults/node_expected_results.json -a ../../$SAMPLE_FOLDER/node_actual_results.json -o node_validation_results.json - # python json_to_prettified_html.py -i node_validation_results.json -o node_validation_results.html - # - name: Upload Test Reports - # uses: actions/upload-artifact@v4 - # with: - # name: log-files-${{matrix.operating-system}}-ver${{matrix.node-ver}} - # path: | - # ${{env.SAMPLE_FOLDER}}/Validation/node_validation_results.pdf From 824119144130cc05d60377680cc71c7b26816723 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Fri, 12 Jul 2024 15:49:16 +0530 Subject: [PATCH 18/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 49e44128e..7347860c4 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest,macos-latest,windows-latest] - node-ver: [14.x,16.x,17.x,18.x,19.x,20.x,21.x,22.x] # Axios Doesn't support node version 15 + node-ver: [14.x,15.x,16.x,17.x,18.x,19.x,20.x,21.x,22.x] # Axios Doesn't support node version 15 exclude: - operating-system: macos-latest # No Node 14 image is there for the arm64 architecture of mac node-ver: 14.x @@ -72,4 +72,3 @@ jobs: name: sample-run-report-${{matrix.operating-system}}-node-ver-${{matrix.node-ver}} path: | ${{env.SAMPLE_FOLDER}}/${{steps.report-generation.outputs.result-pdf-name}} - From 99455702461cf19c1ba86ce82073acb87db03d7a Mon Sep 17 00:00:00 2001 From: aasgoel Date: Fri, 12 Jul 2024 15:52:17 +0530 Subject: [PATCH 19/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 7347860c4..d2e7da3a6 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest,macos-latest,windows-latest] - node-ver: [14.x,15.x,16.x,17.x,18.x,19.x,20.x,21.x,22.x] # Axios Doesn't support node version 15 + node-ver: [14.x,16.x,17.x,18.x,19.x,20.x,21.x,22.x] # Axios Doesn't support node version 15 exclude: - operating-system: macos-latest # No Node 14 image is there for the arm64 architecture of mac node-ver: 14.x From 08a2f56a9bf1fbfde851f1459ceadfd0bc6fd593 Mon Sep 17 00:00:00 2001 From: aasgoel Date: Tue, 16 Jul 2024 11:49:03 +0530 Subject: [PATCH 20/21] Update workflow-node.yml --- .github/workflows/workflow-node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index d2e7da3a6..462d2464e 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CyberSource/${{env.SAMPLE_FOLDER}}' - ref: 'testing-branch' + ref: 'master' path: ${{env.SAMPLE_FOLDER}} - name: Install Node uses: actions/setup-node@v4 From 3c8c0778c46c807781a2d98a548d1f77bd6f2e0e Mon Sep 17 00:00:00 2001 From: gaubansa <101095184+gaubansa@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:11:07 +0530 Subject: [PATCH 21/21] removing the npm link command in workflow --- .github/workflows/workflow-node.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow-node.yml b/.github/workflows/workflow-node.yml index 462d2464e..dec6af92a 100644 --- a/.github/workflows/workflow-node.yml +++ b/.github/workflows/workflow-node.yml @@ -49,14 +49,9 @@ jobs: cd $CLIENT_FOLDER npm install npm pack - rm -rf ../$NPM_CLIENT_FOLDER - mkdir ../$NPM_CLIENT_FOLDER PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1) - tar -xvzf "cybersource-rest-client-$PACKAGE_VERSION.tgz" -C ../$NPM_CLIENT_FOLDER - cd ../$NPM_CLIENT_FOLDER/package - npm link - cd ../../$SAMPLE_FOLDER - npm link cybersource-rest-client + cd ../$SAMPLE_FOLDER + npm install file:../$CLIENT_FOLDER/cybersource-rest-client-$PACKAGE_VERSION.tgz npm install bash ./sample_code_runner.sh - name: Using Report Generation Action