Skip to content

Commit

Permalink
Add experimental taskfile for running build commands
Browse files Browse the repository at this point in the history
This does not make `task` an official tool for our project, it adds
a config file with most commands, so we can evaluate how well it
works for us and if it can address some of the confusions we had
with package.json and tox.ini, as both were quite limited.
  • Loading branch information
ssbarnea committed Jun 2, 2022
1 parent bd83d85 commit 1ac02cc
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 73 deletions.
2 changes: 2 additions & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ autoupdate
backticks
bashate
cfgs
cmds
codespell
commitlint
copyfiles
Expand All @@ -31,6 +32,7 @@ pyparsing
reindent
reindented
suboptions
taskfile
testorg
tsbuildinfo
unstash
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ jobs:
- name: Checkout vscode-ansible
uses: actions/checkout@v2

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

# ~400mb, caching them should speedup test-ui execution
- name: Enable test-resources caching
uses: actions/cache@v3
Expand All @@ -92,11 +98,8 @@ jobs:
with:
node-version: 16

- name: Run ./tools/test-setup.sh

run: |
./tools/test-setup.sh
shell: bash
- name: Run task setup
run: task setup

- name: Checkout ansible-language-server
if: ${{ matrix.devel }}
Expand Down Expand Up @@ -131,14 +134,12 @@ jobs:

- name: Build and package extension with released ansible-language-server
if: ${{ matrix.devel == false }}
run: |
npm run compile
npm run package
run: task package

- name: Run ${{ matrix.npm-target }}
uses: GabrielBB/[email protected]
with:
run: npm run ${{ matrix.npm-target }}
run: task ${{ matrix.npm-target }}

- name: Publish vsix artifact
if: ${{ github.event.number && matrix.upload-artifact }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ test-resources-oldest
.vscode-test
CHANGELOG.html
*.tgz
.task
117 changes: 117 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# see https://taskfile.dev/#/
version: "3"
output: group
vars:
VERSION:
sh: node -p "require('./package.json').version"
tasks:
default:
desc: Run most commands
deps:
- lint
- package
cmds:
- echo Done {{.VERSION}}!
setup:
desc: Install dependencies
cmds:
- bash ./tools/test-setup.sh
- python3 -m pip install --user pre-commit
- npm ci
sources:
- bash tools/test-setup.sh
- package.json
- package-lock.json
build:
desc: Build the project
deps:
- setup
cmds:
- npm run compile && sleep 1
sources:
- package-lock.json
- package.json
- src/
- tsconfig.json
- webpack.config.js
code:
desc: Forced install of extension in your code instance
deps:
- package
cmds:
- npm run package && code --force --install-extension *.vsix
deps:
desc: Update dependencies
deps:
- setup
cmds:
- python3 -m pre_commit autoupdate
# 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:
PRE_COMMIT_COLOR: always
cmds:
- python3 -m pre_commit run -a
silent: true
sources:
- "*.*"
- .config
- .github
- .vscode
- doc
- examples
- images
- src
- syntaxes
- test
- tools
test:
desc: Run all tests
deps:
- test-ui
- test-e2e
interactive: true
test-e2e:
desc: Run e2e tests
deps:
- setup
cmds:
- npm run test-e2e
interactive: true
test-ui:
desc: Run UI tests
deps:
- setup
cmds:
- npm run test-ui-current
- npm run test-ui-oldest
interactive: true
package:
desc: Package extension
deps:
- build
sources:
- CHANGELOG.md
- README.md
- package*.json
- out/
generates:
- "*.vsix"
cmds:
- rm -f *.vsix
# --pre-release not supported until we do VS Code >=1.63
- npx vsce package --no-git-tag-version --no-update-package-json {{.VERSION}}-next-1
silent: true
pr:
desc: Opens a pull request using gh
deps:
- lint
cmds:
- gh pr create
interactive: true
13 changes: 8 additions & 5 deletions doc/development.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Development

To ease local development and testing, we use
[tox](https://github.com/ansible/devtools/wiki/tox) but you can also call npm
directly if you want.
[taskfile.dev](https://taskfile.dev/) but you can also call npm directly for
most commands if you want.

To see all the commands available, run `task -l` and it will list all of them
along with their descriptions.

## Running & debugging the extension locally

There are multiple ways to run this extension in debug mode, depending on your
needs and setup. To run the default test suite, just run `tox`.
needs and setup. To run the default test suite, just run `task`.

### Debug with language server from _npm_

Expand All @@ -17,7 +20,7 @@ JavaScript files under `out/server/src` and set breakpoints in them.

To run in this mode, you should first ensure that your code is compiled by
running `npm run compile`. Then you may either launch the **Client + Server**
configuration, or just **Launch Extension**.
configuration or just **Launch Extension**.

### Debug with local language server source code

Expand Down Expand Up @@ -54,7 +57,7 @@ The current link to edit the extension presence on the marketplace is
## Package extension

```shell
tox -e packaging
task package
```

## Release and publication of extension
Expand Down
59 changes: 0 additions & 59 deletions tox.ini

This file was deleted.

0 comments on commit 1ac02cc

Please sign in to comment.