Repository navigation
77 lines (73 loc) · 2.7 KB
/
Copy pathpython-ci.yml
File metadata and controls
77 lines (73 loc) · 2.7 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
name: Validate
on:
push:
branches: [main]
pull_request:
workflow_call:
permissions:
contents: read
jobs:
python:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.11', '3.12', '3.13', '3.14']
env:
PYTHONPATH: src
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python -m pip install segno pytest pytest-asyncio ruff mypy
- run: ruff check .
- run: ruff format --check .
- run: mypy
- run: pytest -m 'not native'
- run: git diff --check
wheels:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-14, macos-15-intel]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.14'
- uses: actions/setup-go@v5
with:
go-version: '1.27.1'
cache-dependency-path: native/go.sum
- run: python -m pip install build twine pytest pytest-asyncio
- if: runner.os == 'Windows' || runner.os == 'Linux'
run: python -m pip install ziglang==0.16.0
- if: runner.os == 'Windows'
shell: pwsh
run: '"CC=python-zig cc" | Out-File -FilePath $env:GITHUB_ENV -Append'
- if: runner.os == 'Linux'
run: echo 'CC=python-zig cc -target x86_64-linux-gnu.2.17' >> "$GITHUB_ENV"
- run: go -C native test ./...
- run: go -C native vet ./...
- if: runner.os == 'Linux'
run: go -C native test -race ./...
- run: python scripts/build_native.py
- run: python scripts/collect_licenses.py
- run: python -m build --wheel
- if: runner.os == 'Linux'
run: |
python -m pip install auditwheel patchelf
auditwheel repair --plat manylinux_2_17_x86_64 dist/*.whl -w wheelhouse
- if: runner.os != 'Linux'
run: python -c "import pathlib,shutil; pathlib.Path('wheelhouse').mkdir(exist_ok=True); [shutil.copy(p,'wheelhouse') for p in pathlib.Path('dist').glob('*.whl')]"
- run: python -m twine check wheelhouse/*
- run: python -c "import pathlib,subprocess,sys; subprocess.run([sys.executable,'-m','pip','install',str(next(pathlib.Path('wheelhouse').glob('*.whl')))],check=True)"
- run: python -I -c "from whatsapp_bridge import WhatsAppClient; from whatsapp_bridge._backend.native import NativeBackend; NativeBackend._load(); print('Installed wheel and native ABI loaded')"
- run: pytest
- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}
path: wheelhouse/*.whl
if-no-files-found: error