Repository navigation
123 lines (119 loc) · 3.99 KB
/
Copy pathci.yml
File metadata and controls
123 lines (119 loc) · 3.99 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
name: Build + Deploy
on:
push:
branches: [master]
tags: ["*"]
pull_request:
branches: [master]
env:
# cibuildwheel 3.0 moved PyPy into an opt-in "enable group", which silently
# dropped the PyPy wheels this project had shipped up to 16.0.0 (17.0.0 and
# 17.0.1 published none). Ask for them back explicitly.
CIBW_ENABLE: pypy
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014
CIBW_TEST_EXTRAS: testing
CIBW_TEST_COMMAND: pytest {project}/tests
jobs:
build_wheels:
runs-on: ${{ matrix.os }}
env:
CIBW_ARCHS: ${{ matrix.arch }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, ubuntu-24.04-arm, windows-11-arm, windows-latest]
arch: [auto64]
include:
- os: macos-latest
arch: universal2
- os: windows-latest
arch: x86
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up Python 3.x
uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: Install dependencies
run: pip install cibuildwheel
- name: Download normalization test data
run: python tests/download_test_data.py
- name: Build and Test Wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v7
with:
name: unicodedata2-${{ matrix.os }}-${{ matrix.arch }}
path: wheelhouse/*.whl
deploy:
# only run if the commit is tagged...
if: github.ref_type == 'tag'
# ... and all build jobs completed successfully
needs: [build_wheels]
runs-on: ubuntu-latest
environment:
name: publish-to-pypi
url: https://pypi.org/p/unicodedata2
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
contents: write # Needed to create GH release
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build
- name: Check the tag matches the package version
env:
TAG_NAME: ${{ github.ref_name }}
run: |
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
if [ "$TAG_NAME" != "$VERSION" ]; then
echo "::error::tag '$TAG_NAME' does not match project version '$VERSION'"
exit 1
fi
- name: Download wheels from build jobs
uses: actions/download-artifact@v8
with:
merge-multiple: true
path: dist/
- name: Build sdist
run: python -m build --sdist
- name: Extract release notes from annotated tag message
env:
TAG_NAME: ${{ github.ref_name }}
run: |
# GH checkout action doesn't preserve tag annotations, we must fetch them
# https://github.com/actions/checkout/issues/290
git fetch --tags --force
# Dump tag message to a temporary .md file, minus any PGP signature
git tag -l --format='%(contents)' "$TAG_NAME" \
| sed -n '/-----BEGIN PGP SIGNATURE-----/q;p' \
> "${{ runner.temp }}/release_notes.md"
- name: Create GitHub release
env:
# This token is provided by Actions, you do not need to create your own token
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
run: |
ls -l dist/
case "$TAG_NAME" in
*[ab][0-9]*|*rc[0-9]*|*dev[0-9]*) PRERELEASE=--prerelease ;;
*) PRERELEASE= ;;
esac
gh release create "$TAG_NAME" --title "$TAG_NAME" $PRERELEASE \
--notes-file "${{ runner.temp }}/release_notes.md"
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1