{"id":49234306,"url":"https://github.com/rul1an/zig-cross-compile-action","last_synced_at":"2026-04-24T14:04:57.367Z","repository":{"id":332409308,"uuid":"1110882506","full_name":"Rul1an/zig-cross-compile-action","owner":"Rul1an","description":"Zig based cross compilation for C, C++, Rust and Go. No Docker.","archived":false,"fork":false,"pushed_at":"2025-12-09T09:30:21.000Z","size":134,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T19:46:26.112Z","etag":null,"topics":["c","cplusplus","cross-compilation","cross-compile","github-actions","go","golang","rust","rust-lang","zig"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rul1an.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-05T21:46:54.000Z","updated_at":"2025-12-09T09:30:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Rul1an/zig-cross-compile-action","commit_stats":null,"previous_names":["rul1an/zig-cross-compile-action"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/Rul1an/zig-cross-compile-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rul1an%2Fzig-cross-compile-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rul1an%2Fzig-cross-compile-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rul1an%2Fzig-cross-compile-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rul1an%2Fzig-cross-compile-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rul1an","download_url":"https://codeload.github.com/Rul1an/zig-cross-compile-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rul1an%2Fzig-cross-compile-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32226416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cplusplus","cross-compilation","cross-compile","github-actions","go","golang","rust","rust-lang","zig"],"created_at":"2026-04-24T14:04:50.191Z","updated_at":"2026-04-24T14:04:57.359Z","avatar_url":"https://github.com/Rul1an.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zig Cross-Compile Action\n\nA secure, performance-focused GitHub Action to setup the Zig toolchain and cross-compile C, C++, Rust, Go, and Zig projects.\n\n## v3.0 Features\n- **Strict Versioning**: Exact version pinning with checksum verification (SHA256).\n- **Caching**: Built-in `~/.cache/zig` support to speed up builds.\n- **Supply Chain Security**: Opt-in SBOM generation (Syft) and artifact signing (Cosign).\n- **Presets**: Easy target aliases (`linux-x86_64-musl`, `macos-arm64`).\n- **Polyglot**: Configures cross-compilation environment for C/Go/Rust automatically.\n\n## Usage Profiles\n\n### 1. Minimal Development\nJust install Zig and set up the environment.\n\n```yaml\n- uses: Rul1an/zig-cross-compile-action@v3\n  with:\n    version: \"0.13.0\"\n    target_preset: \"linux-x86_64-musl\"\n    setup_only: \"true\"\n\n- run: zig build -Dtarget=$ZIG_TARGET\n```\n\n### 2. Standard Release (Cached \u0026 Tested)\nRun tests, benchmark, and build with caching enabled.\n\n```yaml\n- uses: Rul1an/zig-cross-compile-action@v3\n  with:\n    version: \"0.13.0\"\n    target_preset: \"linux-x86_64-musl\"\n    use_cache: \"true\"\n\n    # Run tests before building. Fails job if tests fail.\n    run_tests: \"true\"\n    test_script: |\n      zig build test\n      zig build test-parity\n\n    perf_command: \"zig build bench\"\n\n    # Build command\n    project-type: \"zig\"\n    cmd: \"-Doptimize=ReleaseSafe\"\n```\n\n### 3. Hardened Release (SBOM + Signing)\nGenerate accurate SBOMs and sign artifacts (Linux runners only).\n\n\u003e [!IMPORTANT]\n\u003e Keyless signing requires `permissions: id-token: write` in your workflow.\n\n```yaml\n- uses: Rul1an/zig-cross-compile-action@v3\n  with:\n    version: \"0.13.0\"\n    target_preset: \"linux-x86_64-musl\"\n    setup_only: \"true\"\n\n    # Supply Chain\n    sbom: \"true\"\n    sbom_target: \"zig-out/bin/my-app\"\n\n    sign: \"true\"\n    sign_artifact: \"zig-out/bin/my-app\"\n```\n\n## Inputs\n\n| Input | Description | Default |\n| :--- | :--- | :--- |\n| `version` | Zig version (e.g. `0.13.0`). Use `strict_version: true` (default) for exact matches. | `0.13.0` |\n| `target_preset` | Alias for common targets (`linux-x86_64`, `linux-arm64`, `macos-arm64`, `windows-x86_64`). | |\n| `target` | Explicit Zig target triple (e.g. `x86_64-linux-gnu`). **Supersedes** `target_preset`. | |\n| `project-type` | `zig`, `custom`, `c`, `go`, `rust`. Sets up environment variables. | `custom` |\n| `setup_only` | If `true`, installs toolchain and env but skips build command. | `false` |\n| `use_cache` | Enable `~/.cache/zig` persistence. | `false` |\n| `sbom` | Generate SBOM with Syft (Linux only). | `false` |\n| `sign` | Sign artifact with Cosign Keyless (Linux only). | `false` |\n\n### Polyglot Support\nSetting `project-type` to `go`, `rust`, or `c` calculates the correct cross-compilation environment variables (e.g., `CC`, `CGO_ENABLED`, `CARGO_TARGET_..._LINKER`) but relies on you to provide the build command via `cmd` or a subsequent run step. The action acts as a \"toolchain bootstrapper\" for these languages.\n\n### Caching Note\nWhen `use_cache: true`, we cache `~/.cache/zig` and include `build.zig` / `go.mod` / `Cargo.lock` in the cache key.\n\u003e **Tip:** Zig caches can grow large. GitHub limits caches to 10GB. You may need to clear caches occasionally if testing many targets.\n\n## Migration v2 -\u003e v3\nv3 is backwards compatible with v2 inputs (`version`, `target`, `cmd`, `project-type`).\n- `verify-level` is deprecated (no-op).\n- `project-type` now strictly means \"setup environment\"; for non-Zig projects, it functions identically to `custom` but with smarter env vars.\n\n## Real-world Usage\nThis action is used to build and release [Rul1an/llm-cost](https://github.com/Rul1an/llm-cost) (a cross-platform Zig tool for LLM token estimation). Check that repository for a production-grade workflow example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frul1an%2Fzig-cross-compile-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frul1an%2Fzig-cross-compile-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frul1an%2Fzig-cross-compile-action/lists"}