Skip to content

Commit faaa5fe

Browse files
committed
updated the pipeline runtime and updated the version for sku for rc
1 parent 180a6ff commit faaa5fe

5 files changed

Lines changed: 165 additions & 317 deletions

File tree

.Pipelines/CI-AND-RELEASE-PIPELINES.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ including what each pipeline does, when it runs, and how to trigger a release.
1111
|------|-------------|---------|
1212
| [`azure-pipelines.yml`](../azure-pipelines.yml) | [MSAL.Python-PR-OneBranch-Official (3064)](https://dev.azure.com/IdentityDivision/IDDP/_build?definitionId=3064) | PR gate, post-merge CI, and performance benchmarks — calls the shared template with `runPublish: false`; runs benchmarks on post-merge pushes to `dev` |
1313
| [`pipeline-publish.yml`](pipeline-publish.yml) | [MSAL.Python-Publish (3067)](https://dev.azure.com/IdentityDivision/IDDP/_build?definitionId=3067) | Release pipeline — manually queued, builds and publishes to PyPI |
14-
| [`template-pipeline-stages.yml`](template-pipeline-stages.yml) || Shared stages template — PreBuildCheck, Validate, and CI stages reused by both pipelines |
14+
| [`template-pipeline-stages.yml`](template-pipeline-stages.yml) || Shared stages template — PreBuildCheck, Validate, UnitTests, and E2ETests stages reused by both pipelines |
1515
| [`credscan-exclusion.json`](credscan-exclusion.json) || CredScan suppression file for known test fixtures |
1616

1717
---
@@ -22,23 +22,29 @@ including what each pipeline does, when it runs, and how to trigger a release.
2222

2323
| Event | Branches |
2424
|-------|----------|
25-
| Pull request opened / updated | all branches |
26-
| Push / merge | `dev`, `azure-pipelines` |
25+
| Pull request opened / updated | `dev` (PRs targeting `dev` only) |
26+
| Push / merge | `dev` |
2727
| Scheduled | Daily at 11:45 PM Pacific, `dev` branch (only when there are new changes) |
2828

29+
Fast unit-test feedback for PRs targeting **other** branches (e.g. `release-x.y.z`)
30+
is provided separately by the GitHub Actions workflow
31+
[`.github/workflows/python-package.yml`](../.github/workflows/python-package.yml),
32+
which runs the package build and unit tests on every PR.
33+
2934
### Stages
3035

3136
```
32-
PreBuildCheck ─► CI ─► Benchmark (post-merge to dev only)
37+
PreBuildCheck ─► UnitTests ─► E2ETests ─► Benchmark (post-merge to dev only)
3338
```
3439

3540
| Stage | What it does | When it runs |
3641
|-------|-------------|-------------|
3742
| **PreBuildCheck** | Runs SDL security scans: PoliCheck (policy/offensive content), CredScan (leaked credentials), and PostAnalysis (breaks the build on findings) | Always |
38-
| **CI** | Runs the full test suite on Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14 | Always |
43+
| **UnitTests** | Runs the unit test suite on Python 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14 (no Key Vault required) | After PreBuildCheck |
44+
| **E2ETests** | Fetches the MSID Lab certificate from Key Vault and runs `tests/test_e2e.py` + `tests/test_fmi_e2e.py` on the same Python matrix. Skipped on forked PRs (no Key Vault access). | After UnitTests |
3945
| **Benchmark** | Runs performance benchmarks on Python 3.9 and publishes `benchmark-results` artifact | Post-merge pushes to `dev` and manual runs only |
4046

41-
The Validate stage is **skipped** on PR/CI runs (it only applies to release builds).
47+
The `Validate` stage is **skipped** on PR/CI runs (it only applies to release builds).
4248

4349
> **SDL coverage:** The PreBuildCheck stage satisfies the OneBranch SDL requirement.
4450
> It runs on every PR, every merge to `dev`, and on the daily schedule — ensuring
@@ -63,18 +69,25 @@ with both parameters filled in.
6369
### Stage Flow
6470

6571
```
66-
PreBuildCheck ─► Validate ─► CI ─► Build ─┬─► PublishMSALPython (publishTarget == 'test.pypi.org (Preview / RC)')
67-
└─► PublishPyPI (publishTarget == 'pypi.org (ESRP Production)')
72+
PreBuildCheck ─► Validate ─► UnitTests ─► E2ETests ─► Build ─┬─► PublishMSALPython (publishTarget == 'test.pypi.org (Preview / RC)')
73+
└─► PublishPyPI (publishTarget == 'pypi.org (ESRP Production)')
6874
```
6975

7076
| Stage | What it does | Condition |
7177
|-------|-------------|-----------|
7278
| **PreBuildCheck** | PoliCheck + CredScan scans | Always |
7379
| **Validate** | Asserts the `packageVersion` parameter matches `msal/sku.py __version__` | Always (release runs only) |
74-
| **CI** | Full test matrix (Python 3.8–3.14) | After Validate passes |
75-
| **Build** | Builds `sdist` and `wheel` via `python -m build`; publishes `python-dist` artifact | After CI passes |
80+
| **UnitTests** | Unit test matrix (Python 3.9–3.14) | After Validate passes |
81+
| **E2ETests** | E2E test matrix (Python 3.9–3.14) with MSID Lab cert from Key Vault | After UnitTests passes |
82+
| **Build** | Builds `sdist` and `wheel` via `python -m build`; publishes `python-dist` artifact | After E2ETests passes |
7683
| **PublishMSALPython** | Uploads to test.pypi.org | `publishTarget == test.pypi.org (Preview / RC)` |
77-
| **PublishPyPI** | Uploads to PyPI via ESRP; requires manual approval | `publishTarget == pypi.org (ESRP Production)` |
84+
| **PublishPyPI** | Uploads to PyPI via ESRP (`EsrpRelease@12`); requires manual approval | `publishTarget == pypi.org (ESRP Production)` |
85+
86+
> ⚠️ **TestPyPI publishing is currently a no-op.** The `MSAL-Test-Python-Upload`
87+
> service connection has not yet been created (pending a test.pypi.org API
88+
> token), so the `PublishMSALPython` stage prints a skip message rather than
89+
> uploading. Until the SC exists, use the `pypi.org (ESRP Production)` path
90+
> with an RC version (e.g. `1.36.0rc1`) for end-to-end validation.
7891
7992
---
8093

.Pipelines/pipeline-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Publish targets:
77
# test.pypi.org (Preview / RC) — preview releases via MSAL-Test-Python-Upload SC
88
# (SC creation pending test.pypi.org API token)
9-
# pypi.org (ESRP Production) — production releases via ESRP (EsrpRelease@9) using MSAL-ESRP-AME SC
9+
# pypi.org (ESRP Production) — production releases via ESRP (EsrpRelease@12) using MSAL-ESRP-AME SC
1010
#
1111
# For pipeline documentation, see .Pipelines/CI-AND-RELEASE-PIPELINES.md.
1212

@@ -130,10 +130,10 @@ stages:
130130

131131
# ══════════════════════════════════════════════════════════════════════════════
132132
# Stage 4b · Publish to PyPI (ESRP Production)
133-
# Uses EsrpRelease@9 via the MSAL-ESRP-AME service connection.
133+
# Uses EsrpRelease@12 via the MSAL-ESRP-AME service connection.
134134
# IMPORTANT: configure a required manual approval on this environment in
135135
# ADO → Pipelines → Environments → MSAL-Python-Release → Approvals and checks.
136-
# IMPORTANT: EsrpRelease@9 requires a Windows agent.
136+
# IMPORTANT: EsrpRelease@12 requires a Windows agent.
137137
# ══════════════════════════════════════════════════════════════════════════════
138138
- stage: PublishPyPI
139139
displayName: 'Publish to PyPI (ESRP Production)'
Lines changed: 51 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,57 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
1+
# Build verification + unit tests for the msal Python package.
2+
#
3+
# This workflow runs on every PR (against any target branch) to give contributors
4+
# fast feedback that the package still builds and that the unit tests pass across
5+
# all supported Python versions.
6+
#
7+
# Post-merge validation on dev, E2E tests, benchmarks, SDL scans, and PyPI
8+
# publishing are NOT run here. Those run in the ADO pipelines:
9+
# - azure-pipelines.yml (PRs + pushes to dev: unit + E2E + SDL)
10+
# - .Pipelines/pipeline-publish.yml (manual release to TestPyPI / PyPI)
311

4-
name: CI/CD
12+
name: Build and Unit Tests
513

614
on:
7-
push:
815
pull_request:
9-
branches: [ dev ]
10-
11-
# This guards against unknown PR until a community member vet it and label it.
12-
types: [ labeled ]
16+
# No `branches` filter — run on PRs against any target branch.
1317

1418
jobs:
19+
build:
20+
name: Build package (sdist + wheel)
21+
permissions:
22+
contents: read
23+
runs-on: ubuntu-22.04
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: '3.12'
30+
cache: 'pip'
31+
- name: Install build tooling
32+
run: |
33+
python -m pip install --upgrade pip
34+
python -m pip install build twine
35+
- name: Build sdist and wheel
36+
run: python -m build --sdist --wheel --outdir dist/ .
37+
- name: Verify built artifacts
38+
# `twine check` catches broken long_description / metadata that would fail PyPI upload.
39+
run: twine check dist/*
40+
- name: Upload built artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: dist
44+
path: dist/
45+
retention-days: 7
46+
1547
ci:
48+
name: Unit tests Python ${{ matrix.python-version }}
1649
permissions:
1750
contents: read
18-
env:
19-
# Fake a TRAVIS env so that the pre-existing test cases would behave like before
20-
TRAVIS: true
21-
LAB_APP_CLIENT_ID: ${{ secrets.LAB_APP_CLIENT_ID }}
22-
LAB_APP_CLIENT_CERT_BASE64: ${{ secrets.LAB_APP_CLIENT_CERT_BASE64 }}
23-
LAB_APP_CLIENT_CERT_PFX_PATH: lab_cert.pfx
2451

25-
# Derived from https://docs.github.com/en/actions/guides/building-and-testing-python#starting-with-the-python-workflow-template
2652
runs-on: ubuntu-22.04
2753
strategy:
54+
fail-fast: false
2855
matrix:
2956
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
3057

@@ -41,91 +68,15 @@ jobs:
4168
- name: Install dependencies
4269
run: |
4370
python -m pip install --upgrade pip
44-
python -m pip install flake8 pytest
45-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
46-
- name: Populate lab cert.pfx
47-
# https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#storing-base64-binary-blobs-as-secrets
48-
run: echo $LAB_APP_CLIENT_CERT_BASE64 | base64 -d > $LAB_APP_CLIENT_CERT_PFX_PATH
49-
- name: Test with pytest
50-
run: pytest --benchmark-skip
51-
- name: Lint with flake8
52-
run: |
53-
# stop the build if there are Python syntax errors or undefined names
54-
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
55-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
56-
#flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
57-
58-
cb:
59-
# Benchmark only after the correctness has been tested by CI,
60-
# and then run benchmark only once (sampling with only one Python version).
61-
needs: ci
62-
runs-on: ubuntu-latest
63-
permissions:
64-
contents: write
65-
steps:
66-
- uses: actions/checkout@v4
67-
- name: Set up Python 3.9
68-
uses: actions/setup-python@v5
69-
with:
70-
python-version: 3.9
71-
cache: 'pip'
72-
- name: Install dependencies
73-
run: |
74-
python -m pip install --upgrade pip
71+
python -m pip install pytest
7572
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
76-
- name: Setup an updatable cache for Performance Baselines
77-
uses: actions/cache@v4
78-
with:
79-
path: .perf.baseline
80-
key: ${{ runner.os }}-performance-${{ hashFiles('tests/test_benchmark.py') }}
81-
restore-keys: ${{ runner.os }}-performance-
82-
- name: Run benchmark
83-
run: pytest --benchmark-only --benchmark-json benchmark.json --log-cli-level INFO tests/test_benchmark.py
84-
- name: Render benchmark result
85-
uses: benchmark-action/github-action-benchmark@v1
86-
with:
87-
tool: 'pytest'
88-
output-file-path: benchmark.json
89-
fail-on-alert: true
90-
- name: Publish Gibhub Pages
91-
run: git push origin gh-pages
9273
93-
cd:
94-
needs: ci
95-
# Note: github.event.pull_request.draft == false WON'T WORK in "if" statement,
96-
# because the triggered event is a push, not a pull_request.
97-
# This means each commit will trigger a release on TestPyPI.
98-
# Those releases will only succeed when each push has a new version number: a1, a2, a3, etc.
99-
if: |
100-
github.event_name == 'push' &&
101-
(
102-
startsWith(github.ref, 'refs/tags') ||
103-
startsWith(github.ref, 'refs/heads/release-')
104-
)
105-
runs-on: ubuntu-latest
106-
steps:
107-
- uses: actions/checkout@v4
108-
- name: Set up Python 3.9
109-
uses: actions/setup-python@v5
110-
with:
111-
python-version: 3.9
112-
cache: 'pip'
113-
- name: Build a package for release
74+
- name: Run unit tests
75+
# Skip benchmarks and E2E tests — those require lab credentials and run in ADO.
11476
run: |
115-
python -m pip install build --user
116-
python -m build --sdist --wheel --outdir dist/ .
117-
- name: |
118-
Publish to TestPyPI when pushing to release-* branch.
119-
You better test with a1, a2, b1, b2 releases first.
120-
uses: pypa/gh-action-pypi-publish@v1.13.0
121-
if: startsWith(github.ref, 'refs/heads/release-')
122-
with:
123-
user: __token__
124-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
125-
repository_url: https://test.pypi.org/legacy/
126-
- name: Publish to PyPI when tagged
127-
if: startsWith(github.ref, 'refs/tags')
128-
uses: pypa/gh-action-pypi-publish@v1.13.0
129-
with:
130-
user: __token__
131-
password: ${{ secrets.PYPI_API_TOKEN }}
77+
pytest tests/ \
78+
--benchmark-skip \
79+
--ignore=tests/test_e2e.py \
80+
--ignore=tests/test_e2e_manual.py \
81+
--ignore=tests/test_fmi_e2e.py \
82+
--ignore=tests/test_client_obtain_token_by_browser.py

0 commit comments

Comments
 (0)