Skip to content

bump logback to 1.3.16 (external) #3

bump logback to 1.3.16 (external)

bump logback to 1.3.16 (external) #3

Workflow file for this run

# This workflow will trigger on pushes and pull requests to master branch (and other branches in the list)
# sample-run uses matrix to create unique combinations of operating systems and python versions
# each of the unique runs downloads the jars needed to run the KCL, runs the sample_kinesis_wordputter.py, and runs sample_kclpy_app.py
# auto-approve-dependabot uses GitHub events to check if dependabot is the pull requester, and if the bump is functional then the PR is automatically approved
name: Sample Run Tests and Dependabot
on:
push:
branches: [ master, '*-test' ]
pull_request_target:
branches: [ master, '*-test' ]
types: [opened, synchronize]
jobs:
# Evaluates if the sample tests should run. If the workflow is triggered by a push OR
# is triggered by a pull request without the 'skip-sample-tests' label, the sample tests should run.
# Otherwise, the sample tests will be skipped
check-if-should-run:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request_target' && !contains(github.event.pull_request.labels.*.name, 'skip-sample-tests')) }}
outputs:
should_run: 'true'
is_fork: ${{ github.event_name == 'pull_request_target' && (github.event.pull_request.head.repo.fork || github.event.pull_request.user.login == 'dependabot[bot]') }}
steps:
- run: echo "Evaluating workflow conditions"
# Workflow will pause and wait here if it is triggered by a fork PR. The workflow will continue to wait until
# an approved member of the environment 'manual_approval' allows the workflow to run
wait-for-approval:
needs: [ check-if-should-run ]
if: ${{ needs.check-if-should-run.outputs.is_fork == 'true' }}
runs-on: ubuntu-latest
environment: manual-approval
steps:
- run: echo "Fork PR approved by a team member."
# Sample run tests of the KCL
# Runs only if (check-if-should-run allows AND (the PR is not from a fork OR it has been approved to run))
sample-run:
needs: [ check-if-should-run, wait-for-approval ]
permissions:
id-token: write
if: ${{ always() && needs.check-if-should-run.outputs.should_run == 'true' && (needs.check-if-should-run.outputs.is_fork != 'true' || needs.wait-for-approval.result == 'success') }}
timeout-minutes: 20
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
# Initialize matrix based on PR labels (more-tests label runs more tests)
strategy:
fail-fast: false
matrix:
python-version: ${{ github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'more-tests') && fromJSON('["3.9", "3.11"]') || fromJSON('["3.9"]') }}
jdk-version: ${{ github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'more-tests') && fromJSON('["8", "11", "17", "21", "24"]') || fromJSON('["8", "11"]') }}
os: [ ubuntu-latest, macOS-latest, windows-latest ]
steps:
# For pull_request_target, checkout PR head instead of merge commit
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
- name: Validate os, python-version, and jdk-version
run: |
[[ "${{ matrix.os }}" =~ ^(ubuntu-latest|macOS-latest|windows-latest)$ ]] || exit 1
[[ "${{ matrix.python-version }}" =~ ^(3.9|3.11)$ ]] || exit 1
[[ "${{ matrix.jdk-version }}" =~ ^(8|11|17|21|24)$ ]] || exit 1
# Configure AWS Credentials. Role session name is unique to avoid OIDC errors when running multiple tests concurrently
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_ARN_GHA }}
role-session-name: GHA-${{ github.run_id }}-${{ matrix.python-version }}-${{ matrix.jdk-version }}-${{ matrix.os }}
- 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@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install pip and requirements
run: |
python -m pip install --upgrade pip --no-cache-dir
pip install --no-cache-dir -r requirements.txt -r test_requirements.txt
- name: Test with Pytest
run: |
python -m pytest
# Download .jar files required to run KCL app
- name: Install .jar files
run: |
python setup.py download_jars
pip install -e .
env:
KCL_MVN_REPO_SEARCH_URL: https://repo1.maven.org/maven2/
# Create unique identifiers for the stream name and application name
- name: Set up unique identifiers
run: |
STREAM_NAME="kclpysample-${{ github.run_id }}-${{ matrix.os }}-py${{ matrix.python-version }}-jdk${{ matrix.jdk-version }}"
APP_NAME="PythonKCLSample-${{ github.run_id }}-${{ matrix.os }}-py${{ matrix.python-version }}-jdk${{ matrix.jdk-version }}"
echo "STREAM_NAME=$STREAM_NAME" >> $GITHUB_ENV
echo "APP_NAME=$APP_NAME" >> $GITHUB_ENV
# Manipulate github_workflow.properties file to use unique stream name, application name, and OS specific program changes
- name: Manipulate github_workflow.properties file
run: |
chmod +x .github/scripts/manipulate_properties.sh
.github/scripts/manipulate_properties.sh
env:
RUNNER_OS: ${{ matrix.os }}
STREAM_NAME: ${{ env.STREAM_NAME }}
APP_NAME: ${{ env.APP_NAME }}
# Create kinesis stream with unique name and wait for it to exist
- name: Create and wait Kinesis stream
run: |
chmod +x .github/scripts/create_stream.sh
.github/scripts/create_stream.sh
env:
STREAM_NAME: ${{ env.STREAM_NAME }}
# Put words to sample stream with unique name based on run ID
- name: Put words to sample stream
run: |
chmod +x .github/scripts/put_words_to_stream.sh
.github/scripts/put_words_to_stream.sh
env:
STREAM_NAME: ${{ env.STREAM_NAME }}
# Run sample KCL application
- name: Start KCL application
run: |
chmod +x .github/scripts/start_kcl.sh
.github/scripts/start_kcl.sh
env:
RUNNER_OS: ${{ matrix.os }}
STREAM_NAME: ${{ env.STREAM_NAME }}
RUN_TIME_SECONDS: 900
# Check and verify results of KCL test
- name: Verify KCL Functionality
run: |
chmod +x .github/scripts/verify_kcl.sh
.github/scripts/verify_kcl.sh
env:
APP_NAME: ${{ env.APP_NAME }}
# Clean up all existing Streams and DDB tables
- name: Clean up Kinesis Stream and DynamoDB table
if: always()
run: |
chmod +x .github/scripts/clean_up_stream_table.sh
.github/scripts/clean_up_stream_table.sh
env:
STREAM_NAME: ${{ env.STREAM_NAME }}
APP_NAME: ${{ env.APP_NAME }}
auto-approve-dependabot:
needs: [ sample-run ]
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]'
permissions:
contents: read
pull-requests: write
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}}