Skip to content

Commit 35bf99a

Browse files
committed
ported python pkg to rust
complete with docs, but need to add more testing
1 parent 2e25fec commit 35bf99a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+833207
-6
lines changed

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.py text eol=lf
7+
*.rst text eol=lf
8+
*.sh text eol=lf
9+
*.cpp text eol=lf
10+
*.hpp text eol=lf

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: 2bndy5

.github/stale.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_extends: .github

.github/workflows/build-docs.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Docs
2+
3+
on: [push, workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- uses: actions/setup-python@v5
12+
with:
13+
python-version: 3.x
14+
15+
- name: Install docs dependencies
16+
run: pip install -r docs/requirements.txt
17+
18+
- name: Build docs
19+
run: sphinx-build docs docs/_build/html
20+
21+
- name: upload docs build as artifact
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: "cpp-linter_docs"
25+
path: ${{ github.workspace }}/docs/_build/html
26+
27+
- name: upload to github pages
28+
# only publish doc changes from main branch
29+
if: github.ref == 'refs/heads/main'
30+
uses: peaceiris/actions-gh-pages@v3
31+
with:
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
publish_dir: ./docs/_build/html
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Pre-commit
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: opened
7+
8+
jobs:
9+
check-source-files:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.x'
16+
- run: python3 -m pip install pre-commit
17+
- run: pre-commit run --all-files
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# This file is autogenerated by maturin v1.2.3
2+
# To update, run
3+
#
4+
# maturin generate-ci github
5+
#
6+
name: Python packaging
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
- master
13+
tags:
14+
- '*'
15+
pull_request:
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
linux:
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.10'
32+
- name: Build wheels
33+
uses: PyO3/maturin-action@v1
34+
with:
35+
target: ${{ matrix.target }}
36+
args: --release --out dist --find-interpreter
37+
sccache: 'true'
38+
manylinux: auto
39+
- name: Upload wheels
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: wheels
43+
path: dist
44+
45+
windows:
46+
runs-on: windows-latest
47+
strategy:
48+
matrix:
49+
target: [x64, x86]
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: actions/setup-python@v5
53+
with:
54+
python-version: '3.10'
55+
architecture: ${{ matrix.target }}
56+
- name: Build wheels
57+
uses: PyO3/maturin-action@v1
58+
with:
59+
target: ${{ matrix.target }}
60+
args: --release --out dist --find-interpreter
61+
sccache: 'true'
62+
- name: Upload wheels
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: wheels
66+
path: dist
67+
68+
macos:
69+
runs-on: macos-latest
70+
strategy:
71+
matrix:
72+
target: [x86_64, aarch64]
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: actions/setup-python@v5
76+
with:
77+
python-version: '3.10'
78+
- name: Build wheels
79+
uses: PyO3/maturin-action@v1
80+
with:
81+
target: ${{ matrix.target }}
82+
args: --release --out dist --find-interpreter
83+
sccache: 'true'
84+
- name: Upload wheels
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: wheels
88+
path: dist
89+
90+
sdist:
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v4
94+
- name: Build sdist
95+
uses: PyO3/maturin-action@v1
96+
with:
97+
command: sdist
98+
args: --out dist
99+
- name: Upload sdist
100+
uses: actions/upload-artifact@v4
101+
with:
102+
name: wheels
103+
path: dist
104+
105+
release:
106+
name: Release
107+
runs-on: ubuntu-latest
108+
if: startsWith(github.ref, 'refs/tags/')
109+
needs: [linux, windows, macos, sdist]
110+
steps:
111+
- uses: actions/download-artifact@v4
112+
with:
113+
name: wheels
114+
- name: Publish to PyPI
115+
uses: PyO3/maturin-action@v1
116+
env:
117+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
118+
with:
119+
command: upload
120+
args: --non-interactive --skip-existing *

.github/workflows/run-dev-tests.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: "Check python code"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "**.rs"
8+
- "*.toml"
9+
- ".github/workflows/run-dev-tests.yml"
10+
pull_request:
11+
# types: opened
12+
branches: [main]
13+
paths:
14+
- "**.rs"
15+
- "*.toml"
16+
- ".github/workflows/run-dev-tests.yml"
17+
18+
env:
19+
CARGO_TERM_COLOR: always
20+
21+
jobs:
22+
test:
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: ['windows-latest', ubuntu-latest]
27+
version: ['17', '16', '15', '14', '13', '12', '11', '10', '9', '8', '7']
28+
29+
runs-on: ${{ matrix.os }}
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- run: rustup component add llvm-tools-preview
34+
35+
- name: Install cargo-nextest and cargo-llvm-cov
36+
uses: taiki-e/install-action@v2
37+
with:
38+
tool: cargo-nextest,cargo-llvm-cov
39+
40+
- name: Restore build artifacts
41+
uses: actions/cache/restore@v3
42+
with:
43+
key: ${{ runner.os }}-${{ github.run_id }}_test_builds
44+
path: nextest-archive.tar.zst
45+
46+
- uses: actions/setup-python@v5
47+
with:
48+
python-version: 3.x
49+
50+
# - name: Install workflow deps
51+
# run: python3 -m pip install meson
52+
53+
# # https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages
54+
# - name: Install ninja (Linux)
55+
# if: runner.os == 'Linux'
56+
# run: sudo apt-get install ninja-build
57+
# - name: Install ninja (Windows)
58+
# if: runner.os == 'Windows'
59+
# run: choco install ninja
60+
61+
- name: Install Linux clang dependencies
62+
if: runner.os == 'Linux'
63+
shell: bash
64+
run: |
65+
sudo apt-get update
66+
# First try installing from default Ubuntu repositories before trying LLVM script
67+
if ! sudo apt-get install -y clang-format-${{ matrix.version }} clang-tidy-${{ matrix.version }}; then
68+
# This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/
69+
wget https://apt.llvm.org/llvm.sh -O ${{ runner.temp }}/llvm_install.sh
70+
chmod +x ${{ runner.temp }}/llvm_install.sh
71+
if sudo ${{ runner.temp }}/llvm_install.sh ${{ matrix.version }}; then
72+
sudo apt-get install -y clang-format-${{ matrix.version }} clang-tidy-${{ matrix.version }}
73+
fi
74+
fi
75+
76+
- name: Install clang-tools
77+
run: |
78+
python -m pip install clang-tools
79+
clang-tools --install ${{ matrix.version }}
80+
81+
- name: Collect Coverage
82+
env:
83+
CLANG_VERSION: ${{ matrix.version }}
84+
run: cargo llvm-cov --no-report nextest
85+
86+
- name: Upload coverage data
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: coverage-data-${{ runner.os }}-${{ matrix.version }}
90+
path: target/llvm-cov-target
91+
92+
coverage-report:
93+
needs: [test]
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v4
97+
98+
- name: Download all artifacts
99+
uses: actions/download-artifact@v4
100+
with:
101+
path: ${{ github.workspace }}
102+
103+
- name: Install cargo-llvm-cov
104+
uses: taiki-e/install-action@v2
105+
with:
106+
tool: cargo-llvm-cov
107+
108+
- name: Create coverage report
109+
run: cargo llvm-cov report --codecov --output-path coverage.json
110+
111+
- uses: codecov/codecov-action@v3
112+
with:
113+
token: ${{secrets.CODECOV_TOKEN}}
114+
files: coverage.json
115+
fail_ci_if_error: true # optional (default = false)

0 commit comments

Comments
 (0)