Skip to content

Commit

Permalink
Add arm64 targets to CI/CD pipeline (#3)
Browse files Browse the repository at this point in the history
Added arm64 targets to CI/CD pipeline
  • Loading branch information
burgholzer authored Oct 16, 2020
1 parent e099718 commit ee31506
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 30 deletions.
60 changes: 42 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
###
### This file is part of IIC-JKU QCEC library which is released under the MIT license.
### This file is part of JKQ QCEC library which is released under the MIT license.
### See file README.md or go to http://iic.jku.at/eda/research/quantum_verification/ for more information.
###

# each stage must pass before the next can be run
stages:
- build # build the main library actually works
- test # running unit tests
- coverage # creating coverage report
- test # running unit tests + coverage
- deploy # deploying to pypi

#defaults
language: cpp
os: linux
dist: focal
group: edge
virt: lxd
addons:
apt:
sources:
- sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- cmake
- clang-11
homebrew:
packages:
- gcc@10
update: false

jobs:
include:
- &build
stage: build
name: 'Build Ubuntu GCC'
script:
- cmake -B build -S .
- cmake -B build -S . -DGIT_SUBMODULE=OFF
- cmake --build build --target qcec --parallel 8

- <<: *build
name: 'Build Ubuntu Clang-11'
name: 'Build ARM Ubuntu GCC'
arch: arm64-graviton2

- <<: *build
name: 'Build Ubuntu Clang'
addons:
apt:
sources:
- sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- cmake
- clang-11
before_script: CC=clang-11 CXX=clang++-11

- <<: *build
Expand All @@ -55,7 +63,7 @@ jobs:
name: 'Build Windows'
os: windows
script:
- cmake -B build -S . -G "Visual Studio 15 2017" -A x64 -LA -DCMAKE_BUILD_TYPE='Release'
- cmake -B build -S . -G "Visual Studio 15 2017" -A x64 -LA -DCMAKE_BUILD_TYPE='Release' -DGIT_SUBMODULE=OFF
- cmake --build build --config 'Release' --target qcec --parallel 8

- &test
Expand All @@ -67,7 +75,19 @@ jobs:
- cd build && ./qcec_test

- <<: *test
name: 'Test Ubuntu Clang-11'
name: 'Test ARM Ubuntu GCC'
arch: arm64-graviton2

- <<: *test
name: 'Test Ubuntu Clang'
addons:
apt:
sources:
- sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
packages:
- cmake
- clang-11
before_script: CC=clang-11 CXX=clang++-11

- <<: *test
Expand All @@ -85,15 +105,16 @@ jobs:
name: 'Test Windows'
os: windows
script:
- cmake -B build -S . -G "Visual Studio 15 2017" -A x64 -LA -DCMAKE_BUILD_TYPE='Release' -DBUILD_QCEC_TESTS=ON
- cmake -B build -S . -G "Visual Studio 15 2017" -A x64 -LA -DCMAKE_BUILD_TYPE='Release' -DBUILD_QCEC_TESTS=ON -DGIT_SUBMODULE=OFF
- cmake --build build --config 'Release' --target INSTALL --parallel 8;
- cd build/test/Release && ./qcec_test.exe;

- <<: *test
name: 'Coverage'
arch: arm64-graviton2
before_install: sudo apt-get -y install lcov
script:
- cmake -B build -S . -DCMAKE_BUILD_TYPE='Debug' -DCOVERAGE=1 -DBUILD_QCEC_TESTS=ON
- cmake -B build -S . -DCMAKE_BUILD_TYPE='Debug' -DCOVERAGE=1 -DBUILD_QCEC_TESTS=ON -DGIT_SUBMODULE=OFF
- cmake --build build --target qcec_test --parallel 8
- cd build && ./qcec_test
after_success:
Expand All @@ -106,16 +127,18 @@ jobs:
- &deploy
stage: deploy
name: 'Deploy Ubuntu'
virt: vm
language: python
install: python3 -m pip install cibuildwheel==1.6.3
script: python3 -m cibuildwheel --output-dir wheelhouse
env:
- TWINE_USERNAME=__token__
# Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings
- CIBW_MANYLINUX_X86_64_IMAGE="manylinux2014"
- CIBW_BEFORE_BUILD_LINUX="pip install cmake>=3.10"
- CIBW_MANYLINUX_AARCH64_IMAGE="manylinux2014"
- CIBW_BUILD="cp3?-*"
- CIBW_SKIP="*-win32 *-manylinux_i686"
- CIBW_BUILD_VERBOSITY=1
- CIBW_TEST_COMMAND="python -c \"from jkq import qcec\""
- CC=gcc CXX=g++
after_success:
Expand All @@ -126,20 +149,21 @@ jobs:
fi
services: docker

- <<: *deploy
name: 'Deploy Ubuntu ARM'
arch: arm64-graviton2

- <<: *deploy
name: 'Deploy MacOS'
os: osx
osx_image: xcode12
language: shell
services: # docker not available on MacOS

- <<: *deploy
name: 'Deploy Windows'
os: windows
language: shell
services: # docker not available on Windows
before_install:
- choco install python --version 3.8.0
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
# make sure it's on PATH as 'python3'
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
17 changes: 5 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os
import re
import sys
import platform
import subprocess

from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion


class CMakeExtension(Extension):
Expand All @@ -18,16 +16,11 @@ def __init__(self, name, sourcedir=''):
class CMakeBuild(build_ext):
def run(self):
try:
out = subprocess.check_output(['cmake', '--version'])
subprocess.check_output(['cmake', '--version'])
except OSError:
raise RuntimeError("CMake must be installed to build the following extensions: " +
", ".join(e.name for e in self.extensions))

if platform.system() == "Windows":
cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
if cmake_version < '3.10.0':
raise RuntimeError("CMake >= 3.10.0 is required for this project")

for ext in self.extensions:
self.build_extension(ext)

Expand All @@ -38,7 +31,9 @@ def build_extension(self, ext):
extdir += os.path.sep

cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
'-DPYTHON_EXECUTABLE=' + sys.executable]
'-DPYTHON_EXECUTABLE=' + sys.executable,
'-DBUILD_QCEC_BINDINGS=ON',
'-DGIT_SUBMODULE=OFF']

cfg = 'Debug' if self.debug else 'Release'
build_args = ['--config', cfg]
Expand All @@ -52,8 +47,6 @@ def build_extension(self, ext):
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
build_args += ['--', '-j2']

cmake_args += ['-DBUILD_QCEC_BINDINGS=ON']

env = os.environ.copy()
env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
self.distribution.get_version())
Expand All @@ -70,7 +63,7 @@ def build_extension(self, ext):

setup(
name='jkq.qcec',
version='1.0.0b1',
version='1.5.0b1',
author='Lukas Burgholzer',
author_email='lukas.burgholzer@jku.at',
description='JKQ QCEC - A JKQ tool for Quantum Circuit Equivalence Checking',
Expand Down

0 comments on commit ee31506

Please sign in to comment.