diff --git a/.github/actions/generate-report/action.yml b/.github/actions/generate-report/action.yml
new file mode 100644
index 00000000..b3787523
--- /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.yml b/.github/workflows/workflow.yml
new file mode 100644
index 00000000..d3d2bebe
--- /dev/null
+++ b/.github/workflows/workflow.yml
@@ -0,0 +1,96 @@
+name: DOTNET BUILDS
+on:
+ push:
+ pull_request:
+ workflow_dispatch:
+env:
+ CLIENT_FOLDER: 'cybersource-rest-client-dotnet'
+ SAMPLE_FOLDER: 'cybersource-rest-samples-csharp'
+jobs:
+ build-the-dotnet-client:
+ defaults:
+ run:
+ shell: bash
+ runs-on: windows-2019
+ steps:
+ - name: Checkout cybersource-rest-client-dotnet repo
+ uses: actions/checkout@v4
+ with:
+ path: ${{env.CLIENT_FOLDER}}
+ - name: Setup MSBuild
+ uses: microsoft/setup-msbuild@v2
+ - name: Building the Dotnet Client
+ run: |
+ cd $Env:CLIENT_FOLDER
+ nuget install packages.config -OutputDirectory packages
+ nuget install ./test/packages.config -OutputDirectory packages
+ msbuild -version
+ msbuild -property:Configuration=Release "cybersource-rest-client-dotnet.sln"
+ Write-Output "Build Successful"
+ shell: pwsh
+ - name: Upload the Dotnet Rest Client Build
+ uses: actions/upload-artifact@v4
+ with:
+ name: cybersource-rest-client-dotnet-dll-and-action
+ path: |
+ ${{env.CLIENT_FOLDER}}/bin/Release/cybersource-rest-client-dotnet.dll
+ ${{env.CLIENT_FOLDER}}/.github/actions/generate-report
+ build-the-samples-and-run-tests:
+ defaults:
+ run:
+ shell: bash
+ strategy:
+ fail-fast: false
+ matrix:
+ operating-system: [windows-latest,windows-2019]
+ net-framework-version: [4.6.1,4.6.2,4.7,4.7.1,4.7.2,4.8,4.8.1]
+ exclude:
+ - operating-system: windows-2019
+ net-framework-version: 4.8.1
+ - operating-system: windows-latest
+ net-framework-version: 4.6.1
+ needs: build-the-dotnet-client # to make sure these jobs only start once the already present jobs are done running
+ runs-on: ${{matrix.operating-system}}
+ steps:
+ - name: Download the Built Rest Client for Dotnet from previous Job
+ uses: actions/download-artifact@v4
+ with:
+ name: cybersource-rest-client-dotnet-dll-and-action
+ path: dlls-and-action
+ - name: Checkout cybersource-rest-samples-csharp repo
+ uses: actions/checkout@v4
+ with:
+ repository: 'CyberSource/cybersource-rest-samples-csharp'
+ ref: 'master'
+ path: ${{env.SAMPLE_FOLDER}}
+ - name: Setup MSBuild
+ uses: microsoft/setup-msbuild@v2
+ - name: Building the samples and Running the Tests
+ run: |
+ msbuild -version
+ cd $Env:SAMPLE_FOLDER
+ (Get-Content ./cybersource-rest-samples-csharp.csproj) | ForEach-Object { $_ -replace "()(.)+(cybersource-rest-client-dotnet.dll)", "..\\dlls-and-action\\bin\\Release\\cybersource-rest-client-dotnet.dll" } | Set-Content ./cybersource-rest-samples-csharp.csproj
+ #Replaced the Dependency path to already built cybersource-rest-client-dotnet dll file which was downloaded to the runner
+ (Get-Content ./cybersource-rest-samples-csharp.csproj) | ForEach-Object { $_ -replace "()(.)+()", "v${{matrix.net-framework-version}}" } | Set-Content ./cybersource-rest-samples-csharp.csproj
+ nuget install packages.config -OutputDirectory packages
+ msbuild -property:Configuration=Release "cybersource-rest-samples-csharp.sln"
+ cd bin/Release/net461
+ Write-Output "Running Samples now"
+ ./SampleCode.exe -RunAll > testing_dotnet.log
+ Copy-Item ".\testing_dotnet.log" -Destination "..\..\..\"
+ Set-Location ..\..\..
+ Move-Item -Path .\testing_dotnet.log -Destination .\output.log
+ shell: pwsh
+ - name: Using Report Generation Action
+ id: report-generation
+ uses: ./dlls-and-action/.github/actions/generate-report
+ with:
+ lang: dotnet
+ sample-folder-name: ${{env.SAMPLE_FOLDER}}
+ log-file-name: output.log
+ - name: Upload Test Reports
+ uses: actions/upload-artifact@v4
+ with:
+ name: sample-run-report-${{matrix.operating-system}}-dotnet-framework-ver-${{matrix.net-framework-version}}
+ path: |
+ ${{env.SAMPLE_FOLDER}}/${{steps.report-generation.outputs.result-pdf-name}}
diff --git a/.gitignore b/.gitignore
index 43c670ad..5681e5da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -191,3 +191,5 @@ build.bat
git_push.sh
mono_nunit_test.sh
.vs/
+
+.DS_Store
diff --git a/README.md b/README.md
index 8ac7633a..ce5e2d4d 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
# .NET Client SDK for the CyberSource REST API
+[](https://github.com/CyberSource/cybersource-rest-client-dotnet/actions/workflows/workflow.yml)
+
## Description
The CyberSource .NET client provides convenient access to the [CyberSource REST API](https://developer.cybersource.com/api/reference/api-reference.html) from your .NET application.