diff --git a/.github/workflows/privileged-run.yml b/.github/workflows/privileged-run.yml new file mode 100644 index 0000000..01eabcc --- /dev/null +++ b/.github/workflows/privileged-run.yml @@ -0,0 +1,81 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Build Intensive +on: + push: + branches: [ master ] + pull_request_target: + branches: [ master ] + +permissions: + id-token: write + contents: read + +jobs: + build-intensive: + timeout-minutes: 8 + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + python-version: [ "3.8", "3.9", "3.10", "3.11" ] + os: [ ubuntu-latest, macOS-latest, windows-latest ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: us-east-1 + role-to-assume: arn:aws:iam::751999266872:role/GitHubWorkflows + role-session-name: myGitHubActions + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'corretto' + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Python and required pips + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r test_requirements.txt + pip install build + + - name: Test with Pytest + run: | + python -m pytest + + - name: Install .jar files + run: | + python -m build + python setup.py download_jars + python setup.py install + + - name: Put words to sample stream + run: | + sample_kinesis_wordputter.py --stream kclpysample -w cat -w dog -w bird -w lobster -w octopus + + - name: Start KCL application (windows or ubuntu) + if: matrix.os != 'macOS-latest' + run: | + 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 + + - name: Start KCL application (macOS) + if: matrix.os == 'macOS-latest' + run: | + brew install coreutils + 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 diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml deleted file mode 100644 index 7829c6d..0000000 --- a/.github/workflows/run-unit-tests.yml +++ /dev/null @@ -1,35 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: UnitTestCoverage - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - python-version: [3.8, 3.9, "3.10", 3.11] - os: [ubuntu-latest, macOS-latest, windows-latest ] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r test_requirements.txt - - name: Test with pytest - run: | - pytest diff --git a/samples/amazon_kclpy_helper.py b/samples/amazon_kclpy_helper.py index 9596c05..36fd9fa 100644 --- a/samples/amazon_kclpy_helper.py +++ b/samples/amazon_kclpy_helper.py @@ -54,7 +54,10 @@ def get_kcl_jar_path(): :rtype: str :return: The absolute path of the KCL jar files needed to run the MultiLangDaemon. ''' - return ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar'))) + if os.name == 'posix': + return ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar'))) + else: + return ';'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar'))) def get_kcl_classpath(properties=None, paths=[]): ''' @@ -81,7 +84,10 @@ def get_kcl_classpath(properties=None, paths=[]): # Add the dir that the props file is in dir_of_file = get_dir_of_file(properties) paths.append(dir_of_file) - return ":".join([p for p in paths if p != '']) + if os.name == 'posix': + return ":".join([p for p in paths if p != '']) + else: + return ";".join([p for p in paths if p != '']) def get_kcl_app_command(args, multi_lang_daemon_class, properties, log_configuration, paths=[]): '''