-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.dist.yaml
155 lines (127 loc) · 5.24 KB
/
Taskfile.dist.yaml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# See <https://taskfile.dev/usage> and <https://taskfile.dev/reference/schema>
# to find all keys and their usage.
version: "3"
silent: true
dotenv: [paths.env]
env:
SELF: task {{ .ALIAS | default .TASK }} --
SCRIPTS_ROOT: "{{.ROOT_DIR}}/scripts"
REPOSITORY_ROOT: "{{.ROOT_DIR}}"
PROSE_POD_API_DIR: "{{.ROOT_DIR}}"
tasks:
lint:
desc: Lint the whole project (Rust code, OpenAPI description…)
deps: [rust:lint, openapi:lint]
rust:lint:
desc: Lints all Rust files.
internal: true
cmd: cargo fmt --check
format:
desc: Formats all files.
deps: [rust:format]
rust:format:
desc: Formats all Rust files.
internal: true
cmd: cargo fmt
update:
desc: Updates all dependencies.
deps: [rust:update-deps, openapi:update-redoc]
rust:update-deps:
desc: Updates Rust dependencies.
internal: true
cmds:
- echo '[INFO] Updating Rust dependencies…'
- rustup upgrade
# NOTE: `cargo update` updates all workspace member crates
- cargo update
rust:outdated:
desc: Checks for outdated dependencies.
cmd: |
if cargo install --list | grep -q '^cargo-edit v'; then
echo '[INFO] Checking for outdated dependencies…';
cargo upgrade --dry-run --incompatible --pinned --verbose;
else
echo '[WARN] Install `cargo upgrade` with `cargo install cargo-edit` for this script to check for outdated dependencies';
fi
build-image:
desc: Builds the Prose Pod API Docker image. Run `task {{.TASK}} -- --help` for more info.
cmd: "{{.ROOT_DIR}}/scripts/build-image {{.CLI_ARGS}}"
test:
desc: Runs all tests then updates "Tested at Rust version" in the `README`.
cmds:
- task: smoke-test
- task: integration-test
- task: util:update-tested-at-version
smoke-test:
desc: Runs smoke tests.
cmd: cargo test --test behavior -- {{.CLI_ARGS}}
integration-test:
desc: Runs integration tests.
cmd: "{{.ROOT_DIR}}/scripts/integration-test {{.CLI_ARGS}}"
integration-test:logs:
desc: Prints logs from last integration test run.
cmd: task local:logs -- {{.CLI_ARGS}}
release:
desc: Creates a release (bumps the version number, then adds and pushes a tag).
cmd: "{{.ROOT_DIR}}/scripts/release {{.CLI_ARGS}}"
local:run:
desc: Runs a Prose Pod API.
cmd: "{{.ROOT_DIR}}/local-run/scripts/run {{.CLI_ARGS}}"
local:stop:
desc: Stops a running Prose Pod API (useful when launched using `--detach`).
cmd: "{{.ROOT_DIR}}/local-run/scripts/stop {{.CLI_ARGS}}"
local:logs:
desc: Prints logs from a local run.
cmd: "{{.ROOT_DIR}}/local-run/scripts/logs {{.CLI_ARGS}}"
local:scenarios:create:
desc: Creates a new environment with persistent storage so you can save API states between runs.
cmd: "{{.ROOT_DIR}}/local-run/scripts/scenario-create {{.CLI_ARGS}}"
local:scenarios:list:
desc: Lists available scenarios.
cmd: "{{.ROOT_DIR}}/local-run/scripts/scenarios-list {{.CLI_ARGS}}"
local:scenarios:reset:
desc: >
Reset the persistent storage of a run scenario.
Note: If the scenario was derived from another, this will **not** use the state of the original one.
If that's what you want, you will need to delete and re-create the scenario.
prompt: This command will delete all the local Prose data associated to this scenario, do you want to continue?
cmd: "{{.ROOT_DIR}}/local-run/scripts/scenarios-reset {{.CLI_ARGS}}"
local:scenarios:delete:
desc: Deletes a scenario.
prompt: This command will delete your local Prose data for this scenario (not the ones derived from it), do you want to continue?
cmd: "{{.ROOT_DIR}}/local-run/scripts/scenarios-delete {{.CLI_ARGS}}"
local:update:
desc: Updates the Prose Pod API repository to get the latest updates.
cmd: "{{.ROOT_DIR}}/local-run/scripts/update {{.CLI_ARGS}}"
local:build:
desc: Builds the Prose Pod API and the repositories it depends on without updating the code.
cmd: "{{.ROOT_DIR}}/local-run/scripts/build-images {{.CLI_ARGS}}"
local:reset:
desc: Starts fresh with a Prose Pod API that has no data.
prompt: This command will delete all the local Prose data associated to the default scenario, do you want to continue?
cmd: "{{.ROOT_DIR}}/local-run/scripts/scenarios-reset default {{.CLI_ARGS}}"
openapi:lint:
desc: Lint the OpenAPI specification file.
cmd: "{{.ROOT_DIR}}/scripts/openapi-lint {{.CLI_ARGS}}"
openapi:preview-docs:
desc: Preview the OpenAPI specification file in a graphical interface.
cmd: "{{.ROOT_DIR}}/scripts/openapi-preview-docs {{.CLI_ARGS}}"
openapi:update-redoc:
desc: Updates Redoc.
vars:
SRC: https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js
DEST: crates/rest-api/static/api-docs/redoc.standalone.js
cmd: wget -q '{{.SRC}}' -O '{{.DEST}}'
util:update-tested-at-version:
desc: Updates "Tested at Rust version" in the `README`.
internal: true
vars:
RUST_VERSION:
sh: rustc --version
PATTERN: 's/(Tested at Rust version: `).+(`)/\1{{.RUST_VERSION}}\2/'
README: README.md
cmds:
- cmd: "sed -i -E '{{.PATTERN}}' '{{.README}}'"
platforms: [linux]
- cmd: "sed -i '' -E '{{.PATTERN}}' '{{.README}}'"
platforms: [darwin]