-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor c++ code and add github actions (#102)
- Loading branch information
1 parent
aeebf5c
commit 54f60fd
Showing
73 changed files
with
2,191 additions
and
8,058 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: docker | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
allow: | ||
# Allow both direct and indirect updates for all packages | ||
- dependency-type: "all" | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
allow: | ||
# Allow both direct and indirect updates for all packages | ||
- dependency-type: "all" | ||
|
||
- package-ecosystem: pip | ||
directory: "/" | ||
insecure-external-code-execution: allow | ||
versioning-strategy: auto | ||
schedule: | ||
interval: "daily" | ||
allow: | ||
# Allow both direct and indirect updates for all packages | ||
- dependency-type: "all" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
name: Build&Upload | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
release: | ||
types: | ||
- released | ||
push: | ||
branches: | ||
- feature/addGithubActions | ||
|
||
env: | ||
Python_Version: 3.9 | ||
|
||
jobs: | ||
build_sdist: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: ${{env.Python_Version}} | ||
- name: Build sdist | ||
run: | | ||
pip install -r requirements.txt | ||
python setup.py sdist | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist/*.tar.gz | ||
retention-days: 1 | ||
|
||
codecov: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: ${{env.Python_Version}} | ||
- name: Install PyQUBO | ||
run: | | ||
python -m pip install . | ||
- name: Generate Codecov Report | ||
run: | | ||
pip install -r requirements.txt | ||
python -m coverage run -m unittest discover . | ||
- name: Upload Codecov Report | ||
run: | | ||
codecov | ||
doctest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: ${{env.Python_Version}} | ||
|
||
- name: Install PyQUBO | ||
run: | | ||
python -m pip install . | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
pip install -r requirements_doctest.txt | ||
sphinx-build -W -b html docs docs/_build/html | ||
- name: Run Doctest | ||
run: | | ||
make doctest | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} ${{matrix.arch}} | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
CIBW_DEPENDENCY_VERSIONS: pinned | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
arch: [x86_64, AMD64, i686, arm64] | ||
python: [36, 37, 38, 39] | ||
exclude: | ||
- os: ubuntu-latest | ||
arch: AMD64 | ||
- os: ubuntu-latest | ||
arch: arm64 | ||
|
||
- os: macos-latest | ||
arch: AMD64 | ||
- os: macos-latest | ||
arch: i686 | ||
- os: macos-latest | ||
arch: arm64 | ||
python: 36 | ||
- os: macos-latest | ||
arch: arm64 | ||
python: 37 | ||
|
||
- os: windows-latest | ||
arch: x86_64 | ||
- os: windows-latest | ||
arch: i686 | ||
- os: windows-latest | ||
arch: arm64 | ||
|
||
include: | ||
- os: ubuntu-latest | ||
CIBW_PLATFORM: linux | ||
CIBW_BUILD: "cp3*-manylinux*" | ||
CIBW_BEFORE_ALL: "" | ||
CIBW_BEFORE_BUILD: "pip install scikit-build" | ||
CIBW_REPAIR_WHEEL_COMMAND: "auditwheel repair -w {dest_dir} {wheel}" | ||
|
||
- os: macos-latest | ||
CIBW_PLATFORM: macos | ||
CIBW_BUILD: "cp3*-macosx*" | ||
CIBW_BEFORE_ALL: "" | ||
CIBW_BEFORE_BUILD: "pip install git+https://github.com/scikit-build/scikit-build.git@master" | ||
CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}" | ||
|
||
|
||
- os: windows-latest | ||
CIBW_PLATFORM: windows | ||
CIBW_BUILD: "cp3*-win_amd64*" | ||
CIBW_BEFORE_ALL: "" | ||
CIBW_BEFORE_BUILD: "pip install delvewheel scikit-build" | ||
CIBW_REPAIR_WHEEL_COMMAND: "delvewheel repair -w {dest_dir} {wheel}" | ||
|
||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
name: Install Python | ||
with: | ||
python-version: ${{env.Python_Version}} | ||
|
||
- name: Build wheels on ${{ matrix.CIBW_PLATFORM }} ${{matrix.arch}} | ||
uses: pypa/cibuildwheel@v1.12.0 | ||
env: | ||
CIBW_PLATFORM: ${{ matrix.CIBW_PLATFORM }} | ||
CIBW_BUILD: cp${{matrix.python}}-* | ||
CIBW_SKIP: "cp35-*" | ||
CIBW_ENVIRONMENT: | ||
CFLAGS="-flto -Ofast -pipe" | ||
CXXFLAGS="-flto -Ofast -pipe" | ||
CIBW_ARCHS: ${{matrix.arch}} | ||
CIBW_BEFORE_TEST: "pip install -r requirements.txt" | ||
CIBW_TEST_COMMAND: "python -m coverage run -m unittest discover {package}" | ||
CIBW_DEPENDENCY_VERSIONS: ${{ env.CIBW_DEPENDENCY_VERSIONS }} | ||
CIBW_BEFORE_BUILD: ${{matrix.CIBW_BEFORE_BUILD}} | ||
CIBW_BEFORE_ALL: ${{matrix.CIBW_BEFORE_ALL}} | ||
CIBW_REPAIR_WHEEL_COMMAND: ${{matrix.CIBW_REPAIR_WHEEL_COMMAND}} | ||
CIBW_BUILD_VERBOSITY: 3 | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: artifact | ||
path: ./wheelhouse/*.whl | ||
retention-days: 1 | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: ${{ secrets.PYPI_USERNAME }} | ||
password: ${{ secrets.PYPI_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ master, main ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ master, main ] | ||
schedule: | ||
- cron: '31 12 * * 5' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'cpp', 'python' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | ||
# Learn more: | ||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
cmake_minimum_required(VERSION 3.11) | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
project(cpp_pyqubo) | ||
|
||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION True) | ||
|
||
set(CXX_STANDARD_REQUIRED TRUE) | ||
set(CMAKE_VERBOSE_MAKEFILE TRUE) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") | ||
set(CMAKE_C_FLAGS "-Ofast -pipe" ) | ||
set(CMAKE_CXX_FLAGS "-Ofast -pipe") | ||
set(CMAKE_C_FLAGS_RELEASE "-Ofast -pipe") | ||
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -pipe") | ||
|
||
include(external/boost_assert.cmake) | ||
include(external/boost_config.cmake) | ||
include(external/boost_container.cmake) | ||
include(external/boost_container_hash.cmake) | ||
include(external/boost_core.cmake) | ||
include(external/boost_detail.cmake) | ||
include(external/boost_integer.cmake) | ||
include(external/boost_intrusive.cmake) | ||
include(external/boost_move.cmake) | ||
include(external/boost_static_assert.cmake) | ||
include(external/boost_type_traits.cmake) | ||
include(external/cimod.cmake) | ||
include(external/eigen.cmake) | ||
include(external/pybind11.cmake) | ||
include_directories(cpp_dimod) | ||
add_subdirectory(src) | ||
|
||
|
||
|
||
include(external/googletest.cmake) | ||
add_subdirectory(tests) | ||
include(external/robin_hood.cmake) | ||
|
||
pybind11_add_module(cpp_pyqubo src/main.cpp) | ||
|
||
target_compile_definitions(cpp_pyqubo PRIVATE VERSION_INFO=${PYQUBO_VERSION_INFO}) | ||
target_compile_features(cpp_pyqubo PRIVATE cxx_std_17) | ||
target_compile_options(cpp_pyqubo PRIVATE | ||
$<$<CXX_COMPILER_ID:GNU>: -Ofast -Wall -Wno-terminate> | ||
$<$<CXX_COMPILER_ID:AppleClang>: -Ofast -Wno-exceptions> | ||
$<$<CXX_COMPILER_ID:MSVC>: /O2 /wd4297> | ||
) | ||
target_include_directories(cpp_pyqubo PRIVATE ${Boost_INCLUDE_DIRS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fixes: | ||
- "/home/runner/work/pyqubo/pyqubo/::" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.