Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ jobs:
- run: uv run mypy src
# The committed core is the xhandler.wasm of the xhandler-rust release in its VERSION
- run: make verify-core
# hack/core.sh is release-tools' xhandler/core.sh
- run: make verify-core-script
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ XHANDLER_E2E=true uv run pytest tests/test_e2e.py # crea, firma y envía una fa
conformidad (`testdata/conformance/`). No los edites a mano. La versión del paquete es la del
núcleo, y una versión solo se publica con el núcleo de la versión igual de xhandler-rust:
`make verify-core` lo comprueba.
`hack/core.sh` es una copia del `xhandler/core.sh` de
[release-tools](https://github.com/project-openubl/release-tools): cámbialo allá y luego cópialo
(`make verify-core-script` lo comprueba).
- En Python está lo que necesita IO: el cliente HTTP (httpx), los reintentos y el caché de tokens
(`src/xhandler/xsender/`).
- Los nombres (`FileSender`, `SunatClient`, `SigningKey`...) se mantienen iguales en Go, Python y
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# make sync CORE=<version> the xhandler-rust v<version> release
# make sync a checkout of xhandler-rust (RUST_REPO), for development
# make verify-core checks that the committed core is the one released as its VERSION
# make verify-core-script checks that hack/core.sh is release-tools' xhandler/core.sh
# make verify-release TAG=v<version>
# what releasing <version> requires: syncing the xhandler-rust
# release of the same version changes nothing
Expand All @@ -15,7 +16,7 @@ DIST := $(if $(CORE),.dist,$(RUST_REPO)/dist)

SYNCED := src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION src/xhandler/xbuilder/models.py testdata/conformance

.PHONY: sync dist verify-core verify-release test lint
.PHONY: sync dist verify-core verify-core-script verify-release test lint

sync: dist
cp $(DIST)/xhandler.wasm $(DIST)/VERSION src/xhandler/_core/
Expand All @@ -33,6 +34,14 @@ endif
verify-core:
./hack/core.sh verify src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION

# hack/core.sh is a copy: change release-tools' xhandler/core.sh, then copy it here
CORE_SCRIPT := https://raw.githubusercontent.com/project-openubl/release-tools/main/xhandler/core.sh

verify-core-script:
@original=$$(mktemp) && trap 'rm -f "$$original"' EXIT && \
curl -fsSL -o "$$original" $(CORE_SCRIPT) && \
{ diff -u "$$original" hack/core.sh || { echo "error: hack/core.sh differs from $(CORE_SCRIPT): change it there first, then copy it" >&2; exit 1; }; }

verify-release:
./hack/core.sh verify-release $(TAG) src/xhandler/_core/xhandler.wasm src/xhandler/_core/VERSION
$(MAKE) --no-print-directory sync CORE=$(TAG:v%=%)
Expand Down
4 changes: 3 additions & 1 deletion hack/core.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
# The xhandler core (xhandler.wasm, its models and the conformance corpus) comes from the
# releases of xhandler-rust, which attach xhandler-dist-<version>.tar.gz, xhandler.wasm and
# SHA256SUMS. This script is identical in xhandler-go, xhandler-python and xhandler-java.
# SHA256SUMS. The original is project-openubl/release-tools' xhandler/core.sh: change it there,
# then copy it to xhandler-go, xhandler-python and xhandler-java (`make verify-core-script` there
# checks the copy).
#
# core.sh download <version> <dir>
# extracts the release's dist into <dir>
Expand Down
Loading