Skip to content
Open
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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ jobs:
with:
bins: cargo-nextest, cargo-insta@1.28.0
- run: just test-unit
package-check:
name: cargo package check (opsqueue)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- uses: extractions/setup-crate@4993624604c307fbca528d28a3c8b60fa5ecc859 # v1.4.0
with:
repo: casey/just
version: 1.42.4
- uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2
- run: just package-check
test-integration:
name: Integration test (& build all in dev-mode)
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ repos:
language: system
types: [rust]
pass_filenames: false
- id: sqlx-prepare-check
name: sqlx prepare --check (offline query cache fresh)
entry: just sqlx-check
language: system
files: ^opsqueue/(src/.*\.rs|migrations/.*\.sql|\.sqlx/.*)$
pass_filenames: false
- id: nixfmt
name: nixfmt
entry: nixfmt --strict
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
]

[workspace.package]
version = "0.35.1"
version = "0.35.2"

[workspace.lints.clippy]
cargo = { level = "warn", priority = -1 }
Expand Down
49 changes: 49 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,52 @@ nix-build-python: (_nix-build "python.pkgs.opsqueue_python")

_nix-build +TARGETS:
nix build --file nix/nixpkgs-pinned.nix --print-out-paths --print-build-logs --no-link --option sandbox true {{TARGETS}}

# Verify `cargo package` for the opsqueue crate contains every file the lib +
# bin + embedded migrations need at compile time. Catches regressions where the
# `include` allow-list in opsqueue/Cargo.toml strips required files from the
# published / vendored crate (broke downstream git-source consumers in the past).
[group('test')]
package-check:
#!/usr/bin/env bash
set -euo pipefail
files=$(cargo package -p opsqueue --list --allow-dirty)
required=(
"src/lib.rs"
"app/main.rs"
"build.rs"
"LICENSE"
"opsqueue_example_database_schema.db"
)
missing=()
for f in "${required[@]}"; do
if ! grep -qxF "$f" <<<"$files"; then
missing+=("$f")
fi
done
if ! grep -qE '^migrations/.*\.sql$' <<<"$files"; then
missing+=("migrations/*.sql")
fi
if ! grep -qE '^\.sqlx/query-.*\.json$' <<<"$files"; then
missing+=(".sqlx/query-*.json")
fi
if ((${#missing[@]})); then
echo "package-check: missing from cargo package output:" >&2
printf ' - %s\n' "${missing[@]}" >&2
exit 1
fi
cargo package -p opsqueue --no-verify --allow-dirty >/dev/null
echo "package-check: OK"

# Verify the sqlx offline query cache (`opsqueue/.sqlx/`) is in sync with the
# `query!`/`query_as!` invocations in the source tree. Required so downstream
# offline (Crane/Nix) builds of the published crate that enable `server-logic`
# can compile without a live SQLite database.
[group('lint')]
sqlx-check:
#!/usr/bin/env bash
set -euo pipefail
cd opsqueue
DATABASE_URL="sqlite://$PWD/opsqueue_example_database_schema.db" \
cargo sqlx prepare --check -- --all-targets
echo "sqlx-check: OK"

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.

This file was deleted.

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.

This file was deleted.

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.

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

Loading
Loading