This repository has been archived by the owner on Oct 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
/
Taskfile.yml
188 lines (187 loc) · 4.8 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
---
# see https://taskfile.dev/#/
version: "3"
env: &env
# basically the same thing from .envrc file:
# Avoid undesired extra hints from docker when pulling images
DOCKER_CLI_HINTS: "false"
vars:
EE_VERSION:
sh: ./tools/get-image-version
VIRTUAL_ENV:
sh: echo "${VIRTUAL_ENV:-${PWD}/out/venvs/${HOSTNAME:-localhost}}"
tasks:
default:
desc: Run most commands
deps:
- setup
env:
VERSION:
sh: node -p "require('./package.json').version"
cmds:
- task: lint
- task: package
- task: docs
- echo Done {{.VERSION}}!
vscode:
desc: Run vscode-ansible tests using current code from ALS
deps:
- setup
cmds:
- ./tools/vscode.sh
docs:
desc: Build the documentation
deps:
- setup
cmds:
# Retrieve possibly missing commits:
- $(git rev-parse --is-shallow-repository) && git fetch --unshallow > /dev/null || true
- git fetch --tags --force
- npm run generate-settings-readme
- "source {{.VIRTUAL_ENV}}/bin/activate && mkdocs build --strict"
setup:
desc: Install dependencies
run: once
env:
# used inside test-setup.sh
OS: "{{OS}}"
ARCH: "{{ARCH}}"
cmds:
- ./tools/test-setup.sh
sources:
- package.json
- package-lock.json
- .config/requirements.*
- setup.cfg
- tools/test-setup.sh
- .config/**/*.*
generates:
- out/log/manifest.yml
build:
desc: Build the project
deps:
- setup
cmds:
- npm run compile
sources:
- package-lock.json
- package.json
- src/**/*.*
- test/**/*.*
- tsconfig.json
- webpack.config.js
deps:
desc: Update dependencies
deps:
- setup
cmds:
- npm install -g npm@latest
# 1st node version is the implicit one and must match node version from
# vscode about dialog and be within supported range from https://www.npmjs.com/package/vscode-extension-tester
# as we want to avoid using different node versions across the projects.
# 2nd node version is used for preparing for new versions
- asdf local nodejs latest:18 latest:$(asdf nodejs resolve lts)
- "{{.VIRTUAL_ENV}}/bin/python -m pre_commit autoupdate"
- npm outdated
# bumps some developments dependencies
- npx ncu -u --dep dev
# running install after ncu is needed in order to update the lock file
- npm install
lint:
desc: Lint the project
deps:
- setup
env:
<<: *env
PRE_COMMIT_COLOR: always
cmds:
- "{{.VIRTUAL_ENV}}/bin/python -m pre_commit run -a"
silent: true
sources:
- "*.*"
- .config/**/*.*
- .github/**/*.*
- .vscode/**/*.*
- doc/**/*.*
- images/**/*.*
- src/**/*.*
- test/**/*.*
- tools/**/*.*
.test:
# Keep the desc empty to hide entry when listing
# desc: Run all tests
vars:
ENGINE:
sh: bash -c "command -v docker | head -n 1"
deps:
- build
cmds:
- "{{.ENGINE}} pull ghcr.io/ansible/creator-ee:{{ .EE_VERSION }}"
# Tests that container engine is functional and that we have the image:
- "{{.ENGINE}} run -i ghcr.io/ansible/creator-ee:{{ .EE_VERSION }} ansible-lint --version"
- >
source {{.VIRTUAL_ENV}}/bin/activate &&
command -v ansible-lint &&
npm run test
interactive: true
test:
desc: Run all tests using node (same version as vscode)
cmds:
- bash -c 'asdf local nodejs latest:18 latest:$(asdf nodejs resolve lts)'
- task: .test
test-node-lts:
desc: Run all tests using node-lts (future)
cmds:
# switch to node-lts
- bash -c 'asdf local nodejs latest:$(asdf nodejs resolve lts) latest:18'
- task: .test
- node --version
# restore implicit node version
- bash -c 'asdf local nodejs latest:18 latest:$(asdf nodejs resolve lts)'
test-with-ee:
desc: Run only ee tests
deps:
- setup
cmds:
- >
source {{.VIRTUAL_ENV}}/bin/activate &&
bash -c 'npm run test-with-ee'
interactive: true
test-without-ee:
desc: Run only non-ee tests
deps:
- setup
cmds:
- >
source {{.VIRTUAL_ENV}}/bin/activate &&
bash -c 'npm run test-without-ee'
interactive: true
package:
desc: Package extension
deps:
- build
sources:
- docs/changelog.md
- docs/README.md
- package*.json
- out/**/*.*
generates:
- "*.vsix"
cmds:
- rm -f *.tgz
- bash -c 'npm pack'
silent: false
pr:
desc: Opens a pull request using gh
deps:
- lint
cmds:
- gh pr create
interactive: true
release:
desc: Create a new release (used by CI)
deps:
- setup
cmds:
- ./tools/release.sh
interactive: true