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
55 changes: 31 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ env:
CARGO_TERM_COLOR: always
DATABASE_URL: postgres://capsule:capsule_password@localhost:5432/capsule_dev
JWT_SECRET: dev-secret-change-me
# RUSTC_WRAPPER: sccache
# SCCACHE_GHA_ENABLED: "true"

jobs:
ci:
Expand All @@ -30,33 +32,41 @@ jobs:
--health-retries 5

steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust toolchain
- name: Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy

- name: Cache Rust dependencies
# - name: Setup sccache
# uses: mozilla-actions/sccache-action@v0.0.6

- name: Rust dependency cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "ci-cache"

- name: Install tools
run: |
cargo install sqlx-cli --no-default-features --features native-tls,postgres
cargo install cargo-audit
cargo install cargo-deny
shared-key: ci-cache
cache-provider: github

- name: Cache SQLx
uses: actions/cache@v4
# Fast, cached installs for cargo-installed tools
- name: Install sqlx-cli (cached)
uses: baptiste0928/cargo-install@v3
with:
path: |
~/.cargo/bin/sqlx
.sqlx
key: sqlx-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
crate: sqlx-cli
version: 0.7.4
args: --no-default-features --features native-tls,postgres
locked: true

# Use purpose-built actions instead of installing binaries
# - name: Security audit
# uses: actions-rs/audit-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}

# - name: License/dependency policy
# uses: EmbarkStudios/cargo-deny-action@v2

- name: Wait for PostgreSQL
run: |
Expand All @@ -71,17 +81,14 @@ jobs:
- name: Check formatting
run: cargo fmt --all -- --check

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

- name: Run tests
run: cargo test --all-features
- name: Tests
run: cargo test --all-features --locked

- name: SQLx prepare check
run: cargo sqlx prepare --check --workspace -- --all-features

# - name: Security audit
# run: cargo audit

# - name: License/dependency check
# run: cargo deny check
# - name: sccache stats
# run: sccache --show-stats || true

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- **Format**: `make fmt` (rustfmt)
- **Full Check**: `make check` (fmt + lint + test + audit + deny)
- **Run locally**: `make dev` (starts API on 127.0.0.1:8080)
- **Run worker**: `cargo run --bin worker` (starts background job processor)
- **Demo jobs**: `cargo run --example job_runner_demo` (enqueues example jobs)

## Database Commands
- **Setup**: `make db-up` → `make db-migrate`
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ name = "capsule"
version = "0.1.0"
edition = "2024"

[[bin]]
name = "worker"
path = "src/bin/worker.rs"

[[example]]
name = "job_runner_demo"
path = "examples/job_runner_demo.rs"

[dependencies]
anyhow = { version = "1.0.99" }
thiserror = { version = "2.0.16" }
Expand Down Expand Up @@ -33,6 +41,8 @@ tracing = { version = "0.1.40" }
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "json"] }
tower = { version = "0.5" }
tower-http = { version = "0.6", features = ["trace", "request-id"] }
tokio-util = { version = "0.7", features = ["rt"] }
rand = { version = "0.8" }

[dev-dependencies]
mockall = "0.13"
Expand Down
Loading
Loading