Skip to content

Commit f2966f8

Browse files
authored
ci: Gha 9907 (#1196)
* ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix * ci: fix
1 parent 59ee618 commit f2966f8

File tree

19 files changed

+228
-112
lines changed

19 files changed

+228
-112
lines changed
+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support documentation.
4+
# This workflow will download a prebuilt Java version, install dependencies and run integration tests
5+
6+
name: Run Integration Tests
7+
8+
on:
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
jobs:
14+
integration_test:
15+
name: Build and Run Integration Tests on Java ${{ matrix.java-version }} and ${{ matrix.os }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
java-version: ['8']
20+
os: [ubuntu-latest]
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Set up Java
26+
uses: actions/setup-java@v2
27+
with:
28+
java-version: ${{ matrix.java-version }}
29+
distribution: 'adopt'
30+
31+
- name: Execute Java integration tests
32+
# continue-on-error: true
33+
env:
34+
MVN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
35+
NATURAL_LANGUAGE_CLASSIFIER_URL: "https://api.us-south.natural-language-classifier.watson.cloud.ibm.com"
36+
NATURAL_LANGUAGE_CLASSIFIER_APIKEY: ${{ secrets.NLC_APIKEY }}
37+
NATURAL_LANGUAGE_CLASSIFIER_ID: ${{ secrets.NLC_CLASSIFIER_ID }}
38+
LANGUAGE_TRANSLATOR_APIKEY: ${{ secrets.LT_APIKEY }}
39+
LANGUAGE_TRANSLATOR_URL: "https://api.us-south.language-translator.watson.cloud.ibm.com"
40+
NATURAL_LANGUAGE_UNDERSTANDING_APIKEY: ${{ secrets.NLU_APIKEY }}
41+
NATURAL_LANGUAGE_UNDERSTANDING_URL: "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com"
42+
PERSONALITY_INSIGHTS_APIKEY: ${{ secrets.PI_APIKEY }}
43+
PERSONALITY_INSIGHTS_URL: "https://api.us-south.personality-insights.watson.cloud.ibm.com"
44+
TONE_ANALYZER_APIKEY: ${{ secrets.TA_APIKEY }}
45+
TONE_ANALYZER_URL: "https://api.us-south.tone-analyzer.watson.cloud.ibm.com"
46+
SPEECH_TO_TEXT_APIKEY: ${{ secrets.STT_APIKEY }}
47+
SPEECH_TO_TEXT_URL: "https://api.us-south.speech-to-text.watson.cloud.ibm.com"
48+
SPEECH_TO_TEXT_CUSTOM_ID: ${{ secrets.STT_APIKEY_CUSTOM_ID }}
49+
SPEECH_TO_TEXT_ACOUSTIC_CUSTOM_ID: ${{ secrets.STT_APIKEY_ACOUSTIC_CUSTOM_ID }}
50+
TEXT_TO_SPEECH_APIKEY: ${{ secrets.TTS_APIKEY }}
51+
TEXT_TO_SPEECH_URL: "https://api.us-south.text-to-speech.watson.cloud.ibm.com"
52+
VISUAL_RECOGNITION_APIKEY: ${{ secrets.VR_APIKEY }}
53+
VISUAL_RECOGNITION_COLLECTION_ID: ${{ secrets.VR_COLLECTION_ID }}
54+
VISUAL_RECOGNITION_URL: "https://api.us-south.visual-recognition.watson.cloud.ibm.com"
55+
COMPARE_COMPLY_APIKEY: ${{ secrets.CC_APIKEY }}
56+
COMPARE_COMPLY_FEEDBACK_ID: ${{ secrets.CC_FEEDBACK_ID }}
57+
COMPARE_COMPLY_URL: "https://api.us-south.compare-comply.watson.cloud.ibm.com"
58+
ASSISTANT_APIKEY: ${{ secrets.WA_APIKEY }}
59+
ASSISTANT_WORKSPACE_ID: ${{ secrets.WA_WORKSPACE_ID }}
60+
ASSISTANT_ASSISTANT_ID: ${{ secrets.WA_ASSISTANT_ID }}
61+
ASSISTANT_URL: "https://api.us-south.assistant.watson.cloud.ibm.com"
62+
DISCOVERY_APIKEY: ${{ secrets.D1_APIKEY }}
63+
DISCOVERY_ENVIRONMENT_ID: ${{ secrets.D1_ENVIRONMENT_ID }}
64+
DISCOVERY_COLLECTION_ID: ${{ secrets.D1_COLLECTION_ID }}
65+
DISCOVERY_URL: "https://api.us-south.discovery.watson.cloud.ibm.com"
66+
DISCOVERY_V2_APIKEY: ${{ secrets.D2_APIKEY }}
67+
DISCOVERY_V2_PROJECT_ID: ${{ secrets.D2_PROJECT_ID }}
68+
DISCOVERY_V2_COLLECTION_ID: ${{ secrets.D2_COLLECTION_ID }}
69+
DISCOVERY_V2_URL: "https://api.us-south.discovery.watson.cloud.ibm.com"
70+
run: |
71+
mvn test -Dtest=v1/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS
72+
mvn test -Dtest=v2/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS
73+
mvn test -Dtest=CompareComplyServiceIT -DfailIfNoTests=false -pl compare-comply,common $MVN_ARGS
74+
mvn test -Dtest=v1/DiscoveryServiceIT -DfailIfNoTests=false -pl discovery,common $MVN_ARGS
75+
mvn test -Dtest=v2/DiscoveryIT -DfailIfNoTests=false -pl discovery,common $MVN_ARGS
76+
mvn test -Dtest=LanguageTranslatorIT -DfailIfNoTests=false -pl language-translator,common $MVN_ARGS
77+
mvn test -Dtest=NaturalLanguageClassifierIT -DfailIfNoTests=false -pl natural-language-classifier,common $MVN_ARGS
78+
mvn test -Dtest=NaturalLanguageUnderstandingIT -DfailIfNoTests=false -pl natural-language-understanding,common $MVN_ARGS
79+
mvn test -Dtest=PersonalityInsightsIT -DfailIfNoTests=false -pl personality-insights,common $MVN_ARGS
80+
mvn test -Dtest=SpeechToTextIT -DfailIfNoTests=false -pl speech-to-text,common $MVN_ARGS
81+
mvn test -Dtest=TextToSpeechIT -DfailIfNoTests=false -pl text-to-speech,common $MVN_ARGS
82+
mvn test -Dtest=CustomizationsIT -DfailIfNoTests=false -pl text-to-speech,common $MVN_ARGS
83+
mvn test -Dtest=ToneAnalyzerIT -DfailIfNoTests=false -pl tone-analyzer,common $MVN_ARGS
84+
mvn test -Dtest=v3/VisualRecognitionIT -DfailIfNoTests=false -pl visual-recognition,common $MVN_ARGS
85+
mvn test -Dtest=v4/VisualRecognitionIT -DfailIfNoTests=false -pl visual-recognition,common $MVN_ARGS
86+
87+
# Do not notify on success. We will leave the code here just in case we decide to switch gears
88+
- name: Notify slack on success
89+
if: false # success()
90+
env:
91+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
92+
uses: voxmedia/github-action-slack-notify-build@v1
93+
with:
94+
channel: watson-e2e-tests
95+
status: SUCCESS
96+
color: good
97+
98+
- name: Notify slack on failure
99+
if: false # failure()
100+
env:
101+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
102+
uses: voxmedia/github-action-slack-notify-build@v1
103+
with:
104+
channel: watson-e2e-tests
105+
status: FAILED
106+
color: danger

assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceIT.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void testRuntimeResponseGenericRuntimeResponseTypeText() {
8282
input.setText("Hi");
8383
MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
8484
MessageResponse response = service.message(options).execute().getResult();
85-
System.out.println(response);
85+
// System.out.println(response);
8686

8787
RuntimeResponseGeneric runtimeResponseGenericRuntimeResponseTypeText =
8888
response.getOutput().getGeneric().get(0);
@@ -97,7 +97,7 @@ public void testRuntimeResponseGenericRuntimeResponseTypeChannelTransfer() {
9797
input.setText("test sdk");
9898
MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
9999
MessageResponse response = service.message(options).execute().getResult();
100-
System.out.println(response);
100+
// System.out.println(response);
101101

102102
RuntimeResponseGenericRuntimeResponseTypeChannelTransfer
103103
runtimeResponseGenericRuntimeResponseTypeChannelTransfer =
@@ -122,7 +122,7 @@ public void testExample() throws InterruptedException {
122122

123123
// sync
124124
MessageResponse response = service.message(options).execute().getResult();
125-
System.out.println(response);
125+
// System.out.println(response);
126126

127127
// async
128128
service
@@ -131,7 +131,7 @@ public void testExample() throws InterruptedException {
131131
new ServiceCallback<MessageResponse>() {
132132
@Override
133133
public void onResponse(Response<MessageResponse> response) {
134-
System.out.println(response.getResult());
134+
/*System.out.println(response.getResult()); */
135135
}
136136

137137
@Override
@@ -147,7 +147,7 @@ public void onFailure(Exception e) {}
147147
new Consumer<Response<MessageResponse>>() {
148148
@Override
149149
public void accept(Response<MessageResponse> response) throws Exception {
150-
System.out.println(response.getResult());
150+
// System.out.println(response.getResult());
151151
}
152152
});
153153

@@ -1324,6 +1324,11 @@ public void testListWorkspaces() {
13241324

13251325
ListWorkspacesOptions listOptions = new ListWorkspacesOptions.Builder().build();
13261326
WorkspaceCollection response = service.listWorkspaces(listOptions).execute().getResult();
1327+
/** System.out.println(response);
1328+
DeleteWorkspaceOptions deleteOptions = new DeleteWorkspaceOptions.Builder("5b586426-c587-4775-950c-59b58db84b14").build();
1329+
service.deleteWorkspace(deleteOptions).execute();
1330+
DeleteWorkspaceOptions deleteOptions1 = new DeleteWorkspaceOptions.Builder("661d9f74-9d3a-4655-bee4-84e16bd25d00").build();
1331+
service.deleteWorkspace(deleteOptions1).execute(); **/
13271332

13281333
assertNotNull(response);
13291334
assertNotNull(response.getWorkspaces());

assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ public String getWorkspaceId() {
5656
@Before
5757
public void setUp() throws Exception {
5858
super.setUp();
59-
String apiKey = getProperty("assistant.apikey");
60-
workspaceId = getProperty("assistant.workspace_id");
59+
String apiKey = System.getenv("ASSISTANT_APIKEY");
60+
workspaceId = System.getenv("ASSISTANT_WORKSPACE_ID");
6161

62-
Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null);
62+
Assume.assumeFalse("ASSISTANT_APIKEY is not defined", apiKey == null);
6363

6464
Authenticator authenticator = new IamAuthenticator(apiKey);
6565
service = new Assistant("2019-02-28", authenticator);
66-
service.setServiceUrl(getProperty("assistant.url"));
66+
service.setServiceUrl(System.getenv("ASSISTANT_URL"));
6767
service.setDefaultHeaders(getDefaultHeaders());
6868
}
6969

assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantServiceTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ public String getAssistantId() {
5656
@Before
5757
public void setUp() throws Exception {
5858
super.setUp();
59-
String apiKey = getProperty("assistant.apikey");
60-
assistantId = getProperty("assistant.assistant_id");
59+
String apiKey = System.getenv("ASSISTANT_APIKEY");
60+
assistantId = System.getenv("ASSISTANT_ASSISTANT_ID");
6161

62-
Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null);
62+
Assume.assumeFalse("ASSISTANT_APIKEY is not defined", apiKey == null);
6363

6464
Authenticator authenticator = new IamAuthenticator(apiKey);
6565
service = new Assistant("2019-02-28", authenticator);
66-
service.setServiceUrl(getProperty("assistant.url"));
66+
service.setServiceUrl(System.getenv("ASSISTANT_URL"));
6767
service.setDefaultHeaders(getDefaultHeaders());
6868
}
6969

compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public void testConvertToHtml() throws FileNotFoundException {
7373
.build();
7474
HTMLReturn response = service.convertToHtml(convertToHtmlOptions).execute().getResult();
7575

76-
System.out.println(response);
76+
assertNotNull(response);
77+
// System.out.println(response);
7778
}
7879

7980
@Test
@@ -86,7 +87,8 @@ public void testClassifyElements() throws FileNotFoundException {
8687
ClassifyReturn response =
8788
service.classifyElements(classifyElementsOptions).execute().getResult();
8889

89-
System.out.println(response);
90+
assertNotNull(response);
91+
// System.out.println(response);
9092
}
9193

9294
@Test
@@ -95,7 +97,8 @@ public void testExtractTables() throws FileNotFoundException {
9597
new ExtractTablesOptions.Builder().file(TABLE_FILE).fileContentType("image/png").build();
9698
TableReturn response = service.extractTables(extractTablesOptions).execute().getResult();
9799

98-
System.out.println(response);
100+
assertNotNull(response);
101+
// System.out.println(response);
99102
}
100103

101104
@Test
@@ -110,7 +113,8 @@ public void testCompareDocuments() throws FileNotFoundException {
110113
CompareReturn response =
111114
service.compareDocuments(compareDocumentsOptions).execute().getResult();
112115

113-
System.out.println(response);
116+
assertNotNull(response);
117+
// System.out.println(response);
114118
}
115119

116120
@Test

compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ public CompareComply getService() {
2323
@Before
2424
public void setUp() throws Exception {
2525
super.setUp();
26-
String apiKey = getProperty("compare_comply.apikey");
27-
Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null);
26+
String apiKey = System.getenv("COMPARE_COMPLY_APIKEY");
27+
Assume.assumeFalse("COMPARE_COMPLY_APIKEY is not defined", apiKey == null);
2828

2929
Authenticator authenticator = new IamAuthenticator(apiKey);
3030
service = new CompareComply(VERSION, authenticator);
31-
service.setServiceUrl(getProperty("compare_comply.url"));
31+
service.setServiceUrl(System.getenv("COMPARE_COMPLY_URL"));
3232
service.setDefaultHeaders(getDefaultHeaders());
3333
}
3434
}

0 commit comments

Comments
 (0)