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
3 changes: 3 additions & 0 deletions .forgejo/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ jobs:

- name: Run tests
run: cargo test

- name: Verify package contents
run: ./scripts/verify-package.sh
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ jobs:

- name: Run tests
run: cargo test

- name: Verify package contents
run: ./scripts/verify-package.sh
Comment on lines +52 to +53
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mirror package verification into Forgejo CI

Checked both CI definitions in this repo: .github/workflows/ci.yml now runs ./scripts/verify-package.sh, but .forgejo/workflows/ci.yml still stops after cargo test. If PRs or release branches are validated on the Forgejo runner, missing packaged assets or leaked excluded files will still pass there, so this automation only protects one of the maintained CI entry points.

Useful? React with 👍 / 👎.

3 changes: 3 additions & 0 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@ jobs:
- name: Dry-run publish
run: cargo publish --dry-run

- name: Verify package contents
run: ./scripts/verify-package.sh

- name: Publish solverforge-ui
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ JS_SRC := $(sort $(wildcard js-src/*.js))

# ============== Phony Targets ==============
.PHONY: banner help assets build build-release test test-quick test-doc test-unit test-one \
lint fmt fmt-check clippy ci-local pre-release version \
lint fmt fmt-check clippy ci-local pre-release version package-verify \
bump-patch bump-minor bump-major bump-dry \
publish-dry publish clean watch

Expand Down Expand Up @@ -195,9 +195,16 @@ pre-release: banner
@cargo test --quiet && printf "$(GREEN)$(CHECK) All tests passed$(RESET)\n"
@printf "$(PROGRESS) Dry-run publish...\n"
@cargo publish --dry-run 2>&1 | tail -1
@printf "$(PROGRESS) Verifying packaged contents...\n"
@./scripts/verify-package.sh
@printf "$(GREEN)$(CHECK) Package valid$(RESET)\n"
@printf "\n$(GREEN)$(BOLD)$(CHECK) Ready for release v$(VERSION)$(RESET)\n\n"

package-verify:
@printf "$(PROGRESS) Verifying packaged crate contents...\n"
@./scripts/verify-package.sh
@printf "$(GREEN)$(CHECK) Package contents verified$(RESET)\n"

# ============== Publishing ==============

publish-dry: test banner
Expand All @@ -206,6 +213,7 @@ publish-dry: test banner
@printf "$(CYAN)$(BOLD)╚══════════════════════════════════════════════════════════╝$(RESET)\n\n"
@printf "$(GREEN)$(CHECK) All tests passed$(RESET)\n"
@cargo publish --dry-run && \
./scripts/verify-package.sh && \
printf "$(GREEN)$(CHECK) Package valid$(RESET)\n" || \
(printf "$(RED)$(CROSS) Package validation failed$(RESET)\n" && exit 1)
@printf "\n$(GRAY)Use 'make publish' to publish v$(VERSION) to crates.io$(RESET)\n\n"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,12 @@ Consumer integration stays npm-free. Maintainer release automation does not.

If you are cutting a release locally, make sure Node.js with `npx` is available before using the `bump-*` targets. After the bump completes, push the release commit and tag with `git push --follow-tags` or an equivalent tag-push command so the release automation actually starts.

## Package Verification

Use `make package-verify` to inspect the exact crate contents that would be published.

The verification step checks that required bundled assets and crate metadata are present, and that development-only sources such as `css-src/`, `js-src/`, `scripts/`, and screenshots are not shipped in the published crate.

## Acknowledgments

solverforge-ui builds on these excellent open-source projects:
Expand Down
72 changes: 72 additions & 0 deletions scripts/verify-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash
set -euo pipefail

manifest="$(mktemp)"
trap 'rm -f "$manifest"' EXIT

cargo package --allow-dirty --list > "$manifest"

if command -v rg >/dev/null 2>&1; then
search_exact() {
rg -Fxq "$1" "$manifest"
}

search_prefix() {
rg -q "^$1" "$manifest"
}
else
search_exact() {
grep -Fxq "$1" "$manifest"
}

search_prefix() {
grep -Eq "^$1" "$manifest"
}
fi

require() {
local path="$1"
if ! search_exact "$path"; then
echo "missing packaged file: $path" >&2
exit 1
fi
}

reject_prefix() {
local prefix="$1"
if search_prefix "$prefix"; then
echo "unexpected packaged path matching prefix: $prefix" >&2
exit 1
fi
}

reject_exact() {
local path="$1"
if search_exact "$path"; then
echo "unexpected packaged file: $path" >&2
exit 1
fi
}

require "Cargo.toml"
require "Cargo.lock"
require "README.md"
require "LICENSE"
require "CHANGELOG.md"
require "src/lib.rs"
require "static/sf/sf.css"
require "static/sf/sf.js"
require "static/sf/vendor/frappe-gantt/frappe-gantt.min.js"
require "static/sf/vendor/split/split.min.js"
require "static/sf/fonts/space-grotesk.woff2"
require "static/sf/fonts/jetbrains-mono.woff2"
require "static/sf/img/solverforge-logo.svg"

reject_prefix "css-src/"
reject_prefix "js-src/"
reject_prefix "screenshots/"
reject_prefix "scripts/"
reject_exact "WIREFRAME.md"
reject_exact ".versionrc.json"

echo "package contents verified"
Loading