Skip to content

Commit f5cb76c

Browse files
authored
feat: modernize embedded PGlite API and OSS tooling (#3)
1 parent 2d7ec8c commit f5cb76c

67 files changed

Lines changed: 13507 additions & 3468 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.config/nextest.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[profile.default]
2+
slow-timeout = { period = "10s", terminate-after = 6, grace-period = "0s" }
3+
status-level = "fail"
4+
final-status-level = "fail"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Bug report
2+
description: Report incorrect behavior in pglite-oxide.
3+
title: "bug: "
4+
labels: ["bug"]
5+
body:
6+
- type: textarea
7+
id: summary
8+
attributes:
9+
label: Summary
10+
description: What happened, and what did you expect?
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: repro
15+
attributes:
16+
label: Reproduction
17+
description: Minimal Rust code or commands that reproduce the issue.
18+
render: rust
19+
validations:
20+
required: true
21+
- type: input
22+
id: versions
23+
attributes:
24+
label: Versions
25+
description: pglite-oxide, Rust, OS, and architecture.
26+
validations:
27+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: true
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Feature request
2+
description: Suggest a focused API, runtime, or packaging improvement.
3+
title: "feat: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: textarea
7+
id: use_case
8+
attributes:
9+
label: Use case
10+
description: What are you trying to build?
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: proposal
15+
attributes:
16+
label: Proposal
17+
description: The API or behavior you want.
18+
validations:
19+
required: true

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: cargo
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
cargo-patch:
9+
update-types: [patch]
10+
cargo-minor:
11+
update-types: [minor]
12+
cargo-major:
13+
update-types: [major]
14+
- package-ecosystem: github-actions
15+
directory: /
16+
schedule:
17+
interval: weekly
18+
groups:
19+
actions:
20+
patterns: ["*"]

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Summary
2+
3+
## Release Intent
4+
5+
- [ ] Package/API/runtime change: PR title uses `feat:`, `fix:`, `perf:`, `refactor:`, `revert:`, or a breaking `!`.
6+
- [ ] Docs/CI/repository-only change: no release intended.
7+
8+
## Verification
9+
10+
- [ ] `cargo fmt --all --check`
11+
- [ ] `cargo clippy --all-targets -- -D warnings`
12+
- [ ] `cargo test --doc`
13+
- [ ] `cargo test --test runtime_smoke -- --nocapture`
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
subject="${1:-}"
5+
6+
if [[ -z "${subject}" ]]; then
7+
echo "expected a non-empty commit subject or PR title" >&2
8+
exit 1
9+
fi
10+
11+
pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9][a-z0-9._/-]*\))?(!)?: .+'
12+
13+
if [[ ! "${subject}" =~ ${pattern} ]]; then
14+
cat >&2 <<EOF
15+
Expected Conventional Commits format:
16+
<type>(optional-scope)!: <description>
17+
18+
Allowed types:
19+
build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test
20+
21+
Received:
22+
${subject}
23+
EOF
24+
exit 1
25+
fi
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
subject="${1:-}"
5+
base_ref="${2:-origin/main}"
6+
head_ref="${3:-HEAD}"
7+
head_branch="${4:-}"
8+
9+
if [[ -z "${subject}" ]]; then
10+
echo "expected a non-empty PR title or commit subject" >&2
11+
exit 1
12+
fi
13+
14+
release_pattern='^((feat|fix|perf|refactor|revert)(\([a-z0-9][a-z0-9._/-]*\))?(!)?|[a-z]+(\([a-z0-9][a-z0-9._/-]*\))?!): .+'
15+
release_pr_pattern='^chore\(release\): .+'
16+
17+
affected_files=()
18+
19+
while IFS= read -r file; do
20+
[[ -z "${file}" ]] && continue
21+
22+
case "${file}" in
23+
Cargo.toml | Cargo.lock | build.rs | src/* | assets/* | examples/* | benches/*)
24+
affected_files+=("${file}")
25+
;;
26+
esac
27+
done < <(git diff --name-only "${base_ref}...${head_ref}" --)
28+
29+
if (( ${#affected_files[@]} == 0 )); then
30+
exit 0
31+
fi
32+
33+
if [[ "${subject}" =~ ${release_pattern} ]]; then
34+
exit 0
35+
fi
36+
37+
if [[ "${subject}" =~ ${release_pr_pattern} && "${head_branch}" == release-plz-* ]]; then
38+
exit 0
39+
fi
40+
41+
cat >&2 <<EOF
42+
This PR changes release-affecting package files, but its title does not carry
43+
release intent for release-plz.
44+
45+
Use one of these Conventional Commit types in the PR title:
46+
feat, fix, perf, refactor, revert
47+
48+
Breaking changes may use any type with !, for example:
49+
chore!: remove a deprecated API
50+
51+
release-plz PRs are exempt only when their branch starts with release-plz- and
52+
their title starts with chore(release):.
53+
54+
Docs, CI, issue-template, and repository-only changes can keep non-release types
55+
such as docs:, ci:, chore:, style:, or test: when they do not touch package code.
56+
57+
Received:
58+
${subject}
59+
60+
Release-affecting files:
61+
EOF
62+
63+
printf ' %s\n' "${affected_files[@]}" >&2
64+
exit 1

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ci-${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
RUST_BACKTRACE: 1
18+
19+
jobs:
20+
checks:
21+
name: Rust checks
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 30
24+
steps:
25+
- uses: actions/checkout@v6
26+
- uses: dtolnay/rust-toolchain@master
27+
with:
28+
toolchain: 1.92
29+
components: rustfmt, clippy
30+
- uses: Swatinem/rust-cache@v2
31+
- name: Format
32+
run: cargo fmt --all --check
33+
- name: Check default features
34+
run: cargo check --all-targets --locked
35+
- name: Check no default features
36+
run: cargo check --no-default-features --all-targets --locked
37+
- name: Clippy
38+
run: cargo clippy --all-targets --locked -- -D warnings
39+
- name: Unit and binary tests
40+
run: cargo test --lib --bins --locked
41+
- name: Doctests
42+
run: cargo test --doc --locked
43+
- name: Package
44+
run: cargo package --locked
45+
46+
runtime-smoke:
47+
name: Embedded Postgres smoke
48+
runs-on: ubuntu-latest
49+
timeout-minutes: 45
50+
steps:
51+
- uses: actions/checkout@v6
52+
- uses: dtolnay/rust-toolchain@master
53+
with:
54+
toolchain: 1.92
55+
- uses: Swatinem/rust-cache@v2
56+
- name: Runtime smoke
57+
run: cargo test --test runtime_smoke --locked -- --nocapture
58+
- name: Proxy smoke
59+
run: cargo test --test proxy_smoke --locked -- --nocapture
60+
- name: Client compatibility
61+
run: cargo test --test client_compat --locked -- --nocapture
62+
63+
supply-chain:
64+
name: Supply chain
65+
runs-on: ubuntu-latest
66+
timeout-minutes: 10
67+
steps:
68+
- uses: actions/checkout@v6
69+
- uses: EmbarkStudios/cargo-deny-action@v2
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Conventional Commits
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened, ready_for_review]
6+
push:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
13+
concurrency:
14+
group: conventional-commits-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
conventional:
19+
name: Validate commit and PR title
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 5
22+
steps:
23+
- uses: actions/checkout@v6
24+
with:
25+
fetch-depth: 0
26+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
27+
- name: Check PR title
28+
if: github.event_name == 'pull_request'
29+
env:
30+
PR_TITLE: ${{ github.event.pull_request.title }}
31+
run: ./.github/scripts/check-conventional-commit.sh "$PR_TITLE"
32+
- name: Check release intent for package changes
33+
if: github.event_name == 'pull_request'
34+
env:
35+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
36+
HEAD_BRANCH: ${{ github.event.pull_request.head.ref }}
37+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
38+
PR_TITLE: ${{ github.event.pull_request.title }}
39+
run: ./.github/scripts/check-release-intent.sh "$PR_TITLE" "$BASE_SHA" "$HEAD_SHA" "$HEAD_BRANCH"
40+
- name: Check HEAD commit subject
41+
run: ./.github/scripts/check-conventional-commit.sh "$(git log -1 --pretty=%s)"

0 commit comments

Comments
 (0)