Skip to content

Commit e589c61

Browse files
committed
Adding workflow to test SDK
1 parent c76c9a1 commit e589c61

File tree

7 files changed

+548
-512
lines changed

7 files changed

+548
-512
lines changed

.classpath

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Authorize.net Java CI
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
env:
7+
sdk_java: 'sdk-java'
8+
sample_code_java: 'sample-code-java'
9+
jobs:
10+
workflow-job:
11+
defaults:
12+
run:
13+
shell: bash
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
operating-system: [ubuntu-latest, macos-latest, windows-latest]
18+
java-version: ['8', '11', '16', '17', '18', '19', '20', '21', '22']
19+
distribution: ['temurin']
20+
runs-on: ${{matrix.operating-system}}
21+
steps:
22+
- name: Creating separate folders for SDK and Sample Codes
23+
run: |
24+
rm -rf $sdk_java
25+
rm -rf $sample_code_java
26+
mkdir $sdk_java $sample_code_java
27+
- name: Checkout authorizenet/sdk-java
28+
uses: actions/checkout@v4
29+
with:
30+
path: ${{env.sdk_java}}
31+
- name: Checkout authorizenet/sample-code-java
32+
uses: actions/checkout@v4
33+
with:
34+
repository: 'authorizenet/sample-code-java'
35+
ref: 'master'
36+
path: ${{env.sample_code_java}}
37+
- name: Setup Java 1.8 to build the SDK
38+
uses: actions/setup-java@v2
39+
with:
40+
distribution: 'temurin'
41+
java-version: '8'
42+
- name: Build the Java SDK
43+
run: |
44+
mvn -version
45+
java -version
46+
cd $sdk_java
47+
mvn clean install
48+
- name: Replace the version of SDK in samples' pom file
49+
run: |
50+
cd $sdk_java
51+
SDK_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
52+
echo $SDK_VERSION
53+
cd ../$sample_code_java
54+
perl -i -spe "BEGIN{undef $/;} s|<groupId>net\.authorize<\/groupId>\s*<artifactId>anet-java-sdk<\/artifactId>\s*<version>.*?<\/version>|<groupId>net.authorize</groupId>\n <artifactId>anet-java-sdk</artifactId>\n <version>\${version}</version>|g" -- -version=$SDK_VERSION pom.xml
55+
cat pom.xml
56+
- name: Setup Java version to Build the samples
57+
uses: actions/setup-java@v2
58+
with:
59+
distribution: ${{matrix.distribution}}
60+
java-version: ${{matrix.java-version}}
61+
- name: Build the Sample Project and Run the Samples
62+
run: |
63+
mvn -version
64+
java -version
65+
cd $sdk_java
66+
SDK_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
67+
echo $SDK_VERSION
68+
cd $sample_code_java
69+
mvn install -DsdkVersion=$SDK_VERSION -DskipTests=true -Dmaven.javadoc.skip=true -B -V
70+
echo "Running Samples"
71+
mvn test -DsdkVersion=$SDK_VERSION -B
72+
./print_surefire_reports.sh

.project

Lines changed: 0 additions & 23 deletions
This file was deleted.

pom.xml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,31 @@
4242
<dependency>
4343
<groupId>commons-logging</groupId>
4444
<artifactId>commons-logging</artifactId>
45-
<version>1.1.1</version>
45+
<version>1.3.3</version>
4646
<scope>compile</scope>
4747
</dependency>
48-
<dependency>
48+
<!-- <dependency>
4949
<groupId>org.apache.httpcomponents</groupId>
5050
<artifactId>httpclient</artifactId>
5151
<version>4.5.13</version>
5252
<scope>compile</scope>
53-
</dependency>
54-
<dependency>
53+
</dependency> -->
54+
<!-- <dependency>
5555
<groupId>org.apache.httpcomponents</groupId>
5656
<artifactId>httpcore</artifactId>
5757
<version>4.4.14</version>
5858
<scope>compile</scope>
59+
</dependency> -->
60+
<dependency>
61+
<groupId>org.apache.httpcomponents.client5</groupId>
62+
<artifactId>httpclient5</artifactId>
63+
<version>5.3.1</version>
64+
<scope>compile</scope>
65+
</dependency>
66+
<dependency>
67+
<groupId>org.apache.httpcomponents.core5</groupId>
68+
<artifactId>httpcore5</artifactId>
69+
<version>5.2.5</version>
5970
</dependency>
6071
<!-- Log4j Dependencies -->
6172
<dependency>
@@ -124,32 +135,33 @@
124135
<plugin>
125136
<groupId>org.apache.maven.plugins</groupId>
126137
<artifactId>maven-compiler-plugin</artifactId>
127-
<version>2.0.2</version>
138+
<version>3.13.0</version>
128139
<configuration>
129-
<source>1.5</source>
130-
<target>1.5</target>
140+
<source>1.8</source>
141+
<target>1.8</target>
131142
</configuration>
132143
</plugin>
133144
<plugin>
134145
<groupId>org.codehaus.mojo</groupId>
135146
<artifactId>properties-maven-plugin</artifactId>
136-
<version>1.0-alpha-2</version>
147+
<version>1.2.1</version>
137148
<!-- <executions> <execution> <phase>initialize</phase> <goals> <goal>read-project-properties</goal>
138149
</goals> <configuration> <files> <file>${user.home}/anet-java-sdk.properties</file>
139150
</files> </configuration> </execution> </executions> -->
140151
</plugin>
141152
<plugin>
142153
<groupId>org.apache.maven.plugins</groupId>
143154
<artifactId>maven-surefire-plugin</artifactId>
144-
<version>2.9</version>
155+
<version>2.12</version>
145156
<configuration>
146157
<includes>
147158
<include> **/mocktest/**.java</include>
148159
</includes>
149160
<skipTests>false</skipTests>
150-
<forkCount>1</forkCount>
151161
<systemPropertyVariables>
162+
<!--suppress UnresolvedMavenProperty -->
152163
<API_LOGIN_ID>${api.login.id}</API_LOGIN_ID>
164+
<!--suppress UnresolvedMavenProperty -->
153165
<TRANSACTION_KEY>${transaction.key}</TRANSACTION_KEY>
154166
</systemPropertyVariables>
155167
<environmentVariables>

0 commit comments

Comments
 (0)