Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
nawaz1991 committed Dec 8, 2023
1 parent e11d31c commit 055bd0e
Show file tree
Hide file tree
Showing 30 changed files with 2,257 additions and 5 deletions.
27 changes: 27 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '{build}'
image: Visual Studio 2019
platform:
- x86
- x64
environment:
global:
DISTUTILS_USE_SDK: 1
PYTHONWARNINGS: ignore:DEPRECATION
MSSdk: 1
matrix:
- PYTHON: 37
install:
- cmd: '"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %PLATFORM%'
- ps: |
git submodule update -q --init --recursive
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
python -m pip install --disable-pip-version-check --upgrade --no-warn-script-location pip build pytest
build_script:
- ps: |
python -m build -s
cd dist
python -m pip install --verbose oasvalidator-1.0.0.tar.gz
cd ..
test_script:
- ps: python -m pytest
113 changes: 113 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakInheritanceList: BeforeComma
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 180
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 22
PenaltyBreakBeforeFirstCallParameter: 120
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...
6 changes: 6 additions & 0 deletions .clang-lint-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ignore third_party code from clang-format checks
rapidjson/*
build/*
cmake-build-debug/*


83 changes: 83 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
Checks: |
-*,
clang-analyzer-*,
clang-diagnostic-*,
bugprone-*,
readability-identifier-naming,
readability-braces-around-statements,
readability-inconsistent-declaration-parameter-name,
readability-magic-numbers,
readability-make-member-function-const,
readability-named-parameter,
readability-non-const-parameter,
readability-qualified-auto,
readability-redundant-preprocessor,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-definition-in-anonymous-namespace,
readability-uniqueptr-delete-release,
readability-string-compare,
llvm-namespace-comment,
misc-definitions-in-headers,
misc-misplaced-const,
misc-redundant-expression,
misc-throw-by-value-catch-by-reference,
modernize-deprecated-headers,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
modernize-redundant-void-arg,
modernize-replace-random-shuffle,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-emplace,
modernize-use-noexcept,
modernize-use-nullptr,
performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-move-const-arg
WarningsAsErrors: |
clang-analyzer-*,
clang-diagnostic-*,
bugprone-*,
readability-*,
performance-*
AnalyzeTemporaryDtors: false
CheckOptions:
- { key: readability-identifier-naming.NamespaceCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.MethodCase, value: CamelCase }
- { key: readability-identifier-naming.MemberCase, value: lower_case }
- { key: readability-identifier-naming.ClassConstantCase, value: CamelCase }
- { key: readability-identifier-naming.ClassConstantPrefix, value: k }
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.GlobalConstantPointerCase, value: UPPER_CASE }
- { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.ScopedEnumConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE }

- { key: readability-magic-numbers.IgnorePowersOf2IntegerValues, value: true }
- { key: readability-implicit-bool-conversion.AllowPointerConditions, value: true }
- { key: readability-inconsistent-declaration-parameter-name.Strict, value: true }

- { key: llvm-namespace-comment.ShortNamespaceLines, value: 5 }
- { key: modernize-use-auto.MinTypeNameLength, value: 15 }
- { key: misc-definitions-in-headers.HeaderFileExtensions, value: "h,hh,hpp,hxx,ipp" }
...
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
49 changes: 49 additions & 0 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Conda

on:
workflow_dispatch:
push:
branches:
- main
- '**'
pull_request:

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.10"]

runs-on: ${{ matrix.platform }}

# The setup-miniconda action needs this to activate miniconda
defaults:
run:
shell: "bash -l {0}"

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Get conda
uses: conda-incubator/setup-miniconda@v3.0.1
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: strict

# Currently conda-build requires the dead package "toml" but doesn't declare it
- name: Prepare
run: conda install conda-build conda-verify pytest toml

- name: Build
run: conda build conda.recipe

- name: Install
run: conda install -c ${CONDA_PREFIX}/conda-bld/ oasvalidator

- name: Test
run: python -m pytest
23 changes: 23 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This is a format job. Pre-commit has a first-party GitHub action, so we use
# that: https://github.com/pre-commit/action

name: Format

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- '**'

jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
37 changes: 37 additions & 0 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Pip

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- '**'

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.1", "3.7", "3.11"]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Add requirements
run: python -m pip install --upgrade wheel setuptools

- name: Build and install
run: pip install --verbose .[test]

- name: Test
run: python -m pytest
Loading

0 comments on commit 055bd0e

Please sign in to comment.