-
Notifications
You must be signed in to change notification settings - Fork 22
137 lines (131 loc) · 4.08 KB
/
ci.yml
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
name: Build + Deploy
on:
push:
branches: [master]
tags: ["*"]
pull_request:
branches: [master]
env:
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, windows-latest]
arch: [auto64]
include:
- os: macos-latest
arch: universal2
- os: windows-latest
arch: x86
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: pip install cibuildwheel
- name: Build and Test Wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
name: unicodedata2-${{ matrix.os }}-${{ matrix.arch }}
path: wheelhouse/*.whl
build_aarch64_wheels:
runs-on: ubuntu-latest
strategy:
matrix:
# aarch64 uses qemu so it's slow, build each py version in parallel jobs
python: [37, 38, 39, 310]
arch: [aarch64]
env:
CIBW_BUILD: cp${{ matrix.python }}-*
CIBW_ARCHS: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: docker/setup-qemu-action@v1.2.0
with:
platforms: all
- name: Install dependencies
run: pip install cibuildwheel
- name: Build and Test Wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
name: unicodedata2-${{ matrix.python }}-linux-${{ 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, build_aarch64_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine
- name: Download artifacts from build jobs
uses: actions/download-artifact@v2
with:
path: wheelhouse/
- name: Move wheels to dist/ directory
run: |
ls wheelhouse/*
mkdir -p dist/
for wheel_dir in wheelhouse/unicodedata2*/; do
mv "${wheel_dir}"/*.whl dist/
done
- name: Extract release notes from annotated tag message
id: release_notes
run: |
# GH checkout action doesn't preserve tag annotations, we must fetch them
# https://github.com/actions/checkout/issues/290
git fetch --tags --force
# strip leading 'refs/tags/' to get the tag name
TAG_NAME="${GITHUB_REF##*/}"
# Dump tag message to temporary .md file (excluding the PGP signature at the bottom)
TAG_MESSAGE=$(git tag -l --format='%(contents)' $TAG_NAME | sed -n '/-----BEGIN PGP SIGNATURE-----/q;p')
echo "$TAG_MESSAGE" > "${{ runner.temp }}/release_notes.md"
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: "${{ runner.temp }}/release_notes.md"
draft: false
prerelease: false
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist
twine upload dist/*