Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e9cfad7
Update .gitignore
aasgoel Jun 20, 2024
987dfbc
Revert "Update .gitignore"
aasgoel Jun 26, 2024
4fef521
Reapply "Update .gitignore"
aasgoel Jun 26, 2024
7912ca5
Adding workflow to check whether samples build or not
aasgoel Jun 27, 2024
73c6a0c
Update workflow.yml
aasgoel Jun 27, 2024
c08d57c
Update workflow.yml
aasgoel Jun 27, 2024
4ecedba
Update workflow.yml
aasgoel Jun 27, 2024
a938114
Update workflow.yml
aasgoel Jun 27, 2024
3490e30
Update workflow.yml
aasgoel Jun 27, 2024
d816d8a
added .sh file for making file changes
aasgoel Jun 27, 2024
294cdfa
pushing local linker
aasgoel Jun 27, 2024
df64d9f
Update workflow.yml
aasgoel Jun 27, 2024
b35fb4d
Update workflow.yml
aasgoel Jun 27, 2024
7766a5f
Update workflow.yml
aasgoel Jun 27, 2024
814c46a
Update workflow.yml
aasgoel Jun 27, 2024
08acecb
Update workflow.yml
aasgoel Jun 27, 2024
a21c405
Update workflow.yml
aasgoel Jun 27, 2024
d3059e7
Update workflow.yml
aasgoel Jun 27, 2024
eeea7a0
Update workflow.yml
aasgoel Jun 27, 2024
1514a2c
Update workflow.yml
aasgoel Jun 27, 2024
ff2bacd
Update workflow.yml
aasgoel Jun 28, 2024
59f3315
Update workflow.yml
aasgoel Jun 28, 2024
a006af5
Update workflow.yml
aasgoel Jun 28, 2024
a014dc8
Update workflow.yml
aasgoel Jun 28, 2024
77c85d4
Update workflow.yml
aasgoel Jun 28, 2024
e59abba
Update workflow.yml
aasgoel Jun 28, 2024
d3f1b42
Update workflow.yml
aasgoel Jun 28, 2024
4cc6551
Update workflow.yml
aasgoel Jun 28, 2024
327b052
Update workflow.yml
aasgoel Jun 30, 2024
4b873b7
Update workflow.yml
aasgoel Jun 30, 2024
3bc72dd
Update workflow.yml
aasgoel Jun 30, 2024
7e9a8ad
Update workflow.yml
aasgoel Jun 30, 2024
67c1078
Update workflow.yml
aasgoel Jun 30, 2024
efd2dff
Update workflow.yml
aasgoel Jun 30, 2024
ffee1ec
Update workflow.yml
aasgoel Jul 1, 2024
85c08be
Update workflow.yml
aasgoel Jul 1, 2024
90f34ad
Update workflow.yml
aasgoel Jul 1, 2024
4eeb56c
Update workflow.yml
aasgoel Jul 1, 2024
888d03f
Update workflow.yml
aasgoel Jul 1, 2024
66c654a
Update workflow.yml
aasgoel Jul 1, 2024
1d2f2c7
Update workflow.yml
aasgoel Jul 1, 2024
4bb2728
Update workflow.yml
aasgoel Jul 1, 2024
a8f5b89
Update workflow.yml
aasgoel Jul 1, 2024
e1adf65
Update workflow.yml
aasgoel Jul 1, 2024
c93ce5c
Update workflow.yml
aasgoel Jul 1, 2024
b065d38
Update workflow.yml
aasgoel Jul 1, 2024
d207137
Modified A comment [no ci]
aasgoel Jul 1, 2024
a0ee115
Adding Staus Badge [no ci]
aasgoel Jul 1, 2024
9a24bf7
running with report-generation action
aasgoel Jul 3, 2024
a480440
Update workflow.yml
aasgoel Jul 5, 2024
904add3
Update workflow.yml
aasgoel Jul 5, 2024
177d3dd
Merge branch 'master' into adding-workflows
aasgoel Jul 8, 2024
6648d52
[no ci]
aasgoel Jul 8, 2024
a2487f5
Removed local_linker.sh
aasgoel Jul 9, 2024
8c1a1d0
updates samples ref to master
aasgoel Jul 16, 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

94 changes: 94 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: DOTNET-STANDARD BUILDS
on:
push:
pull_request:
workflow_dispatch:
env:
CLIENT_FOLDER: 'cybersource-rest-client-dotnetstandard'
SAMPLE_FOLDER: 'cybersource-rest-samples-csharp'
jobs:
workflow-job:
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
operating-system: [windows-latest,windows-2019,ubuntu-latest,ubuntu-20.04,macos-latest,macos-13]
dotnet-ver: ['3.1.x','5.0','6.0','7.0','8.0']
exclude:
- operating-system: macos-latest #macos 14 arm64 image is being used and it doesn't support .NET Core 3.1
dotnet-ver: '3.1.x'
- operating-system: macos-latest #macos 14 arm64 image is being used and it doesn't support .NET 5.0
dotnet-ver: '5.0'
runs-on: ${{matrix.operating-system}}
env:
NET_VER: ${{matrix.dotnet-ver}}
steps:
- name: Setup Git Config for windows to allow path lengths greater than 260 characters
if: runner.os == 'Windows'
run: |
git config --global core.longpaths true
- name: Checkout the cybersource-rest-client-dotnetstandard repo
uses: actions/checkout@v4
with:
path: ${{env.CLIENT_FOLDER}}
- 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 DotNet
id: setdotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{matrix.dotnet-ver}}
- name: Changing the csproj files to reference the locally built Authorization and Client dll file
run: |
if [[ (${{matrix.dotnet-ver}} == '3.1.x' && "$(uname -s)" == "Darwin") ||
(${{matrix.dotnet-ver}} == '5.0' && "$(uname -s)" == "Darwin") ]]; then
echo "Microsoft .NET SDK version ${{matrix.dotnet-ver}} has issues for Mac OS, latest Microsoft .NET SDK will be used for building the projects."
else
dotnet new globaljson --sdk-version ${{steps.setdotnet.outputs.dotnet-version}}
cat global.json
fi
sed -i -e 's|<PackageReference Include="CyberSource\.Authentication\.NetStandard" Version=".*" \/>|<Reference Include="CyberSource.Authentication.NetStandard">\n <HintPath>../../cybersource-rest-auth-netstandard/AuthenticationSdk/AuthenticationSdk/bin/Release/netstandard2.1/Cybersource.Authentication.NetStandard.dll</HintPath>\n <Private>true</Private>\n</Reference>|g' cybersource-rest-client-dotnetstandard/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard.csproj
sed -i -e 's|<PackageReference Include="CyberSource\.Authentication\.NetStandard" Version=".*" />|<Reference Include="CyberSource.Authentication.NetStandard">\n <HintPath>../cybersource-rest-client-dotnetstandard/cybersource-rest-auth-netstandard/AuthenticationSdk/AuthenticationSdk/bin/Release/netstandard2.1/Cybersource.Authentication.NetStandard.dll</HintPath>\n <Private>true</Private>\n</Reference>|g' cybersource-rest-samples-csharp/cybersource-rest-samples-netcore.csproj
sed -i -e 's|<PackageReference Include="CyberSource\.Rest\.Client\.NetStandard" Version=".*" />|<Reference Include="CyberSource.Rest.Client.NetStandard">\n <HintPath>../cybersource-rest-client-dotnetstandard/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/bin/Release/netstandard2.1/cybersource-rest-client-netstandard.dll</HintPath>\n <Private>true</Private>\n</Reference>|g' cybersource-rest-samples-csharp/cybersource-rest-samples-netcore.csproj
cat cybersource-rest-client-dotnetstandard/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard.csproj
- name: Build the Authentication and Client projects
run: |
dotnet --version
dotnet build $CLIENT_FOLDER/cybersource-rest-auth-netstandard/AuthenticationSdk/AuthenticationSdk/AuthenticationSdk.csproj -c release
dotnet build $CLIENT_FOLDER/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard.csproj -c release
- name: Build the Samples project and Run Tests
env:
TARGET_FR: netcoreapp3.1
run: |
if [ $NET_VER != '3.1.x' ]; then
export TARGET_FR=net${NET_VER}
sed -i -e "s|<TargetFramework>.*</TargetFramework>|<TargetFramework>${TARGET_FR}</TargetFramework>|g" cybersource-rest-samples-csharp/cybersource-rest-samples-netcore.csproj
fi
cat cybersource-rest-samples-csharp/cybersource-rest-samples-netcore.csproj
#changing the target framework for samples application
dotnet --version
echo "Target Framework : ${TARGET_FR}"
dotnet build $SAMPLE_FOLDER/cybersource-rest-samples-netcore.csproj -c release
cd $SAMPLE_FOLDER/bin/Release/$TARGET_FR
echo "Running Samples"
./SampleCodeNetCore -RunAll > output.log
cp output.log ../../../
- name: Using Report Generation Action
id: report-generation
uses: ./cybersource-rest-client-dotnetstandard/.github/actions/generate-report
with:
lang: dotnetstandard
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-core-ver-${{matrix.dotnet-ver}}
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 @@ -355,3 +355,5 @@ MigrationBackup/
/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/build.sh
/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/git_push.sh
/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/mono_nunit_test.sh

.DS_Store
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# .NET Standard Client SDK for the CyberSource REST API
[![DOTNET-STANDARD BUILDS](https://github.com/CyberSource/cybersource-rest-client-dotnetstandard/actions/workflows/workflow.yml/badge.svg)](https://github.com/CyberSource/cybersource-rest-client-dotnetstandard/actions/workflows/workflow.yml)

The CyberSource .NET Standard client provides convenient access to the [CyberSource REST API](https://developer.cybersource.com/api/reference/api-reference.html) from your .NET application.

Expand Down