Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support setup helpers #60

Merged
merged 7 commits into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 7 additions & 27 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,17 @@ environment:
matrix:
- PYTHON: 27
- PYTHON: 36
- CONDA: 27
- CONDA: 36
install:
- cmd: '"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %PLATFORM%'
- ps: |
if ($env:PYTHON) {
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
python -m pip install --disable-pip-version-check --user --upgrade pip setuptools
} elseif ($env:CONDA) {
if ($env:CONDA -eq "27") { $env:CONDA = "" }
if ($env:PLATFORM -eq "x64") { $env:CONDA = "$env:CONDA-x64" }
$env:PATH = "C:\Miniconda$env:CONDA\;C:\Miniconda$env:CONDA\Scripts\;$env:PATH"
conda config --set always_yes yes --set changeps1 no
conda config --add channels conda-forge
conda update -q conda
conda install -q conda-build
}
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
python -m pip install --disable-pip-version-check --upgrade --no-warn-script-location pip setuptools
build_script:
- ps: |
if ($env:PYTHON) {
python setup.py sdist
python -m pip install 'pybind11>=2.3'
cd dist
python -m pip install --verbose python_example-0.0.1.tar.gz
cd ..
} else {
echo "conda build conda.recipe"
conda build conda.recipe
echo "conda install --use-local python_example"
conda install --use-local python_example
}
python setup.py sdist
cd dist
python -m pip install --verbose python_example-0.0.1.tar.gz
cd ..
test_script:
- ps: python tests\test.py
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
ignore:
# Offical actions have moving tags like v1
# that are used, so they don't need updates here
- dependency-name: "actions/*"
45 changes: 45 additions & 0 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Conda

on:
workflow_dispatch:
push:
branches:
- master
pull_request:

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.6", "3.8"]

runs-on: ${{ matrix.platform }}

# The setup-miniconda action needs this to activate miniconda
defaults:
run:
shell: "bash -l {0}"

steps:
- uses: actions/checkout@v2

- name: Get conda
uses: conda-incubator/[email protected]
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: strict

- name: Prepare
run: conda install conda-build conda-verify

- name: Build
run: conda build conda.recipe

- name: Install
run: conda install -c ${CONDA_PREFIX}/conda-bld/ python_example

- name: Test
run: python tests/test.py
50 changes: 50 additions & 0 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Pip

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["2.7", "3.5", "3.8", "3.9"]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Add requirements
run: python -m pip install --upgrade wheel setuptools

# Eventually Microsoft might have an action for setting up
# MSVC, but for now, this action works:
- name: Prepare compiler environment for Windows 🐍 2.7
if: matrix.python-version == 2.7 && runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

# This makes two environment variables available in the following step(s)
- name: Set Windows 🐍 2.7 environment variables
if: matrix.python-version == 2.7 && runner.os == 'Windows'
shell: bash
run: |
echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
echo "MSSdk=1" >> $GITHUB_ENV

- name: Build and install
run: pip install --verbose .

- name: Test
run: python tests/test.py
143 changes: 143 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Wheels

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
release:
types:
- published

env:
CIBW_TEST_COMMAND: python {project}/tests/test.py
# This can be removed if pyproject.toml is used
CIBW_BEFORE_BUILD: pip install pybind11


jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2

- name: Install deps
run: python -m pip install "setuptools>=42" "setuptools_scm[toml]>=4.1.0" twine

- name: Build SDist
run: python setup.py sdist

- name: Check metadata
run: twine check dist/*

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz


build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.6.3

- name: Build wheel
run: python -m cibuildwheel --output-dir wheelhouse
env:
# Python 2.7 on Windows requires a workaround for C++11 support,
# built separately below
CIBW_SKIP: cp27-win*

- name: Show files
run: ls -lh wheelhouse
shell: bash

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl


# Windows 2.7 (requires workaround for MSVC 2008 replacement)
build_win27_wheels:
name: Py 2.7 wheels on Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v1
with:
submodules: true

- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.6.3

- uses: ilammy/msvc-dev-cmd@v1

- name: Build 64-bit wheel
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp27-win_amd64
DISTUTILS_USE_SDK: 1
MSSdk: 1

- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86

- name: Build 32-bit wheel
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp27-win32
DISTUTILS_USE_SDK: 1
MSSdk: 1

- name: Show files
run: ls -lh wheelhouse
shell: bash

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl


upload_all:
name: Upload if release
needs: [build_wheels, build_win27_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/setup-python@v2

- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
Loading