Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
aca99a4
Adding .DS_Store to gitignore
aasgoel Jun 24, 2024
7027088
github workflow run
aasgoel Jun 24, 2024
c6f60fa
Update workflow.yml
aasgoel Jun 24, 2024
131bc5d
Update workflow.yml
aasgoel Jun 24, 2024
bc197df
Update workflow.yml
aasgoel Jun 24, 2024
8a490a4
Update workflow.yml
aasgoel Jun 24, 2024
57f56ef
Update workflow.yml
aasgoel Jun 24, 2024
455a0b0
Update workflow.yml
aasgoel Jun 24, 2024
13ba95e
building with MS build
aasgoel Jun 24, 2024
28c80fe
Update workflow.yml
aasgoel Jun 24, 2024
e3c9a37
Update workflow.yml
aasgoel Jun 24, 2024
9f9cec9
Update workflow.yml
aasgoel Jun 24, 2024
e39edd9
Update workflow.yml
aasgoel Jun 24, 2024
211f749
Update workflow.yml
aasgoel Jun 24, 2024
05a476b
Update workflow.yml
aasgoel Jun 24, 2024
7b908d9
Update workflow.yml
aasgoel Jun 24, 2024
d831a21
Update workflow.yml
aasgoel Jun 24, 2024
4ce8d93
Update workflow.yml
aasgoel Jun 25, 2024
d39e085
Update workflow.yml
aasgoel Jun 26, 2024
e6ffa78
Update workflow.yml
aasgoel Jun 26, 2024
f524277
Update workflow.yml
aasgoel Jun 26, 2024
9d785ce
Checking for different combinations of environments
aasgoel Jun 26, 2024
801f1c1
Update workflow.yml
aasgoel Jun 26, 2024
d1a4cd9
Update workflow.yml
aasgoel Jun 26, 2024
52b4f85
Update workflow.yml
aasgoel Jun 26, 2024
0cb972f
Update workflow.yml
aasgoel Jun 26, 2024
ede3dee
Update workflow.yml
aasgoel Jun 28, 2024
3f2c18d
Update workflow.yml
aasgoel Jul 1, 2024
1d4d1f9
Making changes to the strategy matrix [no ci]
aasgoel Jul 1, 2024
7f79193
Adding Status Badge [no ci]
aasgoel Jul 1, 2024
3d9a3dd
checking with report-generation action
aasgoel Jul 3, 2024
8588f05
Merge branch 'master' into adding-workflows
aasgoel Jul 8, 2024
e085f1c
[no ci]
aasgoel Jul 8, 2024
c0cb255
[no ci]
aasgoel Jul 9, 2024
a97f7f9
updated samples ref to master
aasgoel Jul 16, 2024
66e5ae0
disable the workflow
gaubansa Aug 16, 2024
1a00e23
Uploading built DLL only
monu-kumar-visa Aug 28, 2024
0ffc793
Removing comment
monu-kumar-visa Aug 28, 2024
dabeaa8
correcting path and branch
monu-kumar-visa Aug 28, 2024
004d64f
correcting paths
monu-kumar-visa Aug 28, 2024
fedfa2b
changed sample branch
monu-kumar-visa Aug 28, 2024
16abf8f
Merge branch 'master' into adding-workflows
monu-kumar-visa Aug 28, 2024
2cf1e56
checking different version
monu-kumar-visa Aug 29, 2024
de7dddd
Revert "checking different version"
monu-kumar-visa Aug 29, 2024
5f91731
Merge remote-tracking branch 'origin/master' into adding-workflows
monu-kumar-visa Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/actions/generate-report/action.yml
Original file line number Diff line number Diff line change
@@ -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

96 changes: 96 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -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 "(<HintPath>)(.)+(cybersource-rest-client-dotnet.dll</HintPath>)", "<HintPath>..\\dlls-and-action\\bin\\Release\\cybersource-rest-client-dotnet.dll</HintPath>" } | 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 "(<TargetFrameworkVersion>)(.)+(</TargetFrameworkVersion>)", "<TargetFrameworkVersion>v${{matrix.net-framework-version}}</TargetFrameworkVersion>" } | 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}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,5 @@ build.bat
git_push.sh
mono_nunit_test.sh
.vs/

.DS_Store
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# .NET Client SDK for the CyberSource REST API

[![DOTNET BUILDS](https://github.com/CyberSource/cybersource-rest-client-dotnet/actions/workflows/workflow.yml/badge.svg)](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.
Expand Down