Merge pull request #407 from Pete-rePete/serialization-site-packages-… #535
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Build and Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_call: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
strategy: | |
max-parallel: 10 | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
library : | |
- name: "kiota_abstractions" | |
path: "./packages/abstractions" | |
- name: "kiota_authentication_azure" | |
path: "./packages/authentication/azure" | |
- name: "kiota_http" | |
path: "./packages/http/httpx" | |
- name: "kiota_serialization_form" | |
path: "./packages/serialization/form" | |
- name: "kiota_serialization_json" | |
path: "./packages/serialization/json" | |
- name: "kiota_serialization_text" | |
path: "./packages/serialization/text" | |
- name: "kiota_serialization_multipart" | |
path: "./packages/serialization/multipart" | |
- name: "kiota_bundle" | |
path: "./packages/bundle" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
working-directory: ${{ matrix.library.path }} | |
run: | | |
python -m pip install --upgrade poetry | |
poetry install | |
- name: Check code format | |
working-directory: ${{ matrix.library.path }} | |
run: | | |
poetry run yapf -dr ${{ matrix.library.name }} | |
- name: Check import order | |
working-directory: ${{ matrix.library.path }} | |
run: | | |
poetry run isort ${{ matrix.library.name }} | |
- name: Lint with Pylint | |
working-directory: ${{ matrix.library.path }} | |
run: | | |
poetry run pylint ${{ matrix.library.name }} --disable=W --rcfile=.pylintrc | |
- name: Static type checking with Mypy | |
working-directory: ${{ matrix.library.path }} | |
run: | | |
poetry run mypy ${{ matrix.library.name }} | |
- name: Run the tests | |
working-directory: ${{ matrix.library.path }} | |
run: | | |
poetry run pytest | |
validation-workflow-with-generated-code: | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
strategy: | |
max-parallel: 10 | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
working-directory: "./tests/validation" | |
run: | | |
python -m pip install --upgrade poetry | |
poetry install | |
- name: Static type checking with Mypy | |
working-directory: "./tests/validation" | |
run: | | |
poetry run mypy validation | |
# The check-python-version-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure. | |
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks. | |
check-python-version-matrix: | |
runs-on: ubuntu-latest | |
needs: [build,validation-workflow-with-generated-code] | |
if: always() | |
steps: | |
- name: All build matrix options are successful | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: One or more build matrix options failed | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |