-
Notifications
You must be signed in to change notification settings - Fork 3
171 lines (147 loc) · 5.79 KB
/
python-wheel-vcpkg.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
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
171
name: Python Wheels (vcpkg build)
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
build_wheels:
name: ${{ github.workflow }} Python build wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Free disk space
shell: bash
run: |
if [ "${RUNNER_OS}" == "Linux" ]; then
df -h
echo "Cleaning..."
[ -e "/usr/share/dotnet" ] && sudo rm -rf "/usr/share/dotnet"
[ -e "/opt/ghc" ] && sudo rm -rf "/opt/ghc"
[ -e "/usr/local/share/boost" ] && sudo rm -rf "/usr/local/share/boost"
[ -e "${AGENT_TOOLSDIRECTORY}" ] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}"
echo "Cleaning...done."
df -h
fi
- name: Install OS tools
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install autoconf automake libtool
fi
- name: Install cmake and ninja (via get-cmake)
uses: lukka/get-cmake@latest
- name: Restore artifacts, or setup vcpkg for building artifacts
shell: bash
uses: lukka/run-vcpkg@v11
with:
# This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch.
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
# The Git commit id of vcpkg to be checked out. This is only needed because we are not using a submodule.
vcpkgGitCommitId: "c8696863d371ab7f46e213d8f5ca923c4aef2a00"
# The vcpkg.json file, which will be part of cache key computation.
vcpkgJsonGlob: '**/vcpkg.json'
id: runvcpkg
- name: Prints output of run-vcpkg's action.
shell: bash
run: |
echo "VCPKG_ROOT=${VCPKG_ROOT}"
echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install cibuildwheel
shell: bash
run: |
python -m pip install cibuildwheel==2.16.2
if [ "${RUNNER_OS}" == "Linux" ]; then
df -h
fi
- name: Build wheels
shell: bash
run: |
echo "VCPKG_ROOT=${VCPKG_ROOT}"
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ENVIRONMENT_LINUX: "CMAKE_FETCH_VCPKG=ON"
# vcpkg does not support i686 nor aarch64
CIBW_ARCHS: "auto64"
# Skip musllinux builds
CIBW_SKIP: "*-musllinux_*"
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
# Don't repair macOS wheels
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install cmake"
CIBW_BEFORE_BUILD_LINUX: "df -h"
CIBW_BEFORE_ALL_LINUX: "/usr/bin/yum install --assumeyes --verbose zip unzip tar cmake"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
# Run the package tests using `pytest`
CIBW_TEST_COMMAND: "python -m pyemblite.test -fv"
- uses: actions/upload-artifact@v4
with:
# name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
retention-days: 10
build_sdist:
name: Build python sdist
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- uses: lukka/get-cmake@latest
name: Install cmake and ninja (via get-cmake)
- name: Restore artifacts, or setup vcpkg for building artifacts
uses: lukka/run-vcpkg@v11
with:
# This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch.
vcpkgDirectory: '${{ runner.workspace }}/vcpkg'
# The Git commit id of vcpkg to be checked out. This is only needed because we are not using a submodule.
vcpkgGitCommitId: "c8696863d371ab7f46e213d8f5ca923c4aef2a00"
# The vcpkg.json file, which will be part of cache key computation.
vcpkgJsonGlob: '**/vcpkg.json'
id: runvcpkg
- name: Prints output of run-vcpkg's action.
run: |
echo "VCPKG_ROOT=${VCPKG_ROOT}"
echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install sdist build dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install "Cython" "numpy" "wheel" "setuptools>=42" "versioneer[toml]" "scikit-build" "cmake" "ninja"
- name: Create python sdist
run: python setup.py sdist --formats=gztar,zip
- name: Upload python sdist
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: ./dist/*
release:
name: Make a Release
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download python sdist and wheels
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: ./release_artifacts/
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ./release_artifacts/*