Skip to content

Commit

Permalink
GroupStep (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Le Foll authored Nov 2, 2022
1 parent d404a97 commit 019616b
Show file tree
Hide file tree
Showing 5 changed files with 613 additions and 0 deletions.
32 changes: 32 additions & 0 deletions examples/group.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Command, CommandStep, GroupStep, Pipeline } from '../src';
import { YamlSerializer } from '../src/serializers/yaml';

async function main() {
const install = new Command('yarn', 2);

const lint = new CommandStep([install, new Command('yarn lint', 1)]).withKey(
'lint',
);
const test = new CommandStep([install, new Command('yarn test', 2)])
.withKey('test')
.dependsOn(lint);
const build = new CommandStep([install, new Command('yarn build', 5)])
.withKey('build')
.dependsOn(lint);
const integration = new CommandStep([
install,
new Command('yarn integration', 10),
])
.withKey('integration-test')
.dependsOn(build);

const group = new GroupStep('My group').add(test).add(integration);

const pipeline = new Pipeline('My pipeline').add(group).add(integration);

console.log(await new YamlSerializer().serialize(pipeline));
// console.log(await new YamlSerializer({ explicitDependencies: true }).serialize(pipeline));
// console.log(await new DotSerializer().serialize(pipeline));
}

main();
Loading

0 comments on commit 019616b

Please sign in to comment.