mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-08-27 14:17:10 -04:00
Drive-by: main is currently failing `ruff format --check .` because of
two missing blank lines between two top-level functions in this file
(introduced in 8bf11d2). Fixing it here so this PR's CI can go green —
no other way to unblock the format check without landing a separate PR
first.
62 lines
2.7 KiB
Python
62 lines
2.7 KiB
Python
"""Workflow regression tests for release publishing behavior."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
def test_docker_workflow_normalizes_repository_name_for_signing() -> None:
|
|
content = (ROOT / ".github" / "workflows" / "docker.yml").read_text(encoding="utf-8")
|
|
|
|
assert "id: image-name" in content
|
|
assert "tr '[:upper:]' '[:lower:]'" in content
|
|
assert "steps.image-name.outputs.image_name" in content
|
|
|
|
|
|
def test_release_workflow_publishes_both_node_packages_to_github_packages() -> None:
|
|
content = (ROOT / ".github" / "workflows" / "release.yml").read_text(encoding="utf-8")
|
|
|
|
assert "Publish ${{ env.NPM_SDK_PACKAGE }} to GitHub Package Registry" in content
|
|
assert "Publish ${{ env.NPM_OPENCLAW_PACKAGE }} to GitHub Package Registry" in content
|
|
assert "pkg.name = `@${process.env.GITHUB_PACKAGES_SCOPE}/${pkg.name}`;" in content
|
|
assert (
|
|
'unscoped_sdk_tarball="$(npm pack --pack-destination "$assets_dir" | tail -n 1)"' in content
|
|
)
|
|
assert "SDK_TARBALL: ${{ steps.gpr-sdk-publish.outputs.unscoped_sdk_tarball }}" in content
|
|
|
|
|
|
def test_release_workflow_publishes_python_distributions_to_github_release() -> None:
|
|
content = (ROOT / ".github" / "workflows" / "release.yml").read_text(encoding="utf-8")
|
|
|
|
assert "Publish ${{ env.PYPI_PACKAGE }} Python distributions to GitHub Release" in content
|
|
assert (
|
|
'gh release upload "$TAG" release-assets/*.whl release-assets/*.tar.gz --clobber' in content
|
|
)
|
|
assert "Publish Node package tarballs to GitHub Release" in content
|
|
assert 'gh release upload "$TAG" release-assets/*.tgz --clobber' in content
|
|
|
|
|
|
def test_create_release_runs_after_successful_build_even_if_other_publishes_fail() -> None:
|
|
content = (ROOT / ".github" / "workflows" / "release.yml").read_text(encoding="utf-8")
|
|
|
|
assert (
|
|
"needs: [detect-version, build, publish-pypi, publish-npm, publish-github-packages, publish-docker]"
|
|
in content
|
|
)
|
|
assert "always()" in content
|
|
assert "needs.build.result == 'success'" in content
|
|
|
|
|
|
def test_macos_native_wrapper_dependency_install_retries_pypi_downloads() -> None:
|
|
content = (ROOT / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8")
|
|
|
|
assert "python -m pip install --retries 10 --timeout 60 pytest" in content
|
|
|
|
|
|
def test_ci_commitlint_skips_default_github_merge_commits() -> None:
|
|
content = (ROOT / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8")
|
|
|
|
assert "github.event_name != 'push'" in content
|
|
assert "!startsWith(github.event.head_commit.message, 'Merge pull request ')" in content
|