Skip to content

Commit

Permalink
Merge branch 'main' into fix-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Aug 3, 2023
2 parents 96aba2f + 021d5cf commit 7dae671
Show file tree
Hide file tree
Showing 49 changed files with 2,122 additions and 350 deletions.
159 changes: 159 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Copyright (C) 2022 Roberto Rossini <[email protected]>
#
# SPDX-License-Identifier: MIT
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:| NOLINT'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
...
4 changes: 2 additions & 2 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ jobs:
- name: Build and install
env:
CMAKE_ARGS: "-DCMAKE_PREFIX_PATH=${{ github.workspace}}/conan_build"
run: pip install --verbose .
run: pip install --verbose .[test]

- name: Test
run: python -v -c 'import hictkpy; print(hictkpy.__version__)'
run: python -m pytest test


pip-status-check:
Expand Down
131 changes: 131 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Copyright (C) 2023 Roberto Rossini ([email protected])
# SPDX-License-Identifier: MIT

name: Wheels

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- ".github/workflows/wheels.yml"
- "cmake/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "pyproject.toml"
- "setup.cfg"
- "setup.py"
tags:
- 'v*.*.*'

pull_request:
paths:
- ".github/workflows/wheels.yml"
- "cmake/**"
- "src/**"
- "test/**"
- "CMakeLists.txt"
- "conanfile.txt"
- "pyproject.toml"
- "setup.cfg"
- "setup.py"

release:
types:
- published

# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
CONAN_HOME: "${{ github.workspace }}/conan/"
CCACHE_DIR: "${{ github.workspace }}/ccache/"

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

- name: Build SDist
run: pipx run build --sdist

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

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


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

steps:
- uses: actions/checkout@v3

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Build wheels
uses: pypa/[email protected]
if: ${{ github.event_name != 'pull_request' }}
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_WINDOWS: AMD64

- name: Build wheels (PR)
uses: pypa/[email protected]
if: ${{ github.event_name == 'pull_request' }}
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_WINDOWS: AMD64
CIBW_BUILD: "cp311-*"

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

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


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

steps:
- uses: actions/setup-python@v4
with:
python-version: "3.x"

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

- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include(FetchContent)
FetchContent_Declare(
hictk
GIT_REPOSITORY "https://github.com/paulsengroup/hictk.git"
GIT_TAG "6e9d46efc3cd3a4efa06db9d05b9af9fe91df4fe"
GIT_TAG "5a27e5c4a071c3384bfc521747c0fe5c329b221f"
SYSTEM)

set(BUILD_SHARED_LIBS ON)
Expand All @@ -37,6 +37,7 @@ set(HICTK_BUILD_BENCHMARKS OFF)
set(HICTK_BUILD_PYTHON_BINDINGS OFF)
set(HICTK_WITH_EIGEN OFF)
set(HICTK_BUILD_TOOLS OFF)
set(HICTK_INSTALL OFF)
FetchContent_MakeAvailable(hictk)

add_library(hictkpy_project_options INTERFACE)
Expand Down
7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (C) 2023 Roberto Rossini ([email protected])
#
# SPDX-License-Identifier: MIT

include conanfile.txt README.md LICENSE
graft cmake/ src/
global-include CMakeLists.txt
6 changes: 6 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ spdlog/1.12.0
CMakeDeps

[options]
fmt*:header_only=True
hdf5*:enable_cxx=False
hdf5*:hl=False
hdf5*:threadsafe=False
hdf5*:parallel=False
highfive*:with_boost=False
highfive*:with_eigen=False
highfive*:with_opencv=False
highfive*:with_xtensor=False
spdlog*:header_only=True
22 changes: 22 additions & 0 deletions devel/cibw/linux/cibw_setup_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Copyright (C) 2023 Roberto Rossini ([email protected])
# SPDX-License-Identifier: MIT

set -e
set -u

# readlink -f is not available on macos...
function readlink_py {
set -eu
python3 -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$1"
}

install_prefix="$(readlink_py "${1-/usr/local}")"

conan install conanfile.txt \
-s build_type=Release \
-s compiler.cppstd=17 \
--output-folder "$install_prefix/share/cmake/" \
-o '*/*:shared=True' \
--build="missing"
28 changes: 28 additions & 0 deletions devel/cibw/linux/conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (C) 2023 Roberto Rossini <[email protected]>
#
# SPDX-License-Identifier: MIT

[requires]
fast_float/5.2.0
fmt/10.0.0
hdf5/1.14.0
highfive/2.7.1
libdeflate/1.18
parallel-hashmap/1.3.11
pybind11/2.10.4
spdlog/1.12.0

[generators]
CMakeDeps

[options]
fmt*:header_only=True
hdf5*:enable_cxx=False
hdf5*:hl=False
hdf5*:threadsafe=False
hdf5*:parallel=False
highfive*:with_boost=False
highfive*:with_eigen=False
highfive*:with_opencv=False
highfive*:with_xtensor=False
spdlog*:header_only=True
Loading

0 comments on commit 7dae671

Please sign in to comment.