-
Notifications
You must be signed in to change notification settings - Fork 13
109 lines (101 loc) · 3.72 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# 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"
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