mirror of
https://github.com/ratspeak/rsLXMF
synced 2026-11-22 23:10:35 +00:00
release: prepare LXMF 1.3.0 and archive qualification
This commit is contained in:
1 parent
628162a41c
commit
f8753b5f33
9 files changed
+175
-25
No files matched your search
@@ -10,7 +10,7 @@ permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
RSLXMF_RSRETICULUM_COMMIT: 032c3fd6d359bd5b3068a67b2a5a4c149610ea04
|
||||
RSLXMF_RSRETICULUM_COMMIT: 6a425e8d5afb961316a5935d9a157a4b01776983
|
||||
|
||||
jobs:
|
||||
api-compat:
|
||||
|
||||
@@ -7,18 +7,25 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag_name:
|
||||
description: "Release tag to create or update"
|
||||
description: "Version tag (also used for untagged qualification)"
|
||||
required: true
|
||||
qualify_only:
|
||||
description: "Build and verify archives without publishing or creating a tag"
|
||||
type: boolean
|
||||
default: true
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
env:
|
||||
SOURCE_REF: ${{ github.sha }}
|
||||
RELEASE_TAG: ${{ github.event.inputs.tag_name || github.ref_name }}
|
||||
PACKAGE_ROOT: rsLXMF
|
||||
LXMF_BINS: lxmd-rs
|
||||
RSLXMF_RSRETICULUM_VERSION: 1.3.0
|
||||
RSLXMF_RSRETICULUM_COMMIT: 032c3fd6d359bd5b3068a67b2a5a4c149610ea04
|
||||
RSLXMF_RSRETICULUM_COMMIT: 6a425e8d5afb961316a5935d9a157a4b01776983
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
@@ -28,7 +35,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
||||
with:
|
||||
ref: ${{ env.RELEASE_TAG }}
|
||||
ref: ${{ env.SOURCE_REF }}
|
||||
path: rsLXMF
|
||||
fetch-depth: 0
|
||||
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
||||
@@ -41,7 +48,20 @@ jobs:
|
||||
toolchain: 1.89.0
|
||||
- name: Verify release source and dependency
|
||||
working-directory: rsLXMF
|
||||
run: python3 scripts/ci/check_source_release_contract.py --release-tag "${RELEASE_TAG}"
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
QUALIFY_ONLY: ${{ github.event_name == 'workflow_dispatch' && inputs.qualify_only }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test "$(git rev-parse HEAD)" = "${SOURCE_REF}"
|
||||
gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/ci.yml/runs?head_sha=${SOURCE_REF}&event=push&per_page=100" \
|
||||
--jq '.workflow_runs | any(.head_sha == env.SOURCE_REF and .conclusion == "success")' | grep -qx true
|
||||
if [[ "${QUALIFY_ONLY}" == "true" ]]; then
|
||||
python3 scripts/ci/check_source_release_contract.py --candidate-tag "${RELEASE_TAG}"
|
||||
else
|
||||
python3 scripts/ci/check_source_release_contract.py --release-tag "${RELEASE_TAG}"
|
||||
fi
|
||||
|
||||
build:
|
||||
name: Build ${{ matrix.artifact_suffix }}
|
||||
@@ -66,7 +86,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
||||
with:
|
||||
ref: ${{ env.RELEASE_TAG }}
|
||||
ref: ${{ env.SOURCE_REF }}
|
||||
path: rsLXMF
|
||||
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
||||
with:
|
||||
@@ -90,6 +110,11 @@ jobs:
|
||||
working-directory: rsLXMF
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for bin in ${LXMF_BINS}; do
|
||||
suffix=""
|
||||
if [[ "${RUNNER_OS}" == "Windows" ]]; then suffix=".exe"; fi
|
||||
"target/release/${bin}${suffix}" --version
|
||||
done
|
||||
mkdir -p "dist/${PACKAGE_ROOT}/bin"
|
||||
for bin in ${LXMF_BINS}; do
|
||||
if [[ "${RUNNER_OS}" == "Windows" ]]; then
|
||||
@@ -117,20 +142,40 @@ jobs:
|
||||
rsLXMF/*.zip
|
||||
if-no-files-found: error
|
||||
|
||||
package:
|
||||
name: Verify release archives
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
||||
with:
|
||||
ref: ${{ env.SOURCE_REF }}
|
||||
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
|
||||
with:
|
||||
pattern: rsLXMF-*
|
||||
path: release-assets
|
||||
merge-multiple: true
|
||||
- name: Verify archive inventory and generate checksums
|
||||
run: python3 scripts/ci/check_release_archives.py --tag "${RELEASE_TAG}" --directory release-assets
|
||||
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: verified-release-assets
|
||||
path: release-assets/*
|
||||
if-no-files-found: error
|
||||
|
||||
publish:
|
||||
name: Publish GitHub release
|
||||
needs: build
|
||||
if: github.event_name == 'push' || !inputs.qualify_only
|
||||
needs: package
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
|
||||
with:
|
||||
name: verified-release-assets
|
||||
path: release-assets
|
||||
merge-multiple: true
|
||||
- name: Generate checksums
|
||||
working-directory: release-assets
|
||||
run: sha256sum * > SHA256SUMS
|
||||
- uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE_TAG }}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 1.3.0 - 2026-10-12
|
||||
|
||||
### Added
|
||||
|
||||
- Added delivery readiness hooks so applications can react promptly to incoming Link traffic and local send completion.
|
||||
|
||||
Generated
+2
-2
@@ -643,7 +643,7 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
|
||||
[[package]]
|
||||
name = "lxmf-core"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
@@ -670,7 +670,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lxmf-tools"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
edition = "2024"
|
||||
license = "AGPL-3.0-or-later"
|
||||
rust-version = "1.89"
|
||||
@@ -23,8 +23,8 @@ rns-runtime = { path = "../rsReticulum/crates/rns-runtime", version = "~1.3.0" }
|
||||
rns-interface = { path = "../rsReticulum/crates/rns-interface", version = "~1.3.0" }
|
||||
|
||||
# Workspace LXMF crates
|
||||
lxmf-core = { path = "crates/lxmf-core", version = "1.2.0" }
|
||||
lxmf-tools = { path = "crates/lxmf-tools", version = "1.2.0" }
|
||||
lxmf-core = { path = "crates/lxmf-core", version = "1.3.0" }
|
||||
lxmf-tools = { path = "crates/lxmf-tools", version = "1.3.0" }
|
||||
|
||||
# Encoding
|
||||
base64 = "0.22"
|
||||
|
||||
Generated
+1
-1
@@ -287,7 +287,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lxmf-core"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"packages": [
|
||||
{
|
||||
"name": "lxmf-core",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"rustVersion": "1.89",
|
||||
"edition": "2024",
|
||||
"features": {},
|
||||
@@ -238,7 +238,7 @@
|
||||
},
|
||||
{
|
||||
"name": "lxmf-tools",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"rustVersion": "1.89",
|
||||
"edition": "2024",
|
||||
"features": {},
|
||||
@@ -306,7 +306,7 @@
|
||||
"rename": null,
|
||||
"kind": null,
|
||||
"target": null,
|
||||
"requirement": "^1.2.0",
|
||||
"requirement": "^1.3.0",
|
||||
"optional": false,
|
||||
"defaultFeatures": true,
|
||||
"features": [],
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify the complete CLI archive set before checksumming or publishing it."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
import re
|
||||
import tarfile
|
||||
import zipfile
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
PACKAGE = "rsLXMF"
|
||||
BINS = ["lxmd-rs"]
|
||||
DOCS = ("README.md", "LICENSE", "CHANGELOG.md")
|
||||
PLATFORMS = {"linux-x86_64": "tar.gz", "macos": "tar.gz", "windows-x86_64": "zip"}
|
||||
|
||||
|
||||
def verify(directory: Path, tag: str) -> None:
|
||||
if not re.fullmatch(r"v\d+\.\d+\.\d+", tag):
|
||||
raise ValueError("expected a vX.Y.Z tag")
|
||||
names = {f"{PACKAGE}-{tag}-{platform}.{extension}" for platform, extension in PLATFORMS.items()}
|
||||
if {p.name for p in directory.iterdir()} != names:
|
||||
raise ValueError("release directory must contain exactly the three platform archives")
|
||||
for platform, extension in PLATFORMS.items():
|
||||
path = directory / f"{PACKAGE}-{tag}-{platform}.{extension}"
|
||||
payloads = {}
|
||||
if extension == "zip":
|
||||
with zipfile.ZipFile(path) as archive:
|
||||
for member in archive.infolist():
|
||||
if member.is_dir():
|
||||
continue
|
||||
name = member.filename.replace("\\", "/")
|
||||
if name in payloads:
|
||||
raise ValueError(f"duplicate archive member: {name}")
|
||||
payloads[name] = archive.read(member)
|
||||
else:
|
||||
with tarfile.open(path) as archive:
|
||||
for member in archive.getmembers():
|
||||
if member.isdir():
|
||||
continue
|
||||
if not member.isfile() or member.name in payloads:
|
||||
raise ValueError(f"invalid archive member: {member.name}")
|
||||
if "/bin/" in member.name and not member.mode & 0o111:
|
||||
raise ValueError(f"binary is not executable: {member.name}")
|
||||
stream = archive.extractfile(member)
|
||||
assert stream is not None
|
||||
payloads[member.name] = stream.read()
|
||||
suffix = ".exe" if extension == "zip" else ""
|
||||
expected = {f"{PACKAGE}/{doc}" for doc in DOCS} | {f"{PACKAGE}/bin/{name}{suffix}" for name in BINS}
|
||||
if set(payloads) != expected:
|
||||
raise ValueError(f"incorrect file inventory in {path.name}: {sorted(payloads)}")
|
||||
for doc in DOCS:
|
||||
if payloads[f"{PACKAGE}/{doc}"] != (ROOT / doc).read_bytes():
|
||||
raise ValueError(f"{path.name}: {doc} does not match the qualified source")
|
||||
for name in BINS:
|
||||
data = payloads[f"{PACKAGE}/bin/{name}{suffix}"]
|
||||
valid = (
|
||||
data.startswith(b"\x7fELF") if platform.startswith("linux") else
|
||||
data.startswith(b"MZ") if platform.startswith("windows") else
|
||||
data[:4] in (b"\xcf\xfa\xed\xfe", b"\xfe\xed\xfa\xcf", b"\xca\xfe\xba\xbe")
|
||||
)
|
||||
if not valid:
|
||||
raise ValueError(f"{path.name}: {name} is not a native binary for {platform}")
|
||||
checksums = "".join(f"{hashlib.sha256((directory / name).read_bytes()).hexdigest()} {name}\n" for name in sorted(names))
|
||||
(directory / "SHA256SUMS").write_text(checksums)
|
||||
print(f"verified {PACKAGE} {tag}: three platform archives, native binaries, source documentation, and checksums")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--tag", required=True)
|
||||
parser.add_argument("--directory", type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
verify(args.directory, args.tag)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -96,8 +96,12 @@ def check_release_workflow(reticulum_version: str) -> str:
|
||||
|
||||
if not re.search(r"^\s*toolchain:\s*1\.89\.0\s*$", workflow, re.MULTILINE):
|
||||
fail("release workflow does not select Rust 1.89.0")
|
||||
if "ref: ${{ env.RELEASE_TAG }}" not in workflow:
|
||||
fail("release workflow does not check out RELEASE_TAG")
|
||||
if "ref: ${{ env.SOURCE_REF }}" not in workflow or "SOURCE_REF: ${{ github.sha }}" not in workflow:
|
||||
fail("release workflow must check out the immutable event commit")
|
||||
if " if: github.event_name == 'push' || !inputs.qualify_only\n needs: package" not in workflow:
|
||||
fail("publication must exclude qualification and require verified archives")
|
||||
if "--candidate-tag" not in workflow or "actions/workflows/ci.yml/runs?head_sha=" not in workflow:
|
||||
fail("release workflow must qualify untagged sources and require exact-source CI")
|
||||
|
||||
version_match = re.search(
|
||||
r"^\s*RSLXMF_RSRETICULUM_VERSION:\s*(\S+)\s*$", workflow, re.MULTILINE
|
||||
@@ -162,7 +166,7 @@ def check_documentation(version: str) -> None:
|
||||
fail("README.md contains an unlocked release build command")
|
||||
|
||||
|
||||
def check_release_tag(release_tag: str, version: str, dependency_commit: str) -> None:
|
||||
def check_release_tag(release_tag: str, version: str) -> None:
|
||||
if not re.fullmatch(r"v\d+\.\d+\.\d+", release_tag):
|
||||
fail("release tags must have the form vX.Y.Z")
|
||||
expected_tag = f"v{version}"
|
||||
@@ -184,6 +188,8 @@ def check_release_tag(release_tag: str, version: str, dependency_commit: str) ->
|
||||
if head != tagged_commit:
|
||||
fail(f"HEAD {head} is not the commit named by {release_tag} ({tagged_commit})")
|
||||
|
||||
|
||||
def check_dependency(dependency_commit: str) -> None:
|
||||
dependency_root = ROOT.parent / "rsReticulum"
|
||||
if not dependency_root.is_dir():
|
||||
fail(f"rsReticulum checkout is missing at {dependency_root}")
|
||||
@@ -194,9 +200,21 @@ def check_release_tag(release_tag: str, version: str, dependency_commit: str) ->
|
||||
)
|
||||
|
||||
|
||||
def check_candidate_tag(tag: str, version: str) -> None:
|
||||
if not re.fullmatch(r"v\d+\.\d+\.\d+", tag) or tag != f"v{version}":
|
||||
fail("candidate tag must match the workspace version as vX.Y.Z")
|
||||
result = subprocess.run(
|
||||
["git", "show-ref", "--verify", "--quiet", f"refs/tags/{tag}"], cwd=ROOT
|
||||
)
|
||||
if result.returncode != 1:
|
||||
fail("candidate qualification requires an untagged version")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--release-tag")
|
||||
tags = parser.add_mutually_exclusive_group()
|
||||
tags.add_argument("--release-tag")
|
||||
tags.add_argument("--candidate-tag")
|
||||
args = parser.parse_args()
|
||||
|
||||
version, reticulum_version = check_packages(metadata())
|
||||
@@ -208,8 +226,12 @@ def main() -> None:
|
||||
cwd=ROOT,
|
||||
check=True,
|
||||
)
|
||||
if args.candidate_tag or args.release_tag:
|
||||
check_dependency(dependency_commit)
|
||||
if args.candidate_tag:
|
||||
check_candidate_tag(args.candidate_tag, version)
|
||||
if args.release_tag:
|
||||
check_release_tag(args.release_tag, version, dependency_commit)
|
||||
check_release_tag(args.release_tag, version)
|
||||
print(f"source-release contract passed for rsLXMF {version}")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user