| 1 |
# This workflow will install the dependencies, run tests and lint every push |
| 2 |
|
| 3 |
name: Python package |
| 4 |
permissions: |
| 5 |
checks: write |
| 6 |
pull-requests: write |
| 7 |
id-token: write |
| 8 |
contents: read |
| 9 |
|
| 10 |
on: |
| 11 |
push: |
| 12 |
branches: [ master ] |
| 13 |
pull_request: |
| 14 |
jobs: |
| 15 |
build: |
| 16 |
runs-on: ubuntu-latest |
| 17 |
environment: build |
| 18 |
|
| 19 |
strategy: |
| 20 |
fail-fast: false |
| 21 |
matrix: |
| 22 |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ] |
| 23 |
env: |
| 24 |
PYTHON: ${{ matrix.python-version }} |
| 25 |
|
| 26 |
steps: |
| 27 |
- name: Azure login |
| 28 |
uses: azure/login@v2 |
| 29 |
with: |
| 30 |
client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 31 |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 32 |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 33 |
- uses: actions/checkout@v4 |
| 34 |
- name: Set up Python ${{ matrix.python-version }} |
| 35 |
uses: actions/setup-python@v4 |
| 36 |
with: |
| 37 |
python-version: ${{ matrix.python-version }} |
| 38 |
- name: Install dependencies |
| 39 |
run: | |
| 40 |
python -m pip install --upgrade pip --user |
| 41 |
pip install -r dev_requirements.txt --user |
| 42 |
pip install pytest-cov --user |
| 43 |
pip install ./azure-kusto-data[aio,pandas] ./azure-kusto-ingest[aio,pandas] --user |
| 44 |
pip freeze |
| 45 |
# We have to use an old version of this plugin, as the new one assumes python 3.8 |
| 46 |
- uses: psf/black@c8f1a5542c257491e1e093b1404481ece7f7e02c |
| 47 |
with: |
| 48 |
options: "--check --diff --line-length 160" |
| 49 |
version: "23.3.0" |
| 50 |
- name: EtoE Test with pytest |
| 51 |
env: |
| 52 |
TEST_DATABASE: ${{ secrets.TEST_DATABASE }} |
| 53 |
TEST_BLOB: ${{ secrets.TEST_BLOB }} |
| 54 |
ENGINE_CONNECTION_STRING: ${{ secrets.ENGINE_CONNECTION_STRING }} |
| 55 |
APPLICATION_INSIGHTS_ENGINE_CONNECTION_STRING: https://ade.applicationinsights.io/subscriptions/12534eb3-8109-4d84-83ad-576c0d5e1d06/resourcegroups/clients_e2e_test/providers/microsoft.insights/components/kusto-e2e-app-insights |
| 56 |
APPLICATION_INSIGHTS_TEST_DATABASE: kusto-e2e-app-insights |
| 57 |
run: | |
| 58 |
pytest -v . --junit-xml pytest.xml --cov=/home/runner/.local/lib/python${{ matrix.python-version }}/site-packages/azure/kusto --cov-report=xml:coverage2.xml |
| 59 |
- name: Upload Unit Test Results |
| 60 |
if: always() |
| 61 |
uses: actions/upload-artifact@v4 |
| 62 |
with: |
| 63 |
name: Unit Test Results (Python ${{ matrix.python-version }}) |
| 64 |
path: pytest*.xml |
| 65 |
|
| 66 |
- name: Upload coverage to Codecov |
| 67 |
uses: codecov/codecov-action@v2 |
| 68 |
with: |
| 69 |
env_vars: PYTHON |
| 70 |
|
| 71 |
|
| 72 |
publish-test-results: |
| 73 |
name: "Publish Unit Tests Results" |
| 74 |
needs: build |
| 75 |
runs-on: ubuntu-latest |
| 76 |
if: always() |
| 77 |
permissions: |
| 78 |
checks: write |
| 79 |
pull-requests: write |
| 80 |
|
| 81 |
steps: |
| 82 |
- name: Download Artifacts |
| 83 |
uses: actions/download-artifact@v4 |
| 84 |
with: |
| 85 |
path: artifacts |
| 86 |
|
| 87 |
- name: Publish Unit Test Results |
| 88 |
uses: EnricoMi/publish-unit-test-result-action@v2 |
| 89 |
with: |
| 90 |
files: artifacts/**/*.xml |