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
5 changes: 5 additions & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[advisories]
ignore = [
# see https://rustsec.org/advisories/RUSTSEC-2023-0071.html
"RUSTSEC-2023-0071",
]
70 changes: 69 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,64 @@ on:
pull_request:
branches: [main]

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
changes:
name: Detect changed areas
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
version: ${{ steps.filter.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: filter
uses: dorny/paths-filter@v3
with:
filters: |
backend:
- 'src/**'
- 'tests/**'
- 'migrations/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.cargo/**'
frontend:
- 'web/**'
version:
- 'Cargo.toml'
- 'web/package.json'
- 'compose.yaml'

backend:
name: Backend (Rust)
name: Backend (Rust + Integration + Audit)
needs: changes
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: netweave_test
POSTGRES_USER: netweave
POSTGRES_PASSWORD: netweave
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U netweave -d netweave_test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgres://netweave:netweave@localhost:5432/netweave_test
DEFAULT_ADMIN_USER: integration-admin
DEFAULT_ADMIN_PASSWORD: integration-admin-password
steps:
- uses: actions/checkout@v4

Expand All @@ -31,8 +82,19 @@ jobs:
- name: Test
run: cargo test

- name: Run ignored integration tests
run: cargo test --test api -- --ignored

- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit

- name: Run dependency audit
run: cargo audit

version-check:
name: Version Consistency
needs: changes
if: needs.changes.outputs.version == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -69,6 +131,8 @@ jobs:

frontend:
name: Frontend (React)
needs: changes
if: needs.changes.outputs.frontend == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -91,6 +155,10 @@ jobs:
run: pnpm lint
working-directory: web

- name: Test
run: pnpm test --run
working-directory: web

- name: Build
run: pnpm build
working-directory: web
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ logs/
node_modules/
dist/
build/

logs/
logs*/
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ The backend will be available at `http://localhost:8789` and the frontend dev se
This repository uses `prek` (Rust-native pre-commit runner) with native `prek.toml`. All checks should pass
before commiting. For more info check [prek docs](https://prek.j178.dev/).

Install hooks locally:

```bash
cargo install prek
prek install
```

Pre-commit checks (fast):
- `cargo fmt --all --check`
- `cd web && pnpm lint`
- `cargo clippy --workspace --lib --bins -- -D warnings`

Pre-push checks (strict):
- `cargo clippy --all-targets -- -D warnings`
- `cargo test`
- `cargo audit`
- `cd web && pnpm test --run`
- `cd web && pnpm build`

## Reporting Bugs

Please use the [Bug Report](https://github.com/mi7chal/netweave/issues/new?template=bug_report.md) issue template.
Expand Down
Loading
Loading