Repository navigation
142 lines (132 loc) · 5.15 KB
/
Copy pathbuild.yml
File metadata and controls
142 lines (132 loc) · 5.15 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# 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]
merge_group:
types: [checks_requested]
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
max-parallel: 10
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: ${{ matrix.library.path }}
run: |
pip install -r requirements-dev.txt
- name: Check code format
working-directory: ${{ matrix.library.path }}
run: |
yapf -dr ${{ matrix.library.name }}
- name: Check import order
working-directory: ${{ matrix.library.path }}
run: |
isort ${{ matrix.library.name }}
- name: Lint with Pylint
working-directory: ${{ matrix.library.path }}
run: |
pylint ${{ matrix.library.name }} --disable=W --rcfile=.pylintrc
- name: Static type checking with Mypy
working-directory: ${{ matrix.library.path }}
run: |
mypy ${{ matrix.library.name }}
- name: Run the tests
working-directory: ${{ matrix.library.path }}
run: |
pytest
validation-workflow-with-generated-code:
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
max-parallel: 10
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: "./tests/validation"
run: |
pip install -r requirements-dev.txt
- name: Static type checking with Mypy
working-directory: "./tests/validation"
run: |
mypy validation
type-check-installed-wheels:
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
max-parallel: 10
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: "./tests/consumer"
run: |
pip install --only-binary :all: -r requirements-dev.txt
- name: Build and install the wheels
run: |
for package in abstractions authentication/azure http/httpx serialization/form serialization/json serialization/text serialization/multipart bundle; do
python -m build --wheel --outdir dist "packages/$package"
done
pip install --only-binary :all: dist/*.whl
- name: Static type checking with Mypy against the installed wheels
working-directory: "./tests/consumer"
run: |
mypy consumer.py
# 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,type-check-installed-wheels]
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