forked from crocuda/pipelight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.pipelight.ts
More file actions
98 lines (84 loc) · 2.67 KB
/
test.pipelight.ts
File metadata and controls
98 lines (84 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// test.pipelight.ts
// The every pipelines used for internal testing purpose
import type { Config, Pipeline } from "https://deno.land/x/pipelight/mod.ts";
import { parallel, pipeline, step } from "https://deno.land/x/pipelight/mod.ts";
import { parse } from "https://deno.land/std/flags/mod.ts";
const flags = parse(Deno.args, {
string: ["host"],
default: {
host: "localhost",
},
});
const config: Config = {
options: {
attach: true,
log_level: "info",
},
pipelines: [
// The simplest pipeline to run
pipeline("test", () => [step(`test`, () => ["pwd"])]),
// A pipeline that takes time to resolve
pipeline("test_long_running_pipeline", () => [
step(`run and sleep`, () => ["pwd", "ls", "sleep 120", "pwd"]),
]).add_trigger({
actions: ["manual", "pre-push"],
branches: ["dev"],
}),
// Run a pipeline that runs an attached pipeline
pipeline("test_attached_pipelines", () => [
step(`launch a pipeline`, () => [
"cargo run --bin pipelight run test --config test.pipelight.ts --attach",
]),
]),
// Watcher
// Test watcher with a long running pipeline
pipeline("test_watcher", () => [
step(`run harmless commands`, () => ["pwd", "sleep 30", "ls"]),
]).add_trigger({
actions: ["manual", "watch"],
}),
// Triggers
// Test pipeline triggering by tags
pipeline("test_tags_trigger", () => [step(`test tags`, () => ["ls -l"])])
.add_trigger({
tags: ["*"],
actions: ["manual"],
})
.attach(),
// Test pipeline triggering by git hook
pipeline("test_git_hook", () => [
step(`harmless commands`, () => ["pwd", "sleep 2", "ls"]),
])
.add_trigger({
actions: ["pre-push"],
})
.attach(),
// Test setting modes and expected behaviors
pipeline("test_rw", () => [
step(`harmless commands`, () => ["ppwd", "ls"]).set_mode("jump_next"),
step(`harmless commands`, () => ["pwd", "ls", "sleep 10"]),
]),
// Run every unit tests
pipeline("cargo_tests", () => [step("test", () => ["cargo test"])]),
// Parallel
pipeline("test_parallel_modes", () => [
parallel(() => [step("test", () => ["llls"]).set_mode("continue")]),
parallel(() => [step("test", () => ["ls"]).set_mode("continue")]),
]),
// Set options
pipeline("test_parallel_modes", () => [step("test", () => ["pwd"])]),
{
name: "test_options",
steps: [step(`run harmless commands`, () => ["pwd", "sleep 2", "ls"])],
triggers: [
{
actions: ["pre-push"],
},
],
options: {
log_level: "trace",
},
},
],
};
export default config;