Skip to content

Commit 7489df8

Browse files
committed
second commit
1 parent 0c980db commit 7489df8

Some content is hidden

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

53 files changed

+4895
-838
lines changed

.github/workflows/ci.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Set up Rust
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: stable
30+
override: true
31+
components: rustfmt, clippy
32+
33+
- name: Cache Rust dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: |
37+
~/.cargo/registry
38+
~/.cargo/git
39+
target
40+
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
41+
42+
- name: Install Python dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install maturin pytest pytest-cov pytest-xdist
46+
47+
- name: Rust format check
48+
run: cargo fmt --all -- --check
49+
50+
- name: Rust clippy
51+
run: cargo clippy --all-targets --all-features -- -D warnings
52+
53+
- name: Run Rust tests
54+
run: cargo test --verbose
55+
56+
- name: Build and install Python package
57+
run: maturin develop
58+
59+
- name: Run Python tests
60+
run: pytest tests/ -v --cov=logxide --cov-report=xml
61+
62+
- name: Upload coverage to Codecov
63+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
64+
uses: codecov/codecov-action@v4
65+
with:
66+
token: ${{ secrets.CODECOV_TOKEN }}
67+
file: ./coverage.xml
68+
flags: unittests
69+
name: codecov-umbrella
70+
fail_ci_if_error: false
71+
72+
lint:
73+
name: Lint
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Set up Python
80+
uses: actions/setup-python@v5
81+
with:
82+
python-version: "3.11"
83+
84+
- name: Install dependencies
85+
run: |
86+
python -m pip install --upgrade pip
87+
pip install ruff mypy
88+
89+
- name: Run ruff
90+
run: ruff check .
91+
92+
- name: Run ruff format check
93+
run: ruff format --check .
94+
95+
- name: Run mypy
96+
run: mypy logxide/ --ignore-missing-imports
97+
98+
build:
99+
name: Build
100+
runs-on: ${{ matrix.os }}
101+
strategy:
102+
matrix:
103+
os: [ubuntu-latest, windows-latest, macos-latest]
104+
105+
steps:
106+
- uses: actions/checkout@v4
107+
108+
- name: Set up Python
109+
uses: actions/setup-python@v5
110+
with:
111+
python-version: "3.11"
112+
113+
- name: Set up Rust
114+
uses: actions-rs/toolchain@v1
115+
with:
116+
toolchain: stable
117+
override: true
118+
119+
- name: Install maturin
120+
run: |
121+
python -m pip install --upgrade pip
122+
pip install maturin
123+
124+
- name: Build wheels
125+
run: maturin build --release
126+
127+
- name: Upload wheels
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: wheels-${{ matrix.os }}
131+
path: target/wheels/
132+
133+
security:
134+
name: Security audit
135+
runs-on: ubuntu-latest
136+
137+
steps:
138+
- uses: actions/checkout@v4
139+
140+
- name: Set up Rust
141+
uses: actions-rs/toolchain@v1
142+
with:
143+
toolchain: stable
144+
override: true
145+
146+
- name: Run security audit
147+
run: |
148+
cargo install cargo-audit
149+
cargo audit

.github/workflows/publish.yml

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*" # Trigger on version tags like v1.0.0
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
# First job: Run tests
11+
test:
12+
name: Test
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Set up Rust
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: stable
30+
override: true
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install maturin pytest pytest-cov
36+
37+
- name: Build and install
38+
run: maturin develop
39+
40+
- name: Run tests
41+
run: pytest tests/ -v
42+
43+
# Second job: Build wheels for multiple platforms
44+
build:
45+
name: Build wheels
46+
runs-on: ${{ matrix.os }}
47+
needs: test
48+
strategy:
49+
matrix:
50+
os: [ubuntu-latest, windows-latest, macos-latest]
51+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Python ${{ matrix.python-version }}
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
61+
- name: Set up Rust
62+
uses: actions-rs/toolchain@v1
63+
with:
64+
toolchain: stable
65+
override: true
66+
67+
- name: Install maturin
68+
run: |
69+
python -m pip install --upgrade pip
70+
pip install maturin
71+
72+
- name: Build wheels
73+
run: maturin build --release --strip
74+
75+
- name: Upload wheels
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
79+
path: target/wheels/*.whl
80+
81+
# Third job: Build source distribution
82+
sdist:
83+
name: Build source distribution
84+
runs-on: ubuntu-latest
85+
needs: test
86+
87+
steps:
88+
- uses: actions/checkout@v4
89+
90+
- name: Set up Python
91+
uses: actions/setup-python@v5
92+
with:
93+
python-version: "3.11"
94+
95+
- name: Set up Rust
96+
uses: actions-rs/toolchain@v1
97+
with:
98+
toolchain: stable
99+
override: true
100+
101+
- name: Install maturin
102+
run: |
103+
python -m pip install --upgrade pip
104+
pip install maturin
105+
106+
- name: Build source distribution
107+
run: maturin sdist
108+
109+
- name: Upload source distribution
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: sdist
113+
path: target/wheels/*.tar.gz
114+
115+
# Fourth job: Publish to PyPI
116+
publish:
117+
name: Publish to PyPI
118+
runs-on: ubuntu-latest
119+
needs: [test, build, sdist]
120+
if: startsWith(github.ref, 'refs/tags/')
121+
environment:
122+
name: pypi
123+
url: https://pypi.org/project/logxide/
124+
permissions:
125+
id-token: write # For trusted publishing
126+
127+
steps:
128+
- name: Download all artifacts
129+
uses: actions/download-artifact@v4
130+
with:
131+
path: dist/
132+
merge-multiple: true
133+
134+
- name: List artifacts
135+
run: ls -la dist/
136+
137+
- name: Publish to PyPI
138+
uses: pypa/gh-action-pypi-publish@release/v1
139+
with:
140+
packages-dir: dist/
141+
verbose: true
142+
print-hash: true
143+
144+
# Fifth job: Create GitHub release
145+
release:
146+
name: Create GitHub Release
147+
runs-on: ubuntu-latest
148+
needs: [publish]
149+
if: startsWith(github.ref, 'refs/tags/')
150+
permissions:
151+
contents: write
152+
153+
steps:
154+
- uses: actions/checkout@v4
155+
156+
- name: Get version from tag
157+
id: get_version
158+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
159+
160+
- name: Download all artifacts
161+
uses: actions/download-artifact@v4
162+
with:
163+
path: dist/
164+
merge-multiple: true
165+
166+
- name: Create Release
167+
uses: softprops/action-gh-release@v1
168+
with:
169+
name: LogXide v${{ steps.get_version.outputs.VERSION }}
170+
draft: false
171+
prerelease: false
172+
generate_release_notes: true
173+
files: |
174+
dist/*.whl
175+
dist/*.tar.gz
176+
body: |
177+
## LogXide v${{ steps.get_version.outputs.VERSION }}
178+
179+
High-performance, Rust-powered drop-in replacement for Python's logging module.
180+
181+
### Installation
182+
183+
```bash
184+
pip install logxide==${{ steps.get_version.outputs.VERSION }}
185+
```
186+
187+
### Quick Start
188+
189+
```python
190+
import logxide
191+
logxide.install()
192+
193+
import logging
194+
logging.basicConfig(level=logging.INFO)
195+
logger = logging.getLogger(__name__)
196+
logger.info("Hello from LogXide!")
197+
```
198+
199+
See the [CHANGELOG](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for detailed release notes.
200+
env:
201+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)