Skip to content

Commit ad923ba

Browse files
feat: python scripts (#2)
1 parent d3ca64a commit ad923ba

10 files changed

Lines changed: 997 additions & 4 deletions

File tree

.clang-format

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
# This file is centrally managed in https://github.com/<organization>/.github/
3+
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
4+
# the above-mentioned repo.
5+
6+
# Generated from CLion C/C++ Code Style settings
7+
BasedOnStyle: LLVM
8+
AccessModifierOffset: -2
9+
AlignAfterOpenBracket: BlockIndent
10+
AlignConsecutiveAssignments: None
11+
AlignEscapedNewlines: DontAlign
12+
AlignOperands: Align
13+
AllowAllArgumentsOnNextLine: false
14+
AllowAllConstructorInitializersOnNextLine: false
15+
AllowAllParametersOfDeclarationOnNextLine: false
16+
AllowShortBlocksOnASingleLine: Empty
17+
AllowShortCaseLabelsOnASingleLine: false
18+
AllowShortEnumsOnASingleLine: false
19+
AllowShortFunctionsOnASingleLine: Empty
20+
AllowShortIfStatementsOnASingleLine: Never
21+
AllowShortLambdasOnASingleLine: None
22+
AllowShortLoopsOnASingleLine: true
23+
AlignTrailingComments: false
24+
AlwaysBreakAfterDefinitionReturnType: None
25+
AlwaysBreakAfterReturnType: None
26+
AlwaysBreakBeforeMultilineStrings: true
27+
AlwaysBreakTemplateDeclarations: MultiLine
28+
BinPackArguments: false
29+
BinPackParameters: false
30+
BracedInitializerIndentWidth: 2
31+
BraceWrapping:
32+
AfterCaseLabel: false
33+
AfterClass: false
34+
AfterControlStatement: Never
35+
AfterEnum: false
36+
AfterExternBlock: true
37+
AfterFunction: false
38+
AfterNamespace: false
39+
AfterObjCDeclaration: false
40+
AfterUnion: false
41+
BeforeCatch: true
42+
BeforeElse: true
43+
IndentBraces: false
44+
SplitEmptyFunction: false
45+
SplitEmptyRecord: true
46+
BreakArrays: true
47+
BreakBeforeBinaryOperators: None
48+
BreakBeforeBraces: Attach
49+
BreakBeforeTernaryOperators: false
50+
BreakConstructorInitializers: AfterColon
51+
BreakInheritanceList: AfterColon
52+
ColumnLimit: 0
53+
CompactNamespaces: false
54+
ContinuationIndentWidth: 2
55+
Cpp11BracedListStyle: true
56+
EmptyLineAfterAccessModifier: Never
57+
EmptyLineBeforeAccessModifier: Always
58+
ExperimentalAutoDetectBinPacking: true
59+
FixNamespaceComments: true
60+
IncludeBlocks: Regroup
61+
IndentAccessModifiers: false
62+
IndentCaseBlocks: true
63+
IndentCaseLabels: true
64+
IndentExternBlock: Indent
65+
IndentGotoLabels: true
66+
IndentPPDirectives: BeforeHash
67+
IndentWidth: 2
68+
IndentWrappedFunctionNames: true
69+
InsertBraces: true
70+
InsertNewlineAtEOF: true
71+
KeepEmptyLinesAtTheStartOfBlocks: false
72+
MaxEmptyLinesToKeep: 1
73+
NamespaceIndentation: All
74+
ObjCBinPackProtocolList: Never
75+
ObjCSpaceAfterProperty: true
76+
ObjCSpaceBeforeProtocolList: true
77+
PackConstructorInitializers: Never
78+
PenaltyBreakBeforeFirstCallParameter: 1
79+
PenaltyBreakComment: 1
80+
PenaltyBreakString: 1
81+
PenaltyBreakFirstLessLess: 0
82+
PenaltyExcessCharacter: 1000000
83+
PenaltyReturnTypeOnItsOwnLine: 100000000
84+
PointerAlignment: Right
85+
ReferenceAlignment: Pointer
86+
ReflowComments: true
87+
RemoveBracesLLVM: false
88+
RemoveSemicolon: false
89+
SeparateDefinitionBlocks: Always
90+
SortIncludes: CaseInsensitive
91+
SortUsingDeclarations: Lexicographic
92+
SpaceAfterCStyleCast: true
93+
SpaceAfterLogicalNot: false
94+
SpaceAfterTemplateKeyword: false
95+
SpaceBeforeAssignmentOperators: true
96+
SpaceBeforeCaseColon: false
97+
SpaceBeforeCpp11BracedList: true
98+
SpaceBeforeCtorInitializerColon: false
99+
SpaceBeforeInheritanceColon: false
100+
SpaceBeforeJsonColon: false
101+
SpaceBeforeParens: ControlStatements
102+
SpaceBeforeRangeBasedForLoopColon: true
103+
SpaceBeforeSquareBrackets: false
104+
SpaceInEmptyBlock: false
105+
SpaceInEmptyParentheses: false
106+
SpacesBeforeTrailingComments: 2
107+
SpacesInAngles: Never
108+
SpacesInCStyleCastParentheses: false
109+
SpacesInContainerLiterals: false
110+
SpacesInLineCommentPrefix:
111+
Maximum: 3
112+
Minimum: 1
113+
SpacesInParentheses: false
114+
SpacesInSquareBrackets: false
115+
TabWidth: 2
116+
UseTab: Never

.flake8

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
filename =
3+
*.py
4+
max-line-length = 120
5+
extend-exclude =
6+
.venv/
7+
venv/

.github/workflows/ci.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
name: CI
3+
permissions: {}
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- master
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: "${{ github.workflow }}-${{ github.ref }}"
14+
cancel-in-progress: true
15+
16+
env:
17+
PYTHON_VERSION: '3.14'
18+
19+
jobs:
20+
release-setup:
21+
name: Release Setup
22+
outputs:
23+
publish_release: ${{ steps.release-setup.outputs.publish_release }}
24+
release_body: ${{ steps.release-setup.outputs.release_body }}
25+
release_commit: ${{ steps.release-setup.outputs.release_commit }}
26+
release_generate_release_notes: ${{ steps.release-setup.outputs.release_generate_release_notes }}
27+
release_tag: ${{ steps.release-setup.outputs.release_tag }}
28+
release_version: ${{ steps.release-setup.outputs.release_version }}
29+
permissions:
30+
contents: write
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
36+
- name: Release Setup
37+
id: release-setup
38+
uses: LizardByte/actions/actions/release_setup@25babf9f2e9f088145ba488339c78c4df9394fc7 # v2026.524.145234
39+
with:
40+
github_token: ${{ secrets.GITHUB_TOKEN }}
41+
42+
pytest:
43+
name: Pytest (${{ matrix.os }})
44+
needs:
45+
- release-setup
46+
permissions:
47+
contents: read
48+
runs-on: ${{ matrix.os }}
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
os:
53+
- macos-latest
54+
- ubuntu-latest
55+
- windows-latest
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
59+
60+
- name: Set up Python
61+
id: setup-python
62+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
63+
with:
64+
python-version: ${{ env.PYTHON_VERSION }}
65+
66+
- name: Set up uv
67+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
68+
with:
69+
enable-cache: true
70+
71+
- name: Sync Python tools
72+
env:
73+
UV_PYTHON: ${{ steps.setup-python.outputs.python-path }}
74+
run: uv sync --locked
75+
76+
- name: Test with pytest
77+
id: test
78+
run: uv run --locked pytest
79+
80+
- name: Upload test coverage
81+
# any except canceled or skipped
82+
if: >-
83+
always() &&
84+
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') &&
85+
startsWith(github.repository, 'LizardByte/')
86+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
87+
with:
88+
disable_search: true
89+
fail_ci_if_error: true
90+
files: ./coverage/python-coverage.xml
91+
flags: ${{ runner.os }}
92+
report_type: coverage
93+
token: ${{ secrets.CODECOV_TOKEN }}
94+
verbose: true
95+
96+
- name: Upload test results
97+
# any except canceled or skipped
98+
if: >-
99+
always() &&
100+
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') &&
101+
startsWith(github.repository, 'LizardByte/')
102+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
103+
with:
104+
disable_search: true
105+
fail_ci_if_error: true
106+
files: ./junit-python.xml
107+
flags: ${{ runner.os }}
108+
report_type: test_results
109+
token: ${{ secrets.CODECOV_TOKEN }}
110+
verbose: true
111+
112+
create-release:
113+
name: Create Release
114+
if: >-
115+
(github.event_name == 'push' && github.ref == 'refs/heads/master') &&
116+
needs.release-setup.outputs.publish_release == 'true'
117+
needs:
118+
- release-setup
119+
- pytest
120+
permissions: {}
121+
runs-on: ubuntu-latest
122+
steps:
123+
- name: Create/Update GitHub Release
124+
uses: LizardByte/actions/actions/release_create@25babf9f2e9f088145ba488339c78c4df9394fc7 # v2026.524.145234
125+
with:
126+
allowUpdates: true
127+
artifacts: ''
128+
body: ${{ needs.release-setup.outputs.release_body }}
129+
draft: true
130+
generateReleaseNotes: ${{ needs.release-setup.outputs.release_generate_release_notes }}
131+
name: ${{ needs.release-setup.outputs.release_tag }}
132+
prerelease: true
133+
tag: ${{ needs.release-setup.outputs.release_tag }}
134+
token: ${{ secrets.GH_BOT_TOKEN }}

0 commit comments

Comments
 (0)