Skip to content

Commit 61ee326

Browse files
authored
KCLpy sample build tests (#2) (#279)
sample-kcl build tests
1 parent 39d1902 commit 61ee326

File tree

3 files changed

+89
-37
lines changed

3 files changed

+89
-37
lines changed

.github/workflows/privileged-run.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Build Intensive
5+
on:
6+
push:
7+
branches: [ master ]
8+
pull_request_target:
9+
branches: [ master ]
10+
11+
permissions:
12+
id-token: write
13+
contents: read
14+
15+
jobs:
16+
build-intensive:
17+
timeout-minutes: 8
18+
runs-on: ${{ matrix.os }}
19+
defaults:
20+
run:
21+
shell: bash
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
27+
os: [ ubuntu-latest, macOS-latest, windows-latest ]
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Configure AWS Credentials
34+
uses: aws-actions/configure-aws-credentials@v4
35+
with:
36+
aws-region: us-east-1
37+
role-to-assume: arn:aws:iam::751999266872:role/GitHubWorkflows
38+
role-session-name: myGitHubActions
39+
40+
- name: Set up JDK 8
41+
uses: actions/setup-java@v4
42+
with:
43+
java-version: '8'
44+
distribution: 'corretto'
45+
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v2
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: Install Python and required pips
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install -r requirements.txt
55+
pip install -r test_requirements.txt
56+
pip install build
57+
58+
- name: Test with Pytest
59+
run: |
60+
python -m pytest
61+
62+
- name: Install .jar files
63+
run: |
64+
python -m build
65+
python setup.py download_jars
66+
python setup.py install
67+
68+
- name: Put words to sample stream
69+
run: |
70+
sample_kinesis_wordputter.py --stream kclpysample -w cat -w dog -w bird -w lobster -w octopus
71+
72+
- name: Start KCL application (windows or ubuntu)
73+
if: matrix.os != 'macOS-latest'
74+
run: |
75+
timeout 45 $(amazon_kclpy_helper.py --print_command --java $(which java) --properties samples/sample.properties) || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
76+
77+
- name: Start KCL application (macOS)
78+
if: matrix.os == 'macOS-latest'
79+
run: |
80+
brew install coreutils
81+
gtimeout 45 $(amazon_kclpy_helper.py --print_command --java $(which java) --properties samples/sample.properties) || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi

.github/workflows/run-unit-tests.yml

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

samples/amazon_kclpy_helper.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ def get_kcl_jar_path():
5454
:rtype: str
5555
:return: The absolute path of the KCL jar files needed to run the MultiLangDaemon.
5656
'''
57-
return ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar')))
57+
if os.name == 'posix':
58+
return ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar')))
59+
else:
60+
return ';'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar')))
5861

5962
def get_kcl_classpath(properties=None, paths=[]):
6063
'''
@@ -81,7 +84,10 @@ def get_kcl_classpath(properties=None, paths=[]):
8184
# Add the dir that the props file is in
8285
dir_of_file = get_dir_of_file(properties)
8386
paths.append(dir_of_file)
84-
return ":".join([p for p in paths if p != ''])
87+
if os.name == 'posix':
88+
return ":".join([p for p in paths if p != ''])
89+
else:
90+
return ";".join([p for p in paths if p != ''])
8591

8692
def get_kcl_app_command(args, multi_lang_daemon_class, properties, log_configuration, paths=[]):
8793
'''

0 commit comments

Comments
 (0)