-
Notifications
You must be signed in to change notification settings - Fork 61
171 lines (150 loc) · 5.18 KB
/
python-compatibility.yml
File metadata and controls
171 lines (150 loc) · 5.18 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Python Compatibility Testing Workflow
#
# Tests Python package build compatibility across:
# - Operating Systems: Ubuntu, macOS, Windows
# - Python Versions: 3.9, 3.10, 3.11, 3.12, 3.13
#
# Validates that the package can be built and installed correctly
# on all supported platforms and Python versions.
name: Python Compatibility Check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
pull_request:
env:
# Change this to invalidate existing cache.
CACHE_PREFIX: v0
PYTHON_PATH: ./
permissions:
contents: read
jobs:
checks:
name: Python ${{ matrix.python }} - ${{ matrix.os }} - ${{ matrix.task.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
task:
- name: Build
run: |
pip list
pip install twine
pip install --upgrade setuptools wheel
pip list
python setup.py check
python setup.py bdist_wheel sdist
twine check ./dist/*
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Install prerequisites
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Set build variables
shell: bash
run: |
echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_ENV
- name: Test dependency wheels availability - Unix/Linux/macOS
if: runner.os != 'Windows'
run: |
python -m venv .venv-deps-test
. .venv-deps-test/bin/activate
# Try installing with wheel-only first to catch dependency conflicts early
pip install --only-binary=:all: -r requirements.txt || {
echo "Warning: Some dependencies may not have wheels available"
echo "Attempting installation with source packages allowed..."
pip install -r requirements.txt
}
deactivate
rm -rf .venv-deps-test
shell: bash
- name: Test dependency wheels availability - Windows
if: runner.os == 'Windows'
run: |
python -m venv .venv-deps-test
.venv-deps-test\Scripts\Activate.ps1
# Try installing with wheel-only first to catch dependency conflicts early
pip install --only-binary=:all: -r requirements.txt
if ($LASTEXITCODE -ne 0) {
Write-Host "Warning: Some dependencies may not have wheels available"
Write-Host "Attempting installation with source packages allowed..."
pip install -r requirements.txt
}
deactivate
Remove-Item -Recurse -Force .venv-deps-test
shell: pwsh
- name: Setup virtual environment - Unix/Linux/macOS
if: runner.os != 'Windows'
run: |
python -m venv .venv
. .venv/bin/activate
pip install -e .[dev]
shell: bash
- name: Setup virtual environment - Windows
if: runner.os == 'Windows'
run: |
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -e .[dev]
shell: pwsh
- name: Show environment info - Unix/Linux/macOS
if: runner.os != 'Windows'
run: |
. .venv/bin/activate
which python
python --version
pip freeze
# Node.js version info - uncomment if you need to verify Node.js/npm/pnpm versions
# which node
# node --version
# npm --version
# pnpm --version
shell: bash
- name: Show environment info - Windows
if: runner.os == 'Windows'
run: |
.venv\Scripts\Activate.ps1
Get-Command python
python --version
pip freeze
# Node.js version info - uncomment if you need to verify Node.js/npm/pnpm versions
# Get-Command node
# node --version
# npm --version
# pnpm --version
shell: pwsh
# Web build steps - tests TypeScript/web components compilation and bundling
# Uncomment if you need to verify that web components work with your Python package changes
# - name: Build Web
# run: |
# pnpm build:typespec
# pnpm build:web
# pnpm bundle
# env:
# CI: false
# TypeSpec emitter testing - tests the TypeSpec-to-code generation functionality
# Uncomment if you need to verify TypeSpec emitter compatibility with your Python changes
# - name: Test Typespec-aaz Emitter
# run: |
# pnpm test-aaz-emitter
- name: ${{ matrix.task.name }} - Unix/Linux/macOS
if: runner.os != 'Windows'
run: |
. .venv/bin/activate
${{ matrix.task.run }}
shell: bash
- name: ${{ matrix.task.name }} - Windows
if: runner.os == 'Windows'
run: |
.venv\Scripts\Activate.ps1
${{ matrix.task.run }}
shell: pwsh