pub struct Project {
pub targets: HashMap<String, Target>,
pub name: Option<String>,
pub imports: HashMap<String, String>,
}
Expand description
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:
zinoma check
will ensure the code complies to the test suites and the coding standards.zinoma start --watch
will run the application and restart it whenever the sources are updated.zinoma --clean build
will generate a clean artifact, ready to be deployed.
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:
zinoma speak_cow
will printMoo
zinoma speak_dog
will printWoof!
zinoma speak_cow speak_dog
will print bothMoo
andWoof!
(not necessarily in this order)
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§
source§impl<'de> Deserialize<'de> for Project
impl<'de> Deserialize<'de> for Project
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl JsonSchema for Project
impl JsonSchema for Project
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more