Skip to content

Add ADO pipelines

Add ADO pipelines #20

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: Install dev dependencies
run: pip install -e './src[dev]'
- name: Lint with flake8
run: |
# Lint only changed files on PRs; full lint on push to main
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- '*.py' || true)
if [ -n "$FILES" ]; then
echo "Linting changed files: $FILES"
echo "$FILES" | xargs flake8 --max-line-length 120
else
echo "No Python files changed"
fi
else
flake8 src/ tests/ --max-line-length 120 || echo "::warning::flake8 found issues (non-blocking on push)"
fi
- name: Lint Markdown
run: npx markdownlint-cli2 '**/*.md' || echo '::warning::Markdown lint found issues (non-blocking until existing issues are fixed)'
build-and-test:
runs-on: ${{ matrix.os }}
needs: lint
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: Install dev dependencies
run: pip install -e './src[dev]'
- name: Test with coverage
run: |
# Ignore test files for generated connectors with broken type refs,
# and code quality meta-test (mypy on broken generated code).
# See: https://github.com/Azure/connectors-python-sdk/issues/13
pytest -v --tb=short \
--ignore=tests/test_kusto.py \
--ignore=tests/test_kusto_client.py \
--ignore=tests/test_office365.py \
--ignore=tests/test_sharepointonline.py \
--ignore=tests/test_teams.py \
--ignore=tests/test_code_quality.py
shell: bash
- name: Upload coverage
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: coverage-report
path: ./coverage/coverage.xml
pack:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: Install build tools
run: pip install build
- name: Build package
run: python -m build src/
- name: Upload package artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: python-package
path: src/dist/*