Add GitHub Action for Cartesi setup - #1
Merged
Conversation
Installs the Cartesi Machine emulator and the Cartesi CLI on Linux and macOS runners, on x86_64 and arm64. - emulator: machine-emulator_<arch>.deb installed through apt-get on Linux, cartesi/tap Homebrew formula on macOS - images: kernel and rootfs images pinned by the emulator release's dependencies.lock, installed where the emulator looks for them, and exported as CARTESI_IMAGES_PATH - CLI: @cartesi/cli from npm, alpha dist-tag by default, installed into the runner tool cache Both tools default to the latest release and can be pinned, or skipped with 'none'. Security: download sources are hardcoded constants that no input can redirect, every artifact is verified against a SHA-256 digest, inputs are validated against strict patterns and passed as argument arrays rather than through a shell, npm lifecycle scripts are disabled, and root is used only for apt-get and for copying the images into place. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2NraPGxBnuRLarrZf5YSL
Migrates the configuration to the v2 schema (files.includes with negated patterns, linter.rules.preset) and applies the v2 import sorting, which orders inline type imports by name. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2NraPGxBnuRLarrZf5YSL
Homebrew refuses to load formulae from third-party taps until they are trusted. Naming cartesi/tap/cartesi-machine on the install command line auto-trusts that formula, but it is a metapackage, so the install still aborted on its dependency: Refusing to load formula cartesi/tap/cartesi-machine-emulator from untrusted tap cartesi/tap. Trust the individual formulae being installed, rather than the whole tap, so trust does not extend to formulae the tap may add later. Homebrew versions without the trust concept fail the command harmlessly; brew install remains the real gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2NraPGxBnuRLarrZf5YSL
Releasing is now `git tag v1.2.3 && git push origin v1.2.3`. The workflow verifies dist/ matches src/ at the tagged commit, runs lint, typecheck and tests, creates the GitHub release (freezing the tag and generating a release attestation), and force-moves the floating v1 and v1.2 tags. The floating tags deliberately get no release attached, which is what keeps them movable while immutable releases are enabled, and only those two refs are pushed -- `git push --tags` would also try to force-push the frozen release tags. The trigger is a tag push rather than `release: published`: events produced with GITHUB_TOKEN do not start further workflow runs, so a workflow that created the release could never hand off to one that moves the tags. Also adds workflow_dispatch to CI so the suite can be run on demand, and keeps local biome runs from tripping over untracked editor settings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C2NraPGxBnuRLarrZf5YSL
Member
Author
|
Another alternative was two separate actions: |
endersonmaia
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a complete GitHub Action that installs the Cartesi Machine emulator and Cartesi CLI on CI runners, enabling workflows to build, run, and test Cartesi applications.
Key Changes
Action Implementation: Created a fully functional GitHub Action (
action.yml) with configurable inputs for machine version, CLI version, and checksum verificationCore Modules:
main.ts: Entry point orchestrating the installation workflowmachine.ts: Handles Cartesi Machine emulator installation and setupcli.ts: Manages Cartesi CLI installationimages.ts: Manages kernel and rootfs image downloads with checksum verificationgithub.ts: GitHub API client for fetching release assetschecksum.ts: SHA-256 verification utilities for downloaded artifactsinputs.ts: Input parsing and validation (versions, checksums, flags)platform.ts: Platform detection (Linux/macOS, amd64/arm64)system.ts: System-level utilities (root detection)constants.ts: Hard-coded security-critical URLs and repository referencesTesting: Comprehensive test suite covering:
CI/CD:
Documentation & Configuration:
Notable Implementation Details
constants.tsto prevent workflow input injection attacksdist/index.jsfor direct runner execution without requiring Node.js installationhttps://claude.ai/code/session_01C2NraPGxBnuRLarrZf5YSL