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
41 changes: 39 additions & 2 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ jobs:
env:
CARGO_TARGET_TRIPLE: ${{ inputs.rust-target != 'x86_64-unknown-linux-gnu' && inputs.rust-target || '' }}
run: |
# REL-009: darwin keeps a packed .dSYM for the symbols sidecar;
# Linux stays split-debuginfo "off" and is split post-link.
case "${{ inputs.rust-target }}" in
*apple-darwin)
export CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO=packed
# Persist for every later Cargo invocation in this job.
echo "CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO=packed" >> "$GITHUB_ENV"
;;
esac
if [ -n "$CARGO_TARGET_TRIPLE" ]; then
soldr cargo build --release --bin fastled --target "$CARGO_TARGET_TRIPLE"
case "$CARGO_TARGET_TRIPLE" in
Expand All @@ -144,9 +153,27 @@ jobs:
BIN_SRC="target/release/${EXE_NAME}"
fi
fi
echo "FASTLED_BIN_SRC=$BIN_SRC" >> "$GITHUB_ENV"
echo "FASTLED_EXE_NAME=$EXE_NAME" >> "$GITHUB_ENV"
ls -lh "$BIN_SRC"

# REL-009 (#296): move the line tables into
# fastled-v<version>-<triple>-symbols.tar.zst and slim the cargo output
# in place (setup.py re-copies it into the wheel), before Authenticode
# signing so the signed bytes are the shipped bytes. A missing sidecar
# fails the build.
- name: Split debug symbols into the release sidecar
env:
RUST_TARGET: ${{ inputs.rust-target }}
run: |
if [ -z "$RUST_TARGET" ]; then
echo "::error::REL-009 sidecars need an explicit rust-target" >&2
exit 1
fi
python ci/stage_symbols.py stage --binary "$FASTLED_BIN_SRC" --triple "$RUST_TARGET" --out symbols
mkdir -p src/fastled/bin
cp -f "$BIN_SRC" "src/fastled/bin/${EXE_NAME}"
ls -lh src/fastled/bin/
cp -f "$FASTLED_BIN_SRC" "src/fastled/bin/${FASTLED_EXE_NAME}"
ls -lh src/fastled/bin/ symbols/

# Azure Artifact Signing (Authenticode), OIDC only. Signs the cargo
# output in place (setup.py re-copies it into the wheel) and the bundled
Expand Down Expand Up @@ -184,6 +211,9 @@ jobs:
# Native for x86_64 Linux, for the same reason as the build step.
FASTLED_RUST_TARGET: ${{ inputs.rust-target != 'x86_64-unknown-linux-gnu' && inputs.rust-target || '' }}
run: |
# REL-009 (#296): ship the stripped (and signed) binary staged above;
# setup.py must not rebuild it, or the sidecar would not match.
export FASTLED_STAGED_BINARY="$FASTLED_BIN_SRC"
PLAT_NAME=""
case "${{ inputs.rust-target }}" in
aarch64-pc-windows-msvc) PLAT_NAME="win_arm64" ;;
Expand Down Expand Up @@ -253,6 +283,13 @@ jobs:
path: src/fastled/bin/fastled*
if-no-files-found: error

- name: Upload debug-symbol sidecar
uses: actions/upload-artifact@v4
with:
name: symbols-${{ inputs.runs-on }}-${{ inputs.rust-target || 'native' }}
path: symbols/*-symbols.tar.zst
if-no-files-found: error

- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ jobs:
with:
pattern: binary-*
path: binaries
- uses: actions/download-artifact@v4
with:
pattern: symbols-*
path: symbols
- name: Check debug-symbol sidecars before tagging (REL-009)
env:
VERSION: ${{ needs.detect-version.outputs.version }}
run: python ci/stage_symbols.py check --symbols symbols --version "$VERSION"
- name: Check wheel and binary artifacts before tagging
env:
VERSION: ${{ needs.detect-version.outputs.version }}
Expand Down Expand Up @@ -310,6 +318,17 @@ jobs:
pattern: binary-*
path: binaries

- uses: actions/checkout@v5
with:
ref: ${{ inputs.candidate_sha }}
path: src

- name: Download debug-symbol sidecars
uses: actions/download-artifact@v4
with:
pattern: symbols-*
path: symbols

- name: Prepare release files
shell: bash
run: |
Expand All @@ -326,12 +345,16 @@ jobs:
esac
done
cd ..
# REL-009: one sidecar per target; a missing one fails the release.
python src/ci/stage_symbols.py check --symbols symbols --version "${{ needs.detect-version.outputs.version }}"
find symbols -name '*-symbols.tar.zst' -exec cp {} release/ \;
python src/ci/stage_symbols.py sums --dir release
ls -la release/

- name: Sign release artifacts with sigstore
uses: sigstore/gh-action-sigstore-python@v3.3.0
with:
inputs: ./release/*.zip
inputs: ./release/*.zip ./release/*-symbols.tar.zst ./release/SHA256SUMS
release-signing-artifacts: true

- name: Create GitHub Release
Expand All @@ -340,6 +363,8 @@ jobs:
tag_name: v${{ needs.detect-version.outputs.version }}
files: |
release/*.zip
release/*-symbols.tar.zst
release/SHA256SUMS
release/*.sigstore
draft: false
prerelease: false
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ kernal-api = { version = "=0.1.19", features = ["fs", "fs-watch", "hash-sha256",

[profile.release]
debug = "line-tables-only"
split-debuginfo = "packed"
# REL-009 (#296): ci/stage_symbols.py carves the line tables into a
# per-target -symbols.tar.zst sidecar after linking. Linux stays "off"
# (post-link objcopy split); darwin release builds override to "packed" via
# CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO in _build.yml for the .dSYM.
split-debuginfo = "off"
strip = "none"

[profile.dev.package.kernal-api]
Expand Down
50 changes: 50 additions & 0 deletions ci/release_artifact_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,48 @@
"aarch64-apple-darwin": "macosx_11_0_arm64",
}
MAX_WHEEL_BYTES = 100_000_000 # Conservative PyPI per-file limit.
# REL-009 owner rule (#296): debug symbols ship only as GitHub release
# sidecars, never inside a wheel.
SYMBOL_SUFFIXES = (".pdb", ".debug", ".dwp", ".dwo", "-symbols.tar.zst")


def _elf_debug_sections(data: bytes) -> list[str]:
"""Names of .debug_*/.zdebug_* sections in a little-endian ELF64 image."""
if len(data) < 64 or data[:4] != b"\x7fELF" or data[4:6] != b"\x02\x01":
return []
shoff = int.from_bytes(data[0x28:0x30], "little")
shentsize = int.from_bytes(data[0x3A:0x3C], "little")
shnum = int.from_bytes(data[0x3C:0x3E], "little")
shstrndx = int.from_bytes(data[0x3E:0x40], "little")
if shentsize < 64 or shstrndx >= shnum or shoff + shnum * shentsize > len(data):
return []

def header(index: int) -> bytes:
start = shoff + index * shentsize
return data[start : start + 64]

strtab = header(shstrndx)
str_off = int.from_bytes(strtab[0x18:0x20], "little")
str_size = int.from_bytes(strtab[0x20:0x28], "little")
names = data[str_off : str_off + str_size]
found = []
for index in range(shnum):
name_off = int.from_bytes(header(index)[0:4], "little")
name = names[name_off:].split(b"\0", 1)[0].decode("latin-1")
if name.startswith((".debug_", ".zdebug_")):
found.append(name)
return found


def wheel_symbol_problems(members: dict[str, bytes]) -> list[str]:
"""Symbol files or unstripped ELF binaries among a wheel's members."""
problems = []
for name, data in members.items():
if ".dSYM/" in name or name.endswith((".dSYM", *SYMBOL_SUFFIXES)):
problems.append(f"{name}: debug-symbol file in wheel")
elif sections := _elf_debug_sections(data):
problems.append(f"{name}: unstripped debug sections {sections}")
return problems


def check(wheel_root: Path, binary_root: Path, version: str) -> dict:
Expand Down Expand Up @@ -57,6 +99,14 @@ def check(wheel_root: Path, binary_root: Path, version: str) -> dict:
raise ValueError(
f"invalid wheel archive: {path} (bad member: {bad_member})"
)
problems = wheel_symbol_problems(
{
name: archive.read(name) if name.startswith("fastled/bin/") else b""
for name in archive.namelist()
}
)
if problems:
raise ValueError(f"symbols in wheel {path.name}: {problems}")
wheels.append({"name": path.name, "bytes": size})

binary_dirs = (
Expand Down
Loading
Loading