• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# https://taskfile.dev
2version: "3"
3
4vars:
5  CARGO_BIN: ~/.cargo/bin/
6
7tasks:
8  install-nextest:
9    status:
10      - test -f {{.CARGO_BIN}}/cargo-nextest
11    cmds:
12      - curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C {{.CARGO_BIN}}
13
14  install-pytest:
15    status:
16      - which pytest
17    cmds:
18      - python3 -m pip install pytest
19
20  clone-licenses:
21    status:
22      - test -d choosealicense.com
23    cmds:
24      - git clone --depth 1 https://github.com/github/choosealicense.com.git
25
26  check:
27    cmds:
28      - cargo check --all {{.CLI_ARGS}}
29
30  format:
31    cmds:
32      - cargo fmt --all {{.CLI_ARGS}}
33
34  lint:
35    cmds:
36      - >
37        cargo clippy
38        --examples --tests --benches --bins --lib --workspace
39        -- -D clippy::pedantic -D clippy::dbg-macro -D warnings
40
41  doc:
42    env:
43      RUSTDOCFLAGS: "-Dwarnings"
44    cmds:
45      - cargo doc {{.CLI_ARGS}}
46
47  pytest:
48    deps:
49      - install-pytest
50    cmds:
51      - pytest {{.CLI_ARGS}} tests/
52
53  nextest:
54    deps:
55      - install-nextest
56    env:
57      CLICOLOR_FORCE: "yes"
58    cmds:
59      - cargo nextest run --no-fail-fast {{.CLI_ARGS}}
60      - cargo build --no-default-features
61
62  doctest:
63    cmds:
64      - cargo test --doc
65
66  bench:
67    desc: "run benchmarks"
68    deps:
69      - clone-licenses
70    cmds:
71      - cargo bench {{.CLI_ARGS}}
72
73  release:
74    desc: "build and upload a new release"
75    cmds:
76      - which gh
77      - test {{.CLI_ARGS}}
78      - cat Cargo.toml | grep -F 'version = "{{.CLI_ARGS}}"'
79      - cargo publish
80      - git tag {{.CLI_ARGS}}
81      - git push
82      - git push --tags
83      - gh release create --generate-notes {{.CLI_ARGS}}
84
85  test:
86    desc: "run all tests"
87    cmds:
88      - task: pytest
89      - task: nextest
90      - task: doctest
91
92  all:
93    desc: "run all code formatters, linters, and tests"
94    cmds:
95      - task: format
96      - task: check
97      - task: lint
98      - task: doc
99      - task: test
100