-
Notifications
You must be signed in to change notification settings - Fork 92
/
Taskfile.yml
205 lines (204 loc) · 5.77 KB
/
Taskfile.yml
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
---
# see https://taskfile.dev/#/
version: "3"
includes:
als:
taskfile: ./packages/ansible-language-server
dir: ./packages/ansible-language-server
shared:
taskfile: ./.config/Taskfile_shared.yml
internal: true
output: prefixed # do not use "group" due to impact on CI
env:
# keep in mind that these do *not* override shell vars: https://github.com/go-task/task/issues/1733
FORCE_COLOR: "true"
PRE_COMMIT_COLOR: always
# basically the same thing from .envrc file:
vars:
HOSTNAME:
sh: echo ${HOSTNAME:-${HOST:-$(hostname)}}
VIRTUAL_ENV:
sh: echo "${HOME}/.local/share/virtualenvs/vsa"
XVFB:
# prefix to add to allow execution of test in headless machines (CI)
sh: bash -c 'if [[ "$OSTYPE" == "linux-gnu"* ]] && command -v xvfb-run >/dev/null; then echo "$(command -v xvfb-run) --auto-servernum -e out/log/xvfb.log"; fi'
tasks:
default:
desc: Run most commands
cmds:
- task: install
- task: lint
- task: package
- task: docs
- echo {{.TASK}}
version:
cmds:
- ./tools/helper --version
setup:
desc: Install dependencies
cmds:
- task: shared:setup
clean:
desc: Clean up all files that not tracked by git
cmds:
- git clean -dxf
install:
cmds:
- task: shared:install
sources:
- "**/package.json"
- yarn.lock
- node_modules/**/*
interactive: true
build:
desc: Build the project
cmds:
- task: install
# Workaround for https://github.com/redhat-developer/vscode-extension-tester/pull/460#issuecomment-1166315428
# - cd node_modules/vscode-extension-tester && npm update vsce
- yarn run clean
- yarn run als-compile
- yarn run compile
- npx tsc -p ./
sources:
- Taskfile.yml
- node_modules/**/*
- package.json
- src/**/*
- test/**/*
- tsconfig.json
- webpack.config.ts
- yarn.lock.json
code:
env:
# https://github.com/microsoft/vscode/issues/82524#issuecomment-1150315756
NODE_OPTIONS: "--no-deprecation"
desc: Forced install of extension in your code instance
cmds:
- task: package
- code --force --install-extension *.vsix
deps:
desc: Update dependencies
env:
VSCODE_VERSION:
sh: node -p "require('./package.json').engines.vscode"
cmds:
- task: install
# upgrade yarn itself
- yarn set version latest
# bumps some developments dependencies
- yarn upgrade-interactive
# restores a potential update of @types/vscode
- yarn up "@types/vscode@${VSCODE_VERSION}"
- yarn dedupe
# running install after upgrade is needed in order to update the lock file
- task: shared:install
# check deps
- yarn dlx depcheck
- "{{.VIRTUAL_ENV}}/bin/python3 ./tools/precheck.py"
- "{{.VIRTUAL_ENV}}/bin/python3 -m pre_commit autoupdate"
- task: lint
- task: build
interactive: true
docs:
dir: "{{ .TASKFILE_DIR }}"
desc: Build the documentation
cmds:
- task: setup
# Retrieve possibly missing commits:
- $(git rev-parse --is-shallow-repository) && git fetch --unshallow > /dev/null || true
- git fetch --tags --force
- npx ts-node packages/ansible-language-server/tools/settings-doc-generator.ts
- bash -c 'source "${VIRTUAL_ENV}/bin/activate" && mkdocs build --strict'
- tools/dirty.sh
lint:
desc: Lint the project
cmds:
- task: install
- task: als:package # to produce the tgz file that can-release is using
- packages/ansible-language-server/tools/can-release.sh
- "{{.VIRTUAL_ENV}}/bin/python3 ./tools/precheck.py"
- "{{.VIRTUAL_ENV}}/bin/python3 -m pre_commit run -a"
- tools/dirty.sh
silent: true
sources:
- "*.*"
- .config
- .github
- .vscode
- doc
- examples
- images
- src
- syntaxes
- test
- tools
test:
# cspell: disable-next-line
desc: "Run all tests: \e[22;32munit, ui, e2e, als\e[0m"
cmds:
- task: setup
- task: unit
- task: ui
- task: e2e
- task: als:test
# .vsix file is no longer needed for executing tests.
# This is just for making sure that the package step works w/o issues.
- task: package
- tools/dirty.sh
interactive: true
test-e2e:
desc: Run e2e tests {{.XVFB}}
aliases: [e2e]
cmds:
- task: package
- "{{.VIRTUAL_ENV}}/bin/python3 --version"
- '{{.XVFB}} bash -c ''source "{{.VIRTUAL_ENV}}/bin/activate" && COVERAGE=1 MOCK_LIGHTSPEED_API=1 TEST_TYPE=e2e ./tools/test-launcher.sh'''
interactive: true
test-ui:
desc: Run UI tests {{.XVFB}}
aliases: [ui]
cmds:
- yarn webpack-dev
- "{{.VIRTUAL_ENV}}/bin/python3 --version"
- bash -c 'rm -rf ./out/test-resources ./out/ext'
- ' {{.XVFB}} bash -c ''source "{{.VIRTUAL_ENV}}/bin/activate" && COVERAGE=1 MOCK_LIGHTSPEED_API=1 ./tools/test-launcher.sh'''
interactive: true
test-unit:
desc: Run unit tests with coverage report
aliases: [unit]
cmds:
- npm run unit-tests
interactive: true
package:
desc: Package extension
sources:
- CHANGELOG.md
- README.md
- package*.json
- out/
- webpack.config.ts
- Taskfile.yml
- tools/helper
- src/**/*
- test/**/*
generates:
- "*.vsix"
cmds:
- task: build
# while not a real dependency, we want to build both all the time:
- task: als:package
- ./tools/helper --package
silent: true
pr:
desc: Opens a pull request using gh
cmds:
- task: lint
- gh pr create
interactive: true
release:
desc: Create a new release (used by CI)
cmds:
- task: install
- ./tools/release.sh
interactive: true