Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Formatter

on:
pull_request:
push:
branches: [main, develop]
tags: ["v*"]

permissions:
contents: read

jobs:
format:
name: Formatter check (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install ruff
run: pip install ruff

- name: Check formatting
run: ruff format --check .
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
release:
types: [published]

permissions:
contents: read

jobs:
build-pypi:
name: Build and publish to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
environment:
name: pypi
steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
command: build
args: --release -o dist
sdist: true
manylinux: auto

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
75 changes: 75 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Tests

on:
pull_request:
push:
branches: [main, develop]
tags: ["v*"]

permissions:
contents: read

jobs:
test-rust:
name: Rust tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Run Rust tests
run: cargo test -p badwords-core

test-python:
name: Python tests (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Create venv
run: python -m venv .venv

- name: Install dependencies
run: |
source .venv/bin/activate
python -m pip install --upgrade pip
pip install maturin
cd python && maturin develop --release

- name: Install dev dependencies
run: source .venv/bin/activate && pip install pytest pytest-benchmark

- name: Run Python tests
run: source .venv/bin/activate && pytest tests/ -v -m "not benchmark"

test-wasm:
name: WASM tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Install wasm-pack
run: cargo install wasm-pack

- name: Run WASM tests
run: cd rust/badwords-wasm && wasm-pack test --node
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
__pycache__/
.ruff_cache
.mypy_cache
*test*
dist
*.egg-info
.idea
t.py
test.py
test.py
.venv
venv
_native/
python/badwords/*.so
target/
Loading