Skip to content

Commit db87977

Browse files
committed
ci: adds version matrix to ensure dependencies compatibility
1 parent 9168560 commit db87977

File tree

2 files changed

+53
-37
lines changed

2 files changed

+53
-37
lines changed

.github/policies/msgraph-sdk-python-branch-protection.yml

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,37 @@ description: Branch protection policy for the msgraph-sdk-python repository
88
resource: repository
99
configuration:
1010
branchProtectionRules:
11+
- branchNamePattern: main
12+
# This branch pattern applies to the following branches as of 06/12/2023 10:31:18:
13+
# main
1114

12-
- branchNamePattern: main
13-
# This branch pattern applies to the following branches as of 06/12/2023 10:31:18:
14-
# main
15-
16-
# Specifies whether this branch can be deleted. boolean
17-
allowsDeletions: false
18-
# Specifies whether forced pushes are allowed on this branch. boolean
19-
allowsForcePushes: false
20-
# Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean
21-
dismissStaleReviews: true
22-
# Specifies whether admins can overwrite branch protection. boolean
23-
isAdminEnforced: false
24-
# Indicates whether "Require a pull request before merging" is enabled. boolean
25-
requiresPullRequestBeforeMerging: true
26-
# Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required
27-
requiredApprovingReviewsCount: 1
28-
# Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean
29-
requireCodeOwnersReview: true
30-
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
31-
requiresCommitSignatures: false
32-
# Are conversations required to be resolved before merging? boolean
33-
requiresConversationResolution: true
34-
# Are merge commits prohibited from being pushed to this branch. boolean
35-
requiresLinearHistory: false
36-
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
37-
requiredStatusChecks:
38-
- CodeQL
39-
- Validate code accuracy
40-
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
41-
requiresStrictStatusChecks: true
42-
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
43-
restrictsPushes: false
44-
# Restrict who can dismiss pull request reviews. boolean
45-
restrictsReviewDismissals: false
46-
15+
# Specifies whether this branch can be deleted. boolean
16+
allowsDeletions: false
17+
# Specifies whether forced pushes are allowed on this branch. boolean
18+
allowsForcePushes: false
19+
# Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean
20+
dismissStaleReviews: true
21+
# Specifies whether admins can overwrite branch protection. boolean
22+
isAdminEnforced: false
23+
# Indicates whether "Require a pull request before merging" is enabled. boolean
24+
requiresPullRequestBeforeMerging: true
25+
# Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required
26+
requiredApprovingReviewsCount: 1
27+
# Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean
28+
requireCodeOwnersReview: true
29+
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
30+
requiresCommitSignatures: false
31+
# Are conversations required to be resolved before merging? boolean
32+
requiresConversationResolution: true
33+
# Are merge commits prohibited from being pushed to this branch. boolean
34+
requiresLinearHistory: false
35+
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
36+
requiredStatusChecks:
37+
- CodeQL
38+
- check-build-matrix
39+
# Require branches to be up to date before merging. Requires requiredStatusChecks. boolean
40+
requiresStrictStatusChecks: true
41+
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
42+
restrictsPushes: false
43+
# Restrict who can dismiss pull request reviews. boolean
44+
restrictsReviewDismissals: false

.github/workflows/build.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,34 @@ jobs:
1212
validate:
1313
name: Validate code accuracy
1414
runs-on: ubuntu-latest
15+
strategy:
16+
max-parallel: 5
17+
matrix:
18+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1519
steps:
1620
- uses: actions/checkout@v4
17-
- name: Set up Python
21+
- name: Set up Python ${{ matrix.python-version }}
1822
uses: actions/setup-python@v5
1923
with:
20-
python-version: '3.12'
24+
python-version: ${{ matrix.python-version }}
2125
- name: Install dependencies
2226
run: |
2327
python -m pip install --upgrade pip
2428
pip install -r requirements-dev.txt
2529
- name: Lint with Pylint
2630
run: pylint msgraph --disable=W --rcfile=.pylintrc
2731

32+
# The check-build-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
33+
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
34+
check-build-matrix:
35+
runs-on: ubuntu-latest
36+
needs: validate
37+
if: always()
38+
steps:
39+
- name: All build matrix options are successful
40+
if: ${{ !(contains(needs.*.result, 'failure')) }}
41+
run: exit 0
42+
- name: One or more build matrix options failed
43+
if: ${{ contains(needs.*.result, 'failure') }}
44+
run: exit 1
45+

0 commit comments

Comments
 (0)