-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
119 lines (108 loc) · 3.67 KB
/
Copy pathazure-pipelines.yml
File metadata and controls
119 lines (108 loc) · 3.67 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
# Azure Pipelines CI for scalar-cluster
#
# Trigger a build when there is a push to the main branch or a tag starts with release-
trigger:
branches:
include:
- main
tags:
include:
- release-*
# Trigger a build when there is a pull request to the main branch
# Ignore PRs that are just updating the docs
pr:
branches:
include:
- main
exclude:
- docs/*
- README.rst
parameters:
- name: includeReleaseCandidates
displayName: "Allow pre-release dependencies"
type: boolean
default: false
variables:
triggeredByPullRequest: $[eq(variables['Build.Reason'], 'PullRequest')]
stages:
- stage: RunAllTests
displayName: Run test suite
jobs:
- job: Tests
timeoutInMinutes: 60
pool:
vmImage: $(imageName)
workspace:
clean: all
strategy:
matrix:
linux_py39:
imageName: 'ubuntu-latest'
python.version: '3.9'
linux_py310:
imageName: 'ubuntu-latest'
python.version: '3.10'
linux_py311:
imageName: 'ubuntu-latest'
python.version: '3.11'
linux_py312:
imageName: 'ubuntu-latest'
python.version: '3.12'
windows_py310:
imageName: 'windows-latest'
python.version: '3.10'
windows_py312:
imageName: 'windows-latest'
python.version: '3.12'
mac_py310:
imageName: 'macOS-latest'
python.version: '3.10'
mac_py312:
imageName: 'macOS-latest'
python.version: '3.12'
steps:
- template: .azure/templates/run-tests.yml
parameters:
includeReleaseCandidates: ${{ parameters.includeReleaseCandidates }}
- stage: BuildPublishArtifact
dependsOn: RunAllTests
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/release-'), eq(variables.triggeredByPullRequest, false))
jobs:
- job: BuildArtifacts
timeoutInMinutes: 60
displayName: Build source dists and wheels
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
displayName: 'Use Python 3.10'
- script: |
python -m pip install --upgrade pip
python -m pip install -U uv
uv sync --python "$(python -c 'import sys; print(sys.executable)')"
displayName: 'Install dependencies'
- script: |
uv build --no-sources --sdist --wheel
displayName: 'Build package'
- bash: |
export PACKAGE_VERSION="$(uv version --short)"
echo "Package Version: ${PACKAGE_VERSION}"
echo "##vso[task.setvariable variable=packageVersionFormatted;]release-${PACKAGE_VERSION}"
displayName: 'Get package version'
- script: |
echo "Version in git tag $(Build.SourceBranchName) does not match version derived from setup.py $(packageVersionFormatted)"
exit 1
displayName: Raise error if version doesnt match tag
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], variables['packageVersionFormatted']))
- task: DownloadSecureFile@1
name: PYPIRC_CONFIG
displayName: 'Download pypirc'
inputs:
secureFile: 'pypirc'
- script: |
uvx twine check dist/*
uvx twine upload --repository pypi --config-file $(PYPIRC_CONFIG.secureFilePath) dist/*
displayName: 'Upload to PyPI'
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['packageVersionFormatted']))