App-Actions

 view release on metacpan or  search on metacpan

lib/App/Actions.pm  view on Meta::CPAN

option values there in ASCII.

=head1 SEE ALSO

=over 4

=item * L<Configure an Object at Runtime|Object::Configure>, which L</new>
uses to read configuration files and environment variables

=item * L<Config::Abstraction>, which finds and reads those files

=item * L<Test Dashboard|https://nigelhorne.github.io/App-Actions/coverage/>

=back

=head1 AUTHOR

Nigel Horne, C<< <njh at nigelhorne.com> >>

=encoding utf-8

=head1 FORMAL SPECIFICATION

This section describes each routine in the Z notation, a precise
mathematical language for describing programs.  You do not need to read it
to use the module: everything here is also said in plain words in the
sections above.  It is for readers who want to check exactly what a routine
promises.

How to read it: a box names a routine.  The lines above the middle rule
declare the values it works with.  A name ending in C<?> is an input, and a
name ending in C<!> is an output.  C<ΞState> means the routine changes
nothing, and C<ΔState> means it can change the state.  The lines below the
rule are the conditions that are always true when the routine returns.

=head2 new

	┌─ New ─────────────────────────────────────────────
	│ ΞFileSystem
	│ workflowFile? : optional PATH
	│ projectDir?   : optional PATH
	│ options?      : OPTION ⇸ VALUE
	│ actions!      : Actions
	├───────────────────────────────────────────────────
	│ dom options? ⊆ RUNNER_OPTIONS
	│ let settings == (args? ⊕ fileConfig(App__Actions)) ⊕ envConfig(App__Actions__)
	│     where args? == options? ∪ {workflow_file ↦ workflowFile?, project_dir ↦ projectDir?}
	│     -- dom fileConfig and dom envConfig are not checked against RUNNER_OPTIONS
	│ workflowFile? = ⊥ ⇒ raises WorkflowFileRequired
	│ abs(workflowFile?) ∉ regularFiles ⇒ raises WorkflowFileMissing
	│ projectDir? = ⊥ ∧ abs(workflowFile?) ∉ (PATH ⁀ "/.github/workflows/" ⁀ NAME)
	│     ⇒ raises ProjectDirRequired
	│ let root == (projectDir? ≠ ⊥ ⇒ abs(projectDir?))
	│             ∧ (projectDir? = ⊥ ⇒ repository(abs(workflowFile?)))
	│ root ∉ directories ⇒ raises ProjectDirMissing
	│ actions!.workflow = Workflow.Load(abs(workflowFile?))
	│ actions!.project_dir = root
	│ actions!.options = settings
	│ let logged == (logger? ≠ ⊥ ⇒ logger?)
	│             ∧ (logger? = ⊥ ∧ logger ∈ dom configured ⇒ configured(logger))
	│             ∧ (logger? = ⊥ ∧ logger ∉ dom configured ⇒ stderrLogger)
	│     where configured == fileConfig(App__Actions) ⊕ envConfig(App__Actions__)
	│     -- fileConfig includes the UNIVERSAL section of universal.yaml
	│ actions!.logger ∈ LogAbstraction
	│ logged = NULL ⇒ actions!.logger = silentLogger
	│ logged ≠ NULL ⇒ actions!.logger = toLogger(logged)
	└───────────────────────────────────────────────────

	The workflowFile? and projectDir? above are the values in settings, so a
	configuration file or environment variable can replace them too.

=head2 workflow, workflow_file, project_dir

	┌─ Accessor ────────────────────────────────────────
	│ ΞActions
	│ field? : {workflow, workflow_file, project_dir}
	│ value! : VALUE
	├───────────────────────────────────────────────────
	│ value! = θActions.field?
	└───────────────────────────────────────────────────

=head2 run

	┌─ Run ─────────────────────────────────────────────
	│ ΞActions
	│ overrides? : OPTION ⇸ VALUE
	│ exit!      : {0, 1, 2}
	├───────────────────────────────────────────────────
	│ dom overrides? ⊆ RUNNER_OPTIONS
	│ exit! = Runner.Run(options ⊕ overrides?)
	└───────────────────────────────────────────────────

=head2 preflight

	┌─ Preflight ───────────────────────────────────────
	│ ΞActions
	│ overrides? : OPTION ⇸ VALUE
	│ json?      : optional BOOLEAN
	│ result!    : Result
	├───────────────────────────────────────────────────
	│ dom overrides? ⊆ RUNNER_OPTIONS
	│ result! = Runner.Preflight(options ⊕ overrides?, json?)
	│ result!.exit ∈ {0, 2}
	│ json? ⇒ valid(result!.summary, PreflightSchema)
	└───────────────────────────────────────────────────

=head2 json_schema

	DOCUMENT ::= check | preflight | cache | logs

	┌─ JsonSchema ──────────────────────────────────────
	│ name?   : optional STRING
	│ schema! : KEY ⇸ VALUE
	├───────────────────────────────────────────────────
	│ name? ∈ {⊥, ⟨⟩} ⇒ raises DocumentRequired
	│ name? ∉ DOCUMENT ⇒ raises DocumentUnknown(name?)
	│ name? ∈ DOCUMENT ⇒ schema! = owner(name?).json_schema
	└───────────────────────────────────────────────────

=head2 list_jobs



( run in 0.593 second using v1.01-cache-2.11-cpan-60884a8df76 )