Skip to content

Merge remote-tracking branch 'upstream/master' #2

Merge remote-tracking branch 'upstream/master'

Merge remote-tracking branch 'upstream/master' #2

# This workflow will trigger on pushes, pull requests (to master branch), and manually from the GitHub Actions tab (when requested)
# sample_run uses matrix to create 12 unique combinations of operating systems and python versions
# each of the 12 runs download the jars needed to run the KCL, run the sample_kinesis_wordputter.py, and use a timeout command to run the sample_kclpy_app.py
# auto_merge uses GitHub events to check if dependabot is the pull requester, and if the request fits the criteria the PR is automatically merged
name: Sample Run and Dependabot Auto-merge
on:
push:
branches: [ master ]
permissions:
id-token: write
contents: write
pull-requests: write
statuses: write
jobs:
sample-run:
timeout-minutes: 8
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
jdk-version: [ "8", "11", "17", "21", "24" ]
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/GitHubPython
role-session-name: myGitHubActionsPython
- name: Set up JDK ${{ matrix.jdk-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk-version }}
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
env:
KCL_MVN_REPO_SEARCH_URL: https://repo1.maven.org/maven2/
- 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
auto-merge-dependabot:
needs: [sample-run]
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' && github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
alert-lookup: true
github-token: "${{ secrets.GITHUB_TOKEN }}"
# - name: Approve PR
# if: steps.metadata.outputs.update-type != 'version-update:semver-major'
# run: gh pr review --approve "$PR_URL"
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: Enable auto-merge for Dependabot PRs
# if: steps.metadata.outputs.update-type != 'version-update:semver-major'
# run: gh pr merge --auto --merge "$PR_URL"
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GH_TOKEN: ${{secrets.GITHUB_TOKEN}}