Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding workflows #161

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8c0ac48
Update .gitignore
aasgoel Jun 11, 2024
c43d799
Added the Github Workflow
aasgoel Jun 11, 2024
fbf9f97
Update java-workflow.yml
aasgoel Jun 11, 2024
39bf205
Update java-workflow.yml
aasgoel Jun 12, 2024
fbc68ba
Made the change from version java compiler 1.7 to 1.8
aasgoel Jun 12, 2024
b73063d
Update java-workflow.yml
aasgoel Jun 12, 2024
f31d16a
Update java-workflow.yml
aasgoel Jun 12, 2024
084b516
adding action and running the workflow
aasgoel Jul 5, 2024
a6b5007
Update java-workflow.yml
aasgoel Jul 5, 2024
f12c95b
Update java-workflow.yml
aasgoel Jul 5, 2024
1d89100
Update java-workflow.yml
aasgoel Jul 5, 2024
a0d0b28
Update java-workflow.yml
aasgoel Jul 5, 2024
bed86d0
Merge branch 'master' into adding-workflows
aasgoel Jul 5, 2024
35f90cf
changed the client version in samples
aasgoel Jul 8, 2024
4bafde2
Update java-workflow.yml
aasgoel Jul 8, 2024
2ff3a7f
Update java-workflow.yml
aasgoel Jul 8, 2024
ce8bd7b
Update java-workflow.yml
aasgoel Jul 8, 2024
7df2f3d
Update java-workflow.yml
aasgoel Jul 8, 2024
411cc3a
Update java-workflow.yml
aasgoel Jul 8, 2024
9bc7e48
Update java-workflow.yml
aasgoel Jul 8, 2024
cebd382
Update java-workflow.yml
aasgoel Jul 8, 2024
a59f800
Update java-workflow.yml
aasgoel Jul 8, 2024
eb332c5
Update java-workflow.yml
aasgoel Jul 8, 2024
29a9d34
Update java-workflow.yml
aasgoel Jul 8, 2024
3c54015
Update java-workflow.yml
aasgoel Jul 8, 2024
c0a0ad0
Update java-workflow.yml
aasgoel Jul 8, 2024
c5f3cdc
Update java-workflow.yml
aasgoel Jul 8, 2024
9571bd2
Update java-workflow.yml
aasgoel Jul 8, 2024
a0981e9
Actual run to test whether workflow works or not
aasgoel Jul 8, 2024
9e5ec6b
adding distribution
aasgoel Jul 8, 2024
65ad927
Update java-workflow.yml
aasgoel Jul 8, 2024
d5db0be
Adding the Status Badge [no ci]
aasgoel Jul 8, 2024
0a4cd31
Made suggested changes and running the workflow
aasgoel Jul 8, 2024
eb70afc
Naming Change [no ci]
aasgoel Jul 8, 2024
9db9ec5
[no ci]
aasgoel Jul 9, 2024
4186dae
Added workflow_dispatch and pull_request event triggers
aasgoel Jul 10, 2024
1a1012a
Code Refactoring
aasgoel Jul 12, 2024
e72e10e
Update java-workflow.yml
aasgoel Jul 16, 2024
04bd290
Adding a comment to create a push event trigger
aasgoel Jul 18, 2024
b2e5c13
Adding comment to create a push event trigger
aasgoel Jul 18, 2024
52f3455
Update java-workflow.yml
aasgoel Jul 18, 2024
11e8862
Update java-workflow.yml
aasgoel Jul 18, 2024
7a7fa23
Update java-workflow.yml
aasgoel Jul 18, 2024
0a34d19
Update java-workflow.yml
aasgoel Jul 25, 2024
4c06e45
comment to trigger workflow
aasgoel Jul 25, 2024
2c3798e
Update java-workflow.yml
aasgoel Jul 25, 2024
add5d9b
Update java-workflow.yml
aasgoel Jul 25, 2024
bff57ec
Update java-workflow.yml
aasgoel Jul 25, 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

83 changes: 83 additions & 0 deletions .github/workflows/java-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: JAVA BUILDS
on:
push:
pull_request:
workflow_dispatch:
env:
CLIENT_FOLDER: 'cybersource-rest-client-java'
SAMPLE_FOLDER: 'cybersource-rest-samples-java'
jobs:
complete-job:
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest,macos-latest,windows-latest]
java-version: ['8','11','16','17','18','19','20','21','22']
distribution: ['temurin']
runs-on: ${{matrix.operating-system}}
steps:
- name: Making separate folders
run: |
rm -rf $CLIENT_FOLDER
rm -rf $SAMPLE_FOLDER
mkdir $CLIENT_FOLDER $SAMPLE_FOLDER
- name: Checkout the cybersource-rest-client-java repo
uses: actions/checkout@v4
with:
path: ${{env.CLIENT_FOLDER}}
- name: Checkout the cybersource-rest-samples-java repo
uses: actions/checkout@v4
with:
repository: 'CyberSource/cybersource-rest-samples-java'
ref: 'master'
path: ${{env.SAMPLE_FOLDER}}
- name: Setup Java 8 to Build the Client
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '8'
- name: Build the Java Client
run: |
mvn -version
java -version
cd $CLIENT_FOLDER
mvn clean install
- name: Setup Java version to Build the samples
uses: actions/setup-java@v2
with:
distribution: ${{matrix.distribution}}
java-version: ${{matrix.java-version}}
- name: Replace the Version of cybersource-rest-client-java in samples' pom file
run: |
cd $CLIENT_FOLDER
RESTCLIENT_SDK_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo $RESTCLIENT_SDK_VERSION
cd ../$SAMPLE_FOLDER
perl -i -spe "BEGIN{undef $/;} s|<groupId>com\.cybersource<\/groupId>\s*<artifactId>cybersource-rest-client-java<\/artifactId>\s*<version>.*?<\/version>|<groupId>com.cybersource</groupId>\n <artifactId>cybersource-rest-client-java</artifactId>\n <version>\${version}</version>|g" -- -version=$RESTCLIENT_SDK_VERSION pom.xml
cat pom.xml
- name: Build the Sample Project and Run the Samples
run: |
mvn -version
java -version
cd $SAMPLE_FOLDER
mvn -X -e clean install
echo "Running Samples"
java -jar target/SampleCode.jar > output.log
- name: Using Report Generation Action
id: report-generation
uses: ./cybersource-rest-client-java/.github/actions/generate-report
with:
lang: java
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}}-${{matrix.distribution}}-java-ver-${{matrix.java-version}}
path: |
${{env.SAMPLE_FOLDER}}/${{steps.report-generation.outputs.result-pdf-name}}

#Adding Comment
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ hs_err_pid*
target
.gradle
build

#Adding DS Store files to ignore
.DS_Store
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# Java Client SDK for the CyberSource REST API

[![JAVA BUILDS](https://github.com/CyberSource/cybersource-rest-client-java/actions/workflows/java-workflow.yml/badge.svg)](https://github.com/CyberSource/cybersource-rest-client-java/actions/workflows/java-workflow.yml)

## Description

The CyberSource Java client provides convenient access to the [CyberSource REST API](https://developer.cybersource.com/api/reference/api-reference.html) from your Java application.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
</dependencies>

<properties>
<java.version>1.7</java.version>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<gson-fire-version>1.9.0</gson-fire-version>
Expand Down
Loading