generate

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package generate produces CI platform configuration from cidx.toml.

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is the cidx build version, propagated from main at startup (same pattern as executor.Version). Release builds inject it via ldflags (`-X main.Version=1.7.0`); dev builds keep the "dev" default.

It determines the bootstrap pin in generated workflows: a workflow generated by a released cidx installs that exact release in CI, so local and CI runs use the same presets (issue #163).

Functions

func BootstrapVersion

func BootstrapVersion() string

BootstrapVersion returns the `go install` version suffix used by generated workflows: "v<X.Y.Z>" when the running cidx is a release build, "latest" otherwise (dev or nightly builds, which have no installable tag).

func GitHub

func GitHub(cfg *config.Config) (string, error)

GitHub generates a GitHub Actions workflow YAML from the CIDX config.

This entrypoint targets external projects: the bootstrap installs cidx via `go install`, pinned to the generating cidx's release version when known (see BootstrapVersion). Callers that need the cidx-repo bootstrap should use GitHubWithOptions with SelfBuild=true.

func GitHubWithOptions

func GitHubWithOptions(cfg *config.Config, opts GitHubOptions) (string, error)

GitHubWithOptions generates a GitHub Actions workflow YAML with explicit generation options. Use this when you need to control the bootstrap mode (self-build vs. go-install) directly.

func GitLab

func GitLab(cfg *config.Config) (string, error)

GitLab generates a GitLab CI configuration YAML from the CIDX config.

func IsCidxRepo

func IsCidxRepo(dir string) bool

IsCidxRepo reports whether dir is the cidx repository itself.

The check has two prongs to avoid false positives from any project that happens to have a cmd/cidx/ directory:

  1. cmd/cidx/main.go must exist
  2. go.mod's module declaration must equal the canonical cidx module path

Returns false on any I/O error or missing marker — external project semantics are the safe default.

Types

type GitHubOptions

type GitHubOptions struct {
	// SelfBuild emits the cidx-repo bootstrap (`go build -o bin/cidx ./cmd/cidx`).
	// When false (the default for external projects), the bootstrap installs
	// cidx via `go install <module>/cmd/cidx@<BootstrapVersion()>`.
	SelfBuild bool
}

GitHubOptions controls how the GitHub Actions workflow is generated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL