summaryrefslogtreecommitdiff
path: root/ocaml/Taskfile.yaml
blob: 4a4cbe2ea248b072035971b8414b43a210b48e65 (plain)
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
99
100
101
102
103
# https://taskfile.dev
version: "3"

tasks:

  default:
    desc: Prints this message
    cmds:
      - cmd: task --list-all

  docs:
    desc: Builds documentation
    preconditions:
      - command -v ocamldoc
    cmds:
      - cmd: ocamldoc -html -d docs bin/main.ml
    silent: true

  test:
    desc: Runs the tests
    preconditions:
      - command -v dune
    deps:
      - task: build
    cmds:
      - cmd: dune runtest {{.CLI_ARGS}}

  test:watch:
    desc: Continuously runs the tests
    ignore_error: true
    sources:
      - lib/**/*.ml
      - test/**/*.ml
    preconditions:
      - command -v dune
    deps:
      - task: build
    cmds:
      - cmd: dune runtest --watch {{.CLI_ARGS}}

  test:coverage:
    desc: Runs the tests and reports coverage
    preconditions:
      - command -v dune
      - command -v bisect-ppx-report
    deps:
      - task: build
    cmds:
      - cmd: rm --recursive --force _coverage
      - cmd: rm --force _build/default/test/bisect*.coverage
      - cmd: dune runtest --instrument-with bisect_ppx --force {{.CLI_ARGS}}
      - cmd: bisect-ppx-report html

  test:suite:
    desc: Run a singluar test suite, e.g. `task test:suite SUITE=test/domain/d01p01`
    preconditions:
      - command -v dune
    deps:
      - task: build
    requires:
      vars:
        - SUITE
    cmds:
      - cmd: dune exec {{.SUITE}}.exe -- {{.CLI_ARGS}}

  build:
    desc: Builds the project
    preconditions:
      - command -v dune
    cmds:
      - cmd: dune build

  build:watch:
    desc: Builds the project when files change
    preconditions:
      - command -v dune
    cmds:
      - cmd: dune build --watch {{.CLI_ARGS}}

  build:release:
    desc: Builds a release version the project
    preconditions:
      - command -v dune
    cmds:
      - cmd: dune build --release

  run:
    desc: Runs the project
    preconditions:
      - command -v dune
    deps:
      - task: build
    cmds:
      - cmd: dune exec -- ./bin/main.exe {{.CLI_ARGS}}

  repl:
    desc: Opens a REPL for the project
    interactive: true
    preconditions:
      - command -v dune
      - command -v utop
    cmds:
      - cmd: dune utop