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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
235 changes: 24 additions & 211 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ concurrency:

env:
CARGO_TERM_COLOR: always
NODE_VERSION: '20'

jobs:
# Detect docs-only changes to skip heavy jobs
Expand All @@ -23,6 +22,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Detect docs-only changes
id: check
Expand All @@ -33,7 +34,6 @@ jobs:
BASE="${{ github.event.before }}"
fi

# Check if only docs changed
if git diff --name-only "$BASE" HEAD | grep -qvE '^(docs/|\.md$|\.mdx$)'; then
echo "docs_only=false" >> "$GITHUB_OUTPUT"
else
Expand All @@ -46,192 +46,47 @@ jobs:
if: needs.docs-scope.outputs.docs_only != 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- stable
- nightly
rust: [stable, nightly]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
- name: Cache cargo
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/registry
~/.cargo/git
crates/constraint-theory-core/target
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 CI cache key uses hashFiles('**/Cargo.lock') but the crate's Cargo.lock is no longer tracked

This PR removed crates/constraint-theory-core/Cargo.lock from git tracking (commit b231e87) but the CI cache key still uses hashFiles('**/Cargo.lock'). The only remaining tracked Cargo.lock is crates/gpu-simulation/Cargo.lock, which belongs to a completely different crate. This means the CI cache for constraint-theory-core is keyed off an unrelated crate's dependency graph — it won't bust when constraint-theory-core's dependencies change (e.g., bumping rand), and will bust unnecessarily when gpu-simulation's dependencies change. The practical impact is low because the crate has zero production dependencies and Cargo detects stale builds regardless of cache, but the cache key is semantically wrong.

Suggested change
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('crates/constraint-theory-core/Cargo.toml') }}
Staging: Open in Devin

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground

restore-keys: |
${{ runner.os }}-cargo-${{ matrix.rust }}-

- name: Check formatting
run: cargo fmt --all -- --check
working-directory: crates/constraint-theory-core
run: cargo fmt --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Run tests
run: cargo test --all-features --verbose

- name: Run doc tests
run: cargo test --doc

# WASM build and test
wasm-checks:
needs: [docs-scope]
if: needs.docs-scope.outputs.docs_only != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Setup wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-wasm-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-wasm-${{ hashFiles('**/Cargo.lock') }}

- name: Build WASM package
run: |
cd packages/constraint-theory-wasm
wasm-pack build --target web --scope superinstance

- name: Test WASM
run: |
cd packages/constraint-theory-wasm
wasm-pack test --node

# Python checks
python-checks:
needs: [docs-scope]
if: needs.docs-scope.outputs.docs_only != 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest pytest-cov mypy

- name: Run ruff linter
run: ruff check .

- name: Run ruff formatter check
run: ruff format --check .

- name: Run type checks
run: mypy packages/constraint-theory-python --strict

- name: Run tests
run: pytest packages/constraint-theory-python --cov --cov-report=xml

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: python

# TypeScript/Node.js checks
node-checks:
needs: [docs-scope]
if: needs.docs-scope.outputs.docs_only != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run TypeScript checks
run: npm run type-check

- name: Run linter
run: npm run lint
working-directory: crates/constraint-theory-core
run: cargo clippy --all-targets -- -D warnings

- name: Run tests
run: npm test

- name: Build
run: npm run build

# Browser tests
browser-tests:
needs: [docs-scope]
if: needs.docs-scope.outputs.docs_only != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
working-directory: crates/constraint-theory-core
run: cargo test --release

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Build docs
working-directory: crates/constraint-theory-core
run: cargo doc --no-deps

- name: Install dependencies
run: npm ci

- name: Install Playwright
run: npx playwright install --with-deps

- name: Run browser tests
run: npm run test:browser

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/

# Security scanning
# Security audit
security-scan:
needs: [docs-scope]
if: needs.docs-scope.outputs.docs_only != 'true'
Expand All @@ -244,45 +99,3 @@ jobs:
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Run safety check
run: |
pip install safety
safety check --json

- name: Run npm audit
run: npm audit --audit-level=moderate

# Performance benchmarks
benchmarks:
needs: [docs-scope]
if: needs.docs-scope.outputs.docs_only != 'true' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-bench-${{ github.sha }}

- name: Run benchmarks
run: cargo bench --all-features -- --output-format bencher | tee benchmark.txt

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: cargo
output-file-path: benchmark.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: false
Loading
Loading