Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #81 from dwavesystems/dev
Browse files Browse the repository at this point in the history
Merge in dev for 0.2 to pypi deployment
  • Loading branch information
adam-douglass authored Nov 10, 2017
2 parents 3ca8a3c + 16b3851 commit 95790a3
Show file tree
Hide file tree
Showing 50 changed files with 2,627 additions and 926 deletions.
108 changes: 108 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# clone directory
clone_folder: C:\projects\qbsolv

environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C %APPVEYOR_BUILD_FOLDER%\\ci\\appveyor\\run_with_env.cmd"

# PyPI login
username: dwtools
password:
secure: G0CMe8ljy4PrXAaB1nR76A==

matrix:
# Python < 2.7 is not supported by dimod
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python36"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x"
PYTHON_ARCH: "64"

install:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
- ECHO "Filesystem root:"
- ps: "ls \"C:/\""

- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""

# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
- ps: if (-not(Test-Path($env:PYTHON))) { & ci\appveyor\install.ps1 }

# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"

# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""

# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "pip install --disable-pip-version-check --user --upgrade pip"

# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%CMD_IN_ENV% pip install -r python/requirements.txt"
- "%CMD_IN_ENV% pip install wheel setuptools --upgrade --force"

build_script:
# Build the compiled extension
- cd python
- "%CMD_IN_ENV% python setup.py bdist_wheel"
- cd ..
- pip install dwave_qbsolv --no-index -f python\\dist\\

test_script:
# Run the project tests
- python -m unittest discover

after_test:
# If tests are successful, create binary packages for the project.
#- "%CMD_IN_ENV% python setup.py bdist_wininst"
#- "%CMD_IN_ENV% python setup.py bdist_msi"
- ps: "ls python\\dist"

artifacts:
# Archive the generated packages in the ci.appveyor.com build report.
- path: python\dist\*

deploy_script:
- "echo [pypi] > %USERPROFILE%\\.pypirc"
- "echo username: %username% >> %USERPROFILE%\\.pypirc"
- "echo password: %password% >> %USERPROFILE%\\.pypirc"
- "%CMD_IN_ENV% pip install twine"
- ps: If ($env:APPVEYOR_REPO_TAG -eq "true") { Invoke-Expression "%CMD_IN_ENV% twine upload python\dist\*" 2>$null } Else { write-output "Not on a tag on master, won't deploy to pypi"}
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,26 @@ qbsolv
*.exe
*.gch
*.stackdump
*.m~

# Test coverage files
*.gcno*
*.gcda*

*.sublime-project
*.sublime-workspace

venv/
build/

scratch.py

python/build
python/dwave_qbsolv/qbsolv_binding.c
python/dwave_qbsolv/qbsolv_binding.cpp
python/dwave_qbsolv.egg-info/*

*.whl
*.so

dist/
76 changes: 76 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
sudo: false
language: python
os: linux

env:
global:
- TWINE_USERNAME=dwtools
- secure: "pvWM1Newi4AQPDh3KOrhlOSNoxHW2HBMG1Sd20s7voeGY097ESdXcJzh3EH3la8c6SlP6jyKWlm1NvoEAGt2gF1F0ME3flX6QAne0I14FdjFnmzVmvhC5/9jN3y97uN4yKvtdnFKqM3sI5BwMQW30fmxc+0xI3SlUTXdSUjEdR/cIPflynP8poTwNHLe+RpaFalCqJygBHBzgvatIK6kZMpiu4IhJWecQPeIR8Mx/srclYhGn+/IJP7EFTUz5ijRX1Oz4npWVs2FiVLmR46rKThpeAEqj6ZE1K4Qc6mj0+Wkd9w0qusq1zdZeUfJtIRl1S3PSdm6432kuE+eAlTs5bahw1Ha1VDuR+rOfhkEIkm/ucl5/Sh/3e604sVvggEadMuVl5NTCAClnkA5uU+GQKpvSoUGblgCMxhUCsLWSNMYV03qaPTK10OBOcD0lYkUIqCVQ5WDw9yBEsAIjO1WXC4NyP3PbVlkgTiWKaWattvmE+cqZ22Z7/nolxPySlf4ZIbTp94YOjiAB83g/Bf+7k7wJpo3Ag1eA4B20k7nDuoNFf7VdUeZCJx5PbkSs5Q40swkI3AZudJ6au36XsPtl9vpidPuJ8F6cL9A1QyIRCB59he7AJck2lcjwU81QWMphBQT1mBKaR9FBqcd1Dje+/2oQ7dYw8L4iKjrKFvFzTE="

matrix:
include:
- language: c
script: ./ci/travis/cpp-coverage.sh
deploy:
env: C_COMPILER=gcc CXX_COMPILER=g++
- language: c
script: ./ci/travis/cpp-coverage.sh
deploy:
env: C_COMPILER=clang CXX_COMPILER=clang++
- language: c
os: osx
script: ./ci/travis/osx-cpp-coverage.sh
deploy:
env: C_COMPILER=gcc CXX_COMPILER=g++
- language: c
os: osx
script: ./ci/travis/osx-cpp-coverage.sh
deploy:
env: C_COMPILER=clang CXX_COMPILER=clang++
- language: python
sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
- language: python
sudo: required
services:
- docker
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_i686
PRE_CMD=linux32
- os: osx
language: generic
before_install:
- brew update
- virtualenv env -p python2
- source env/bin/activate
script: ./ci/travis/osx-build-wheel.sh
- os: osx
language: generic
before_install:
- brew update
- brew install python3
- virtualenv env -p python3
- source env/bin/activate
script: ./ci/travis/osx-build-wheel.sh
# - os: osx
# language: generic
# env: TOXENV=pynightly

addons:
apt:
packages:
- libgtest-dev

script:
- docker pull $DOCKER_IMAGE
- docker run --rm -v `pwd`:/io $DOCKER_IMAGE $PRE_CMD /io/ci/travis/build-wheels.sh
- ls wheelhouse/

deploy:
provider: script
script: ci/travis/upload-wheels.sh
skip_cleanup: true
on:
tags: true
branch: master
42 changes: 42 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.0)

project(qbsolv)
# set(VERSION_MAJOR 2)
# set(VERSION_MINOR 5)
# set(VERSION_PATCH 0)

option(QBSOLV_BUILD_CMD "Build compiled command line interface." ON)
option(QBSOLV_BUILD_TESTS "Build c library unit tests." ON)

# Set compiler flags for gcc
if(CMAKE_C_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=gnu99")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_C_FLAGS_RELEASE "-O3")
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=gnu++11")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif()

# location of header files
include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/include)

# static library
add_library(libqbsolv STATIC src/solver.cc src/util.cc src/dwsolv.cc)
set_target_properties(libqbsolv PROPERTIES PREFIX "")

if(QBSOLV_BUILD_CMD)
# compile main executable
add_executable(qbsolv cmd/main.c cmd/readqubo.c)

# link library
target_link_libraries(qbsolv libqbsolv)
endif()

if(QBSOLV_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
Loading

0 comments on commit 95790a3

Please sign in to comment.