Skip to content

Commit 2c99526

Browse files
authored
feat: support setup helpers (#60)
* feat: support setup helpers * feat: update to pybind11 2.6.0b1 * feat: bump to 2.6.0rc3 * chore: bump to 2.6.0 * ci: full release string * ci: dependabot * fix: conda-forge channel needed for 2.6.0
1 parent 4a08067 commit 2c99526

13 files changed

+492
-180
lines changed

.appveyor.yml

+7-27
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,17 @@ environment:
1111
matrix:
1212
- PYTHON: 27
1313
- PYTHON: 36
14-
- CONDA: 27
15-
- CONDA: 36
1614
install:
1715
- cmd: '"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %PLATFORM%'
1816
- ps: |
19-
if ($env:PYTHON) {
20-
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
21-
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
22-
python -m pip install --disable-pip-version-check --user --upgrade pip setuptools
23-
} elseif ($env:CONDA) {
24-
if ($env:CONDA -eq "27") { $env:CONDA = "" }
25-
if ($env:PLATFORM -eq "x64") { $env:CONDA = "$env:CONDA-x64" }
26-
$env:PATH = "C:\Miniconda$env:CONDA\;C:\Miniconda$env:CONDA\Scripts\;$env:PATH"
27-
conda config --set always_yes yes --set changeps1 no
28-
conda config --add channels conda-forge
29-
conda update -q conda
30-
conda install -q conda-build
31-
}
17+
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
18+
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
19+
python -m pip install --disable-pip-version-check --upgrade --no-warn-script-location pip setuptools
3220
build_script:
3321
- ps: |
34-
if ($env:PYTHON) {
35-
python setup.py sdist
36-
python -m pip install 'pybind11>=2.3'
37-
cd dist
38-
python -m pip install --verbose python_example-0.0.1.tar.gz
39-
cd ..
40-
} else {
41-
echo "conda build conda.recipe"
42-
conda build conda.recipe
43-
echo "conda install --use-local python_example"
44-
conda install --use-local python_example
45-
}
22+
python setup.py sdist
23+
cd dist
24+
python -m pip install --verbose python_example-0.0.1.tar.gz
25+
cd ..
4626
test_script:
4727
- ps: python tests\test.py

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
ignore:
9+
# Offical actions have moving tags like v1
10+
# that are used, so they don't need updates here
11+
- dependency-name: "actions/*"

.github/workflows/conda.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Conda
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
platform: [ubuntu-latest, windows-latest, macos-latest]
16+
python-version: ["3.6", "3.8"]
17+
18+
runs-on: ${{ matrix.platform }}
19+
20+
# The setup-miniconda action needs this to activate miniconda
21+
defaults:
22+
run:
23+
shell: "bash -l {0}"
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Get conda
29+
uses: conda-incubator/[email protected]
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
channels: conda-forge,defaults
33+
channel-priority: strict
34+
35+
- name: Prepare
36+
run: conda install conda-build conda-verify
37+
38+
- name: Build
39+
run: conda build conda.recipe
40+
41+
- name: Install
42+
run: conda install -c ${CONDA_PREFIX}/conda-bld/ python_example
43+
44+
- name: Test
45+
run: python tests/test.py

.github/workflows/pip.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Pip
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
build:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
platform: [windows-latest, macos-latest, ubuntu-latest]
16+
python-version: ["2.7", "3.5", "3.8", "3.9"]
17+
18+
runs-on: ${{ matrix.platform }}
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Add requirements
28+
run: python -m pip install --upgrade wheel setuptools
29+
30+
# Eventually Microsoft might have an action for setting up
31+
# MSVC, but for now, this action works:
32+
- name: Prepare compiler environment for Windows 🐍 2.7
33+
if: matrix.python-version == 2.7 && runner.os == 'Windows'
34+
uses: ilammy/msvc-dev-cmd@v1
35+
with:
36+
arch: x64
37+
38+
# This makes two environment variables available in the following step(s)
39+
- name: Set Windows 🐍 2.7 environment variables
40+
if: matrix.python-version == 2.7 && runner.os == 'Windows'
41+
shell: bash
42+
run: |
43+
echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
44+
echo "MSSdk=1" >> $GITHUB_ENV
45+
46+
- name: Build and install
47+
run: pip install --verbose .
48+
49+
- name: Test
50+
run: python tests/test.py

.github/workflows/wheels.yml

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Wheels
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
release:
10+
types:
11+
- published
12+
13+
env:
14+
CIBW_TEST_COMMAND: python {project}/tests/test.py
15+
# This can be removed if pyproject.toml is used
16+
CIBW_BEFORE_BUILD: pip install pybind11
17+
18+
19+
jobs:
20+
build_sdist:
21+
name: Build SDist
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
- uses: actions/setup-python@v2
26+
27+
- name: Install deps
28+
run: python -m pip install "setuptools>=42" "setuptools_scm[toml]>=4.1.0" twine
29+
30+
- name: Build SDist
31+
run: python setup.py sdist
32+
33+
- name: Check metadata
34+
run: twine check dist/*
35+
36+
- uses: actions/upload-artifact@v2
37+
with:
38+
path: dist/*.tar.gz
39+
40+
41+
build_wheels:
42+
name: Wheels on ${{ matrix.os }}
43+
runs-on: ${{ matrix.os }}
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
os: [ubuntu-latest, windows-latest, macos-latest]
48+
49+
steps:
50+
- uses: actions/checkout@v2
51+
52+
- uses: actions/setup-python@v2
53+
54+
- name: Install cibuildwheel
55+
run: python -m pip install cibuildwheel==1.6.3
56+
57+
- name: Build wheel
58+
run: python -m cibuildwheel --output-dir wheelhouse
59+
env:
60+
# Python 2.7 on Windows requires a workaround for C++11 support,
61+
# built separately below
62+
CIBW_SKIP: cp27-win*
63+
64+
- name: Show files
65+
run: ls -lh wheelhouse
66+
shell: bash
67+
68+
- name: Verify clean directory
69+
run: git diff --exit-code
70+
shell: bash
71+
72+
- name: Upload wheels
73+
uses: actions/upload-artifact@v2
74+
with:
75+
path: wheelhouse/*.whl
76+
77+
78+
# Windows 2.7 (requires workaround for MSVC 2008 replacement)
79+
build_win27_wheels:
80+
name: Py 2.7 wheels on Windows
81+
runs-on: windows-latest
82+
83+
steps:
84+
- uses: actions/checkout@v1
85+
with:
86+
submodules: true
87+
88+
- uses: actions/setup-python@v2
89+
90+
- name: Install cibuildwheel
91+
run: python -m pip install cibuildwheel==1.6.3
92+
93+
- uses: ilammy/msvc-dev-cmd@v1
94+
95+
- name: Build 64-bit wheel
96+
run: python -m cibuildwheel --output-dir wheelhouse
97+
env:
98+
CIBW_BUILD: cp27-win_amd64
99+
DISTUTILS_USE_SDK: 1
100+
MSSdk: 1
101+
102+
- uses: ilammy/msvc-dev-cmd@v1
103+
with:
104+
arch: x86
105+
106+
- name: Build 32-bit wheel
107+
run: python -m cibuildwheel --output-dir wheelhouse
108+
env:
109+
CIBW_BUILD: cp27-win32
110+
DISTUTILS_USE_SDK: 1
111+
MSSdk: 1
112+
113+
- name: Show files
114+
run: ls -lh wheelhouse
115+
shell: bash
116+
117+
- name: Verify clean directory
118+
run: git diff --exit-code
119+
shell: bash
120+
121+
- uses: actions/upload-artifact@v2
122+
with:
123+
path: wheelhouse/*.whl
124+
125+
126+
upload_all:
127+
name: Upload if release
128+
needs: [build_wheels, build_win27_wheels, build_sdist]
129+
runs-on: ubuntu-latest
130+
if: github.event_name == 'release' && github.event.action == 'published'
131+
132+
steps:
133+
- uses: actions/setup-python@v2
134+
135+
- uses: actions/download-artifact@v2
136+
with:
137+
name: artifact
138+
path: dist
139+
140+
- uses: pypa/[email protected]
141+
with:
142+
user: __token__
143+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)