Skip to content

Commit

Permalink
ci: Gha 9907 (#1196)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Mikemosca authored Nov 23, 2021
1 parent 59ee618 commit f2966f8
Show file tree
Hide file tree
Showing 19 changed files with 228 additions and 112 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support documentation.
# This workflow will download a prebuilt Java version, install dependencies and run integration tests

name: Run Integration Tests

on:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
integration_test:
name: Build and Run Integration Tests on Java ${{ matrix.java-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
java-version: ['8']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2

- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'

- name: Execute Java integration tests
# continue-on-error: true
env:
MVN_ARGS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
NATURAL_LANGUAGE_CLASSIFIER_URL: "https://api.us-south.natural-language-classifier.watson.cloud.ibm.com"
NATURAL_LANGUAGE_CLASSIFIER_APIKEY: ${{ secrets.NLC_APIKEY }}
NATURAL_LANGUAGE_CLASSIFIER_ID: ${{ secrets.NLC_CLASSIFIER_ID }}
LANGUAGE_TRANSLATOR_APIKEY: ${{ secrets.LT_APIKEY }}
LANGUAGE_TRANSLATOR_URL: "https://api.us-south.language-translator.watson.cloud.ibm.com"
NATURAL_LANGUAGE_UNDERSTANDING_APIKEY: ${{ secrets.NLU_APIKEY }}
NATURAL_LANGUAGE_UNDERSTANDING_URL: "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com"
PERSONALITY_INSIGHTS_APIKEY: ${{ secrets.PI_APIKEY }}
PERSONALITY_INSIGHTS_URL: "https://api.us-south.personality-insights.watson.cloud.ibm.com"
TONE_ANALYZER_APIKEY: ${{ secrets.TA_APIKEY }}
TONE_ANALYZER_URL: "https://api.us-south.tone-analyzer.watson.cloud.ibm.com"
SPEECH_TO_TEXT_APIKEY: ${{ secrets.STT_APIKEY }}
SPEECH_TO_TEXT_URL: "https://api.us-south.speech-to-text.watson.cloud.ibm.com"
SPEECH_TO_TEXT_CUSTOM_ID: ${{ secrets.STT_APIKEY_CUSTOM_ID }}
SPEECH_TO_TEXT_ACOUSTIC_CUSTOM_ID: ${{ secrets.STT_APIKEY_ACOUSTIC_CUSTOM_ID }}
TEXT_TO_SPEECH_APIKEY: ${{ secrets.TTS_APIKEY }}
TEXT_TO_SPEECH_URL: "https://api.us-south.text-to-speech.watson.cloud.ibm.com"
VISUAL_RECOGNITION_APIKEY: ${{ secrets.VR_APIKEY }}
VISUAL_RECOGNITION_COLLECTION_ID: ${{ secrets.VR_COLLECTION_ID }}
VISUAL_RECOGNITION_URL: "https://api.us-south.visual-recognition.watson.cloud.ibm.com"
COMPARE_COMPLY_APIKEY: ${{ secrets.CC_APIKEY }}
COMPARE_COMPLY_FEEDBACK_ID: ${{ secrets.CC_FEEDBACK_ID }}
COMPARE_COMPLY_URL: "https://api.us-south.compare-comply.watson.cloud.ibm.com"
ASSISTANT_APIKEY: ${{ secrets.WA_APIKEY }}
ASSISTANT_WORKSPACE_ID: ${{ secrets.WA_WORKSPACE_ID }}
ASSISTANT_ASSISTANT_ID: ${{ secrets.WA_ASSISTANT_ID }}
ASSISTANT_URL: "https://api.us-south.assistant.watson.cloud.ibm.com"
DISCOVERY_APIKEY: ${{ secrets.D1_APIKEY }}
DISCOVERY_ENVIRONMENT_ID: ${{ secrets.D1_ENVIRONMENT_ID }}
DISCOVERY_COLLECTION_ID: ${{ secrets.D1_COLLECTION_ID }}
DISCOVERY_URL: "https://api.us-south.discovery.watson.cloud.ibm.com"
DISCOVERY_V2_APIKEY: ${{ secrets.D2_APIKEY }}
DISCOVERY_V2_PROJECT_ID: ${{ secrets.D2_PROJECT_ID }}
DISCOVERY_V2_COLLECTION_ID: ${{ secrets.D2_COLLECTION_ID }}
DISCOVERY_V2_URL: "https://api.us-south.discovery.watson.cloud.ibm.com"
run: |
mvn test -Dtest=v1/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS
mvn test -Dtest=v2/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS
mvn test -Dtest=CompareComplyServiceIT -DfailIfNoTests=false -pl compare-comply,common $MVN_ARGS
mvn test -Dtest=v1/DiscoveryServiceIT -DfailIfNoTests=false -pl discovery,common $MVN_ARGS
mvn test -Dtest=v2/DiscoveryIT -DfailIfNoTests=false -pl discovery,common $MVN_ARGS
mvn test -Dtest=LanguageTranslatorIT -DfailIfNoTests=false -pl language-translator,common $MVN_ARGS
mvn test -Dtest=NaturalLanguageClassifierIT -DfailIfNoTests=false -pl natural-language-classifier,common $MVN_ARGS
mvn test -Dtest=NaturalLanguageUnderstandingIT -DfailIfNoTests=false -pl natural-language-understanding,common $MVN_ARGS
mvn test -Dtest=PersonalityInsightsIT -DfailIfNoTests=false -pl personality-insights,common $MVN_ARGS
mvn test -Dtest=SpeechToTextIT -DfailIfNoTests=false -pl speech-to-text,common $MVN_ARGS
mvn test -Dtest=TextToSpeechIT -DfailIfNoTests=false -pl text-to-speech,common $MVN_ARGS
mvn test -Dtest=CustomizationsIT -DfailIfNoTests=false -pl text-to-speech,common $MVN_ARGS
mvn test -Dtest=ToneAnalyzerIT -DfailIfNoTests=false -pl tone-analyzer,common $MVN_ARGS
mvn test -Dtest=v3/VisualRecognitionIT -DfailIfNoTests=false -pl visual-recognition,common $MVN_ARGS
mvn test -Dtest=v4/VisualRecognitionIT -DfailIfNoTests=false -pl visual-recognition,common $MVN_ARGS
# Do not notify on success. We will leave the code here just in case we decide to switch gears
- name: Notify slack on success
if: false # success()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: watson-e2e-tests
status: SUCCESS
color: good

- name: Notify slack on failure
if: false # failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: watson-e2e-tests
status: FAILED
color: danger
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testRuntimeResponseGenericRuntimeResponseTypeText() {
input.setText("Hi");
MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
MessageResponse response = service.message(options).execute().getResult();
System.out.println(response);
// System.out.println(response);

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

RuntimeResponseGenericRuntimeResponseTypeChannelTransfer
runtimeResponseGenericRuntimeResponseTypeChannelTransfer =
Expand All @@ -122,7 +122,7 @@ public void testExample() throws InterruptedException {

// sync
MessageResponse response = service.message(options).execute().getResult();
System.out.println(response);
// System.out.println(response);

// async
service
Expand All @@ -131,7 +131,7 @@ public void testExample() throws InterruptedException {
new ServiceCallback<MessageResponse>() {
@Override
public void onResponse(Response<MessageResponse> response) {
System.out.println(response.getResult());
/*System.out.println(response.getResult()); */
}

@Override
Expand All @@ -147,7 +147,7 @@ public void onFailure(Exception e) {}
new Consumer<Response<MessageResponse>>() {
@Override
public void accept(Response<MessageResponse> response) throws Exception {
System.out.println(response.getResult());
// System.out.println(response.getResult());
}
});

Expand Down Expand Up @@ -1324,6 +1324,11 @@ public void testListWorkspaces() {

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

assertNotNull(response);
assertNotNull(response.getWorkspaces());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public String getWorkspaceId() {
@Before
public void setUp() throws Exception {
super.setUp();
String apiKey = getProperty("assistant.apikey");
workspaceId = getProperty("assistant.workspace_id");
String apiKey = System.getenv("ASSISTANT_APIKEY");
workspaceId = System.getenv("ASSISTANT_WORKSPACE_ID");

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public String getAssistantId() {
@Before
public void setUp() throws Exception {
super.setUp();
String apiKey = getProperty("assistant.apikey");
assistantId = getProperty("assistant.assistant_id");
String apiKey = System.getenv("ASSISTANT_APIKEY");
assistantId = System.getenv("ASSISTANT_ASSISTANT_ID");

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public void testConvertToHtml() throws FileNotFoundException {
.build();
HTMLReturn response = service.convertToHtml(convertToHtmlOptions).execute().getResult();

System.out.println(response);
assertNotNull(response);
// System.out.println(response);
}

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

System.out.println(response);
assertNotNull(response);
// System.out.println(response);
}

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

System.out.println(response);
assertNotNull(response);
// System.out.println(response);
}

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

System.out.println(response);
assertNotNull(response);
// System.out.println(response);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public CompareComply getService() {
@Before
public void setUp() throws Exception {
super.setUp();
String apiKey = getProperty("compare_comply.apikey");
Assume.assumeFalse("config.properties doesn't have valid credentials.", apiKey == null);
String apiKey = System.getenv("COMPARE_COMPLY_APIKEY");
Assume.assumeFalse("COMPARE_COMPLY_APIKEY is not defined", apiKey == null);

Authenticator authenticator = new IamAuthenticator(apiKey);
service = new CompareComply(VERSION, authenticator);
service.setServiceUrl(getProperty("compare_comply.url"));
service.setServiceUrl(System.getenv("COMPARE_COMPLY_URL"));
service.setDefaultHeaders(getDefaultHeaders());
}
}
Loading

0 comments on commit f2966f8

Please sign in to comment.