Skip to content

Chat-bot Support for Webhooks (MS Bot Framework-based MS Teams Chat-bot) #1

Chat-bot Support for Webhooks (MS Bot Framework-based MS Teams Chat-bot)

Chat-bot Support for Webhooks (MS Bot Framework-based MS Teams Chat-bot) #1

Workflow file for this run

name: Test on Push
on:
pull_request:
branches: [main]
workflow_dispatch:
defaults:
run:
shell: bash
# Cancel any existing runs of this workflow on the same branch/pr
# We always want to build/deploy/test a new commit over an older one
concurrency:
group: ${{ github.workflow_ref }}
cancel-in-progress: true
jobs:
# Sets an output var to indicate if all changes are in docs files
# This output is used to skip running code checks on docs changes
changes:
name: Filter changed files
runs-on: mdb-dev
outputs:
not-docs: ${{ steps.filter.outputs.not-docs }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
predicate-quantifier: "every"
filters: |
not-docs:
- '!docs/**'
- '!**/*.md'
# Run all of our static code checks here
code_checking:
name: Run static code checks
runs-on: mdb-dev
needs: changes
steps:
- name: Checkout
if: ${{ needs.changes.outputs.not-docs == 'true' }}
uses: actions/checkout@v4
- name: Set up Python
if: ${{ needs.changes.outputs.not-docs == 'true' }}
uses: actions/[email protected]
with:
# I can't work out how to use vars.CI_PYTHON_VERSION for forks here in a nice way, so we have to hardcode it for forks
python-version: ${{ vars.CI_PYTHON_VERSION || '3.10' }}
cache: pip
cache-dependency-path: "**/requirements*.txt"
# Checks the codebase for print() statements and fails if any are found
# We should be using loggers instead
- name: Check for print statements
if: ${{ needs.changes.outputs.not-docs == 'true' }}
run: |
python tests/scripts/check_print_statements.py
# Gathers a list of changed files for pre-commit to use
- name: Get changed files
if: ${{ needs.changes.outputs.not-docs == 'true' }}
id: changed-files
uses: tj-actions/changed-files@v41
# Run pre-commit on all changed files
# See .pre-commit-config.yaml for the list of checks
- name: Run pre-commit
if: ${{ needs.changes.outputs.not-docs == 'true' }}
uses: pre-commit/[email protected]
with:
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
# Runs a few different checks against our many requirements files
# to make sure they're in order
- name: Check requirements files
if: ${{ needs.changes.outputs.not-docs == 'true' }}
run: |
# We don't need to install mindsdb itself here because these are just static code checks
pip install -r requirements/requirements-dev.txt
python tests/scripts/check_requirements.py
# Creates a matrix of environments to test against using matrix_includes.json
# Used for installation checks below
matrix_prep:
name: Prepare matrix
runs-on: mdb-dev
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
uses: JoshuaTheMiller/[email protected]
with:
filter: "[?runOnBranch==`${{ github.ref }}` || runOnBranch==`always`]"
# Check that our pip package is able to be installed in all of our supported environments
check_install:
name: Check pip installation
needs: [changes, matrix_prep, code_checking]
strategy:
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
runs-on: ${{ matrix.runs_on }}
steps:
- name: Checkout
if: ${{ needs.changes.outputs.not-docs == 'true' }}
uses: actions/checkout@v4
- name: Set up Python
if: ${{ needs.changes.outputs.not-docs == 'true' }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: "**/requirements*.txt"
- name: Check requirements files are installable
if: ${{ needs.changes.outputs.not-docs == 'true' }}
run: |
# Install dev requirements and build our pip package
pip install -r requirements/requirements-dev.txt
python setup.py sdist
# Install from the pip package
# If we install from source, we don't know if the pip package is installable.
cd dist
pip install --ignore-installed *.tar.gz
unit_tests:
name: Run Unit Tests
needs: [changes, matrix_prep, code_checking]
strategy:
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
runs-on: ${{ matrix.runs_on }}
if: github.ref_type == 'branch'
steps:
- name: Checkout
if: ${{ needs.changes.outputs.not-docs == 'true' }}
uses: actions/checkout@v4
- name: Set up Python
if: ${{ needs.changes.outputs.not-docs == 'true' }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: "**/requirements*.txt"
- name: Install dependencies
if: ${{ needs.changes.outputs.not-docs == 'true' }}
run: |
pip install .
pip install -r requirements/requirements-test.txt
pip install .[lightwood] # TODO: for now some tests rely on lightwood
pip install .[mssql]
pip install .[clickhouse]
pip install .[snowflake]
pip install .[web]
pip install .[redshift]
pip install .[bigquery]
pip install .[elasticsearch]
pip install .[databricks]
pip install .[oracle]
pip install .[db2]
pip install .[hive]
pip install .[teradata]
pip install .[hana]
pip install .[minds_endpoint]
pip freeze
- name: Run unit tests
if: ${{ needs.changes.outputs.not-docs == 'true' }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
env PYTHONPATH=./ pytest tests/unit/executor/ -x
env PYTHONPATH=./ pytest tests/unit/test_llm_utils.py
env PYTHONPATH=./ pytest tests/unit/ml_handlers/test_minds_endpoint.py
env PYTHONPATH=./ pytest tests/unit/ml_handlers/test_openai.py
# env PYTHONPATH=./ pytest tests/unit/ml_handlers/test_anyscale_endpoints.py
fi
- name: Run Handlers tests and submit Coverage to coveralls
if: ${{ needs.changes.outputs.not-docs == 'true' }}
run: |
handlers=("mysql" "postgres" "mssql" "clickhouse" "snowflake" "web" "redshift" "bigquery" "elasticsearch" "s3" "databricks" "dynamodb" "mariadb" "oracle" "mongodb" "db2" "hive" "teradata" "hana")
for handler in "${handlers[@]}"
do
pytest --cov=mindsdb/integrations/handlers/${handler}_handler tests/unit/handlers/test_${handler}.py
done
# Dont run coveralls for PRs from forks
if [ ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.repository }} ]; then
coveralls --service=github --basedir=mindsdb/integrations/handlers
fi
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
github_token: ${{ secrets.REPO_DISPATCH_PAT_TOKEN }}