Skip to content
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
176 changes: 156 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,167 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/configuration-reference
version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/jobs-steps/#jobs-overview & https://circleci.com/docs/configuration-reference/#jobs
orbs:
win: circleci/windows@5.0.0
macos: circleci/macos@2.4.1

commands:
run-cibuildwheel:
parameters:
cibw-version:
type: string
default: 2.17.0
steps:
- run:
name: run cibuildwheel
shell: bash -eo pipefail
command: |
if [[ $OS == Windows_NT ]]; then
python -m pip install --user cibuildwheel==<< parameters.cibw-version >>
python -m cibuildwheel --output-dir dist
else
python3 -m pip install --user cibuildwheel==<< parameters.cibw-version >>
python3 -m cibuildwheel --output-dir dist
fi

- store_artifacts: &store-artifacts
path: ./dist
- persist_to_workspace: &persist-to-workspace
root: ./dist/
paths: .

environment: &global-environment
PIP_PROGRESS_BAR: 'off'

jobs:
say-hello:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job
python-linux:
parameters:
python-version:
type: string

docker:
- image: cimg/python:3.9

environment:
<<: *global-environment
CIBW_PROJECT_REQUIRES_PYTHON: ~=<< parameters.python-version>>
CIBW_ARCHS_LINUX: x86_64

steps:
- checkout
- setup_remote_docker
- run-cibuildwheel

python-linux-debug:
docker:
# Specify the version you desire here
# See: https://circleci.com/developer/images/image/cimg/base
- image: cimg/base:current
- image: cimg/python:3.9

steps:
- checkout

- run:
name: install dependencies
command: |
python -m venv env
. env/bin/activate
pip install -r requirements.txt
pip install -r tests/requirements.txt

- run:
name: build with -Werror
command: |
. env/bin/activate
CFLAGS="-Werror" python setup.py build_ext --inplace

- run:
name: build with -Werror and -UNDEBUG
command: |
. env/bin/activate
CFLAGS="-UNDEBUG -Werror" python setup.py build_ext --inplace --force

- run:
name: run tests
command: |
. env/bin/activate
python -m unittest

python-macOS:
macos:
xcode: 15.3.0
resource_class: macos.m1.medium.gen1

parameters:
python-version:
type: string
cibw-arch:
type: string

environment:
<<: *global-environment
CIBW_PROJECT_REQUIRES_PYTHON: ~=<< parameters.python-version>>
CIBW_ARCHS_MACOS: << parameters.cibw-arch >>

steps:
- checkout
- macos/install-rosetta
- run-cibuildwheel

python-windows:
parameters:
python-version:
type: string

executor:
name: win/default

environment:
<<: *global-environment
CIBW_PROJECT_REQUIRES_PYTHON: ~=<< parameters.python-version>>
CIBW_ARCHS_WINDOWS: AMD64

steps:
- checkout
- run-cibuildwheel

cpp-linux:
docker:
- image: cimg/python:3.9

steps:
- checkout
- run:
name: run cpp tests
command: |
FLAGS=-Werror make -C tests/cpp/

cpp-macOS:
macos:
xcode: 15.3.0
resource_class: macos.m1.medium.gen1

# Add steps to the job
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
steps:
# Checkout the code as the first step.
- checkout
- run:
name: "Say hello"
command: "echo Hello, World!"
name: run cpp tests
command: |
FLAGS=-Werror make -C tests/cpp/

# Orchestrate jobs using workflows
# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows
workflows:
say-hello-workflow: # This is the name of the workflow, feel free to change it to better match your workflow.
# Inside the workflow, you define the jobs you want to run.
tests:
jobs:
- say-hello
- python-linux:
matrix:
parameters:
# versions are built with ~= so the patch version doesn't matter
python-version: &python-versions [3.8.0, 3.9.0, 3.10.0, 3.11.0, 3.12.0]
- python-linux-debug
- python-macOS:
matrix:
parameters:
python-version: *python-versions
cibw-arch: [x86_64, arm64]
- python-windows:
matrix:
parameters:
python-version: *python-versions
- cpp-linux
- cpp-macOS
13 changes: 13 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
Language: Cpp
BasedOnStyle: Google

ColumnLimit: 100
NamespaceIndentation: None

# Scaled by a factor of 2 such that the base indent is 4
AccessModifierOffset: -3
IndentWidth: 4
ContinuationIndentWidth: 8
ConstructorInitializerIndentWidth: 8
...
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.o
*.out
*.so
*.a

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
coverage_html/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
cov.xml
*.cover
.hypothesis/
*.lcov

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# mypy
.mypy_cache/

# IDEs/editors
.vscode/

# dwave-optimization stuff
tests/cpp/.deps/*.d
dwave/optimization/*.cpp
dwave/optimization/*.html
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "extern/catch2"]
path = extern/catch2
url = git@github.com:catchorg/Catch2.git
Loading