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
42 changes: 42 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Weekly dependency update PRs. Minor and patch updates are grouped into one
# PR per ecosystem; major updates get their own PR so they can be reviewed.
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
commit-message:
prefix: chore
include: scope
groups:
rust-minor:
update-types: [minor, patch]

- package-ecosystem: npm
directory: /web
schedule:
interval: weekly
commit-message:
prefix: chore
include: scope
groups:
web-minor:
update-types: [minor, patch]

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
commit-message:
prefix: ci
groups:
actions:
patterns: ["*"]

- package-ecosystem: docker
directory: /
schedule:
interval: weekly
commit-message:
prefix: build
178 changes: 146 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,164 @@
name: Fast CI
name: CI

on:
push:
branches-ignore: [ "master", "main" ]
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci.yml'
branches: [ "main" ]
pull_request:
branches-ignore: [ "master", "main" ]
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
workflow_dispatch:

permissions:
contents: read

# A new push to the same branch or PR cancels the run still in progress.
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: Quick Check & Test
rust:
name: Rust (fmt, clippy, test)
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v5

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

- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y cmake clang pkg-config libssl-dev

- uses: Swatinem/rust-cache@v2

- name: Formatting
run: cargo fmt --all -- --check

- name: Clippy (warnings are errors)
run: cargo clippy --all-targets --locked -- -D warnings

- name: Tests
run: cargo test --locked

msrv:
name: Rust 1.100 (minimum supported version)
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v5

- name: Install Rust 1.100
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.100"

- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y cmake clang pkg-config libssl-dev

- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo check --all-targets --locked

web:
name: Web UI (lint, type-check, build)
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v5

- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
cache-dependency-path: web/package-lock.json

- name: Install
run: npm ci

- name: Lint
run: npm run lint

- name: Type-check and build
run: npm run build

docker:
name: Docker image (build + smoke test)
# main is published by docker-image.yml; its PRs were already tested here.
if: github.event_name != 'push'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: docker/setup-buildx-action@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake clang pkg-config libssl-dev
# amd64 only: the multi-arch build and push happen in docker-image.yml.
- name: Build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
load: true
push: false
tags: proxy-manager:ci
cache-from: type=gha,scope=ci-amd64
cache-to: type=gha,scope=ci-amd64,mode=max

# 🔥 Magic Cache: Speeds up builds by 5-10x
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Start container
run: |
docker run -d --name pm \
-p 2030:2030 -p 8080:8080 \
-e PROXY_MANAGER_ADMIN_USERNAME=ci-admin \
-e PROXY_MANAGER_ADMIN_PASSWORD=ci-password \
-e JWT_SECRET=ci-secret \
proxy-manager:ci

- name: Check Formatting
run: cargo fmt -- --check
- name: Wait until healthy
run: |
for i in $(seq 1 60); do
status=$(docker inspect -f '{{.State.Health.Status}}' pm)
echo "health: $status"
[ "$status" = healthy ] && exit 0
[ "$(docker inspect -f '{{.State.Running}}' pm)" = true ] || break
sleep 2
done
docker logs pm
exit 1

- name: Check Code (Clippy)
run: cargo clippy --all-targets
- name: Smoke test
run: |
set -euo pipefail
# Dashboard is served
curl -fsS http://127.0.0.1:2030/ | grep -q '<div id="root">'
# Admin from the environment can log in, the default cannot
token=$(curl -fsS -H 'Content-Type: application/json' \
-d '{"username":"ci-admin","password":"ci-password"}' \
http://127.0.0.1:2030/api/login | jq -r .token)
test -n "$token" && test "$token" != null
code=$(curl -s -o /dev/null -w '%{http_code}' -H 'Content-Type: application/json' \
-d '{"username":"admin","password":"changeme"}' http://127.0.0.1:2030/api/login)
test "$code" = 401
# Authenticated API works
curl -fsS -H "Authorization: Bearer $token" http://127.0.0.1:2030/api/hosts > /dev/null
# Proxy port answers (unknown host -> 404)
code=$(curl -s -o /dev/null -w '%{http_code}' -H 'Host: unknown.example' http://127.0.0.1:8080/)
test "$code" = 404
# Bundled tools are present
docker exec pm certbot --version
docker exec pm certbot plugins 2>/dev/null | grep -q dns-cloudflare

- name: Run Tests
run: cargo test
- name: Container logs
if: always()
run: docker logs pm 2>&1 | tail -100
4 changes: 2 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ inputs.tag || github.ref }}

Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
type=sha,format=short

- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Security audit

# Checks dependencies against the RustSec and GitHub advisory databases.
# Runs when dependencies change and weekly, since new advisories appear
# for code that has not changed.
on:
push:
branches: [ "main" ]
paths:
- 'Cargo.lock'
- 'deny.toml'
- 'web/package-lock.json'
- '.github/workflows/security.yml'
pull_request:
paths:
- 'Cargo.lock'
- 'deny.toml'
- 'web/package-lock.json'
- '.github/workflows/security.yml'
schedule:
- cron: '17 4 * * 1'
workflow_dispatch:

permissions:
contents: read

jobs:
rust:
name: Rust advisories (cargo-deny)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check advisories

web:
name: npm advisories (production dependencies)
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
- name: npm audit
run: npm audit --omit=dev --audit-level=high
4 changes: 3 additions & 1 deletion .github/workflows/semantic-pr-title.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Semantic PR Title

# pull_request (not pull_request_target): checking the title only needs read
# access, and this never runs workflow code from the base branch with write access.
on:
pull_request_target:
pull_request:
types:
- opened
- edited
Expand Down
9 changes: 9 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# cargo-deny configuration (used by .github/workflows/security.yml).
# Run locally with: cargo deny check advisories

[advisories]
ignore = [
# chrono is marked unmaintained (no known vulnerability). It is required by
# pingora itself, so it cannot be dropped until pingora moves off it.
{ id = "RUSTSEC-2026-0543", reason = "unmaintained, no vulnerability; required by pingora" },
]
16 changes: 13 additions & 3 deletions docs/Contributing-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Please be respectful and professional in all interactions.
1. Fork the repository.
2. Create a new branch for your feature or bugfix (`git checkout -b feature/awesome-feature`).
3. Make your changes.
4. Run checks and tests (`cargo fmt -- --check`, `cargo clippy --all-targets`, `cargo test`).
4. Run the same checks CI runs (see [Development Setup](Development-Setup.md#testing)).
5. Commit your changes (`git commit -m 'Add some awesome feature'`).
6. Push to the branch (`git push origin feature/awesome-feature`).
7. Open a Pull Request.
Expand All @@ -38,8 +38,18 @@ Please be respectful and professional in all interactions.
- Follow the existing component structure in `web/src/components`.

## Build & CI
- Every PR will trigger a GitHub Action to build the server and web UI.
- Ensure the build passes before asking for a review.
Every pull request runs these checks (`.github/workflows/ci.yml`); all must pass before review:

| Check | What it runs |
| :--- | :--- |
| Rust | `cargo fmt --check`, `cargo clippy -- -D warnings` (warnings fail the build), `cargo test` |
| Rust 1.100 | `cargo check` on the minimum supported Rust version |
| Web UI | `npm run lint` and `npm run build` (type-check + production build) |
| Docker | builds the image, starts it and smoke-tests login, the API, the proxy port and certbot |

`.github/workflows/security.yml` checks Rust and npm dependencies for known vulnerabilities whenever the lockfiles change and every Monday. Dependabot opens weekly dependency update PRs (`.github/dependabot.yml`).

PR titles must follow [Conventional Commits](https://www.conventionalcommits.org/) (`feat: ...`, `fix: ...`), since release-please builds releases from them.

---
Thank you for your contribution!
24 changes: 20 additions & 4 deletions docs/Development-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,27 @@ Follow these instructions to set up a local development environment.
4. Access the dashboard at `http://localhost:5173`. The Vite dev server is configured to proxy `/api` requests to `localhost:2030`.

## Testing
### Server Tests
These are the checks CI runs on every pull request.

### Server
```bash
cargo fmt --all -- --check
cargo clippy --all-targets --locked -- -D warnings
cargo test --locked
```

### Web UI
```bash
cd web
npm run lint
npm run build
```

### Dependency audit
```bash
cargo fmt -- --check
cargo clippy --all-targets
cargo test
cargo install cargo-deny --locked # once
cargo deny check advisories # uses deny.toml
cd web && npm audit --omit=dev
```

### Docker Build Test
Expand Down
Loading
Loading