[][src]Struct zinoma::config::yaml::schema::Project

pub struct Project {
    pub targets: HashMap<String, Target>,
    pub name: Option<String>,
    pub imports: HashMap<String, String>,
}

Schema of the build flow configuration file zinoma.yml.

In order to use Žinoma with your project, you need to create a file named zinoma.yml. We recommend putting this file in the root directory of your project.

This struct describes the schema expected for this file. It assumes prior knowledge of the Yaml format.

Example

zinoma.yml:

targets:
  download_dependencies:
    input:
      - paths: [package.json, package-lock.json]
    output:
      - paths: [node_modules]
    build: npm install

  test:
    input:
      - download_dependencies.output
      - paths: [package.json, src, test]
    build: npm test

  lint:
    input:
      - download_dependencies.output
      - paths: [package.json, src, test]
    build: npm run lint

  check:
    dependencies: [test, lint]

  start:
    input:
      - download_dependencies.output
      - paths: [package.json, src]
    service: exec npm run start

  build:
    dependencies: [check]
    input:
      - paths:
        - Dockerfile
        - package.json
        - package-lock.json
        - src
    output:
      - paths: [lambda.zip]
    build: |
      docker build -t build-my-project:latest .
      docker create -ti --name build-my-project build-my-project:latest bash
      docker cp build-my-project:/var/task/lambda.zip ./
      docker rm -f build-my-project

In this example:

A fully functional and more advanced example project is available in fbecart/zinoma-node-example.

Fields

targets: HashMap<String, Target>

Targets (aka tasks) of this project.

Targets represent commands and scripts to execute in your build flow.

Targets run in parallel by default. To force targets to run sequentially, you can define dependencies on other targets.

Each target must have a unique name inside the project. The target name must be a string. It should start with an alphanumeric character or _ and contain only alphanumeric characters, -, or _.

Example

targets:
  speak_cow:
    build: echo 'Moo'
  speak_dog:
    build: echo 'Woof!'

In this example:

name: Option<String>

Name of the project.

A project name must be a string. It should start with an alphanumeric character or _ and contain only alphanumeric characters, -, or _.

Project names should be unique. Two projects cannot have the same name.

Example

name: my_project
imports: HashMap<String, String>

Import definitions from other Žinoma projects.

imports should be an object, the keys being the project names and the values their respective paths.

Before importing a project, you should make sure this project has its name defined. You should use the same name as key in the imports object.

Once a project is imported, targets from that project can be referenced by specifying their fully qualified name: imported_project_name::target_name.

Example

packages/api/zinoma.yml:

name: api

targets:
  test:
    build: cargo test

packages/webapp/zinoma.yml:

name: webapp

targets:
  test:
    build: cargo test

./zinoma.yml:

imports:
  api: packages/api
  webapp: packages/webapp

targets:
  test_all:
    dependencies: [api::test, webapp::test]

In this example, the target test_all depend from targets defined in different projects.

Trait Implementations

impl Debug for Project[src]

impl<'de> Deserialize<'de> for Project[src]

impl JsonSchema for Project[src]

impl Serialize for Project[src]

Auto Trait Implementations

impl RefUnwindSafe for Project

impl Send for Project

impl Sync for Project

impl Unpin for Project

impl UnwindSafe for Project

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.