Initial commit (clean, no build artifacts)

This commit is contained in:
floor-licker
2025-07-24 20:29:10 -04:00
commit 0da466ae61
24 changed files with 10893 additions and 0 deletions
+230
View File
@@ -0,0 +1,230 @@
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, 1.75, 1.76]
target: [x86_64-unknown-linux-gnu]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
profile: minimal
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check code formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-features
- name: Run tests with coverage
if: matrix.rust == 'stable'
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --out Xml --output-dir coverage
continue-on-error: true
- name: Upload coverage to Codecov
if: matrix.rust == 'stable'
uses: codecov/codecov-action@v3
with:
file: ./coverage/cobertura.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
bench:
name: Benchmarks
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run benchmarks
run: cargo bench --no-run
- name: Run benchmarks (dry run)
run: cargo bench --no-run --verbose
security:
name: Security audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run security audit
run: cargo audit
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Build documentation
run: cargo doc --no-deps --all-features
- name: Check documentation
run: cargo doc --no-deps --all-features --document-private-items
examples:
name: Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Build examples
run: cargo build --examples --all-features
- name: Run examples
run: |
cargo run --example snipe -- --help || true
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Install cargo-spellcheck
run: cargo install cargo-spellcheck
- name: Check spelling
run: cargo spellcheck --code 1
- name: Check for common issues
run: |
# Check for TODO comments
if grep -r "TODO" src/; then
echo "Found TODO comments in source code"
exit 1
fi
# Check for FIXME comments
if grep -r "FIXME" src/; then
echo "Found FIXME comments in source code"
exit 1
fi
# Check for unwrap() calls (should use proper error handling)
if grep -r "\.unwrap()" src/; then
echo "Found unwrap() calls in source code"
exit 1
fi
release:
name: Release
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Build for release
run: cargo build --release --all-features
- name: Run tests in release mode
run: cargo test --release --all-features
- name: Create release archive
run: |
tar -czf polyfill-rs.tar.gz target/release/
echo "Release archive created: polyfill-rs.tar.gz"
- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: release-files
path: polyfill-rs.tar.gz