Skip to content

Commit 0c8d37c

Browse files
Add CI workflow to validate Taskfiles
On every push or pull request that affects the repository's Taskfiles, and periodically, validate them against the JSON schema.
1 parent b044e10 commit 0c8d37c

File tree

5 files changed

+586
-0
lines changed

5 files changed

+586
-0
lines changed

Diff for: .github/workflows/check-taskfiles.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md
2+
name: Check Taskfiles
3+
4+
env:
5+
# See: https://github.com/actions/setup-node/#readme
6+
NODE_VERSION: 16.x
7+
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
9+
on:
10+
push:
11+
paths:
12+
- ".github/workflows/check-taskfiles.ya?ml"
13+
- "package.json"
14+
- "package-lock.json"
15+
- "**/Taskfile.ya?ml"
16+
- "**/DistTasks.ya?ml"
17+
pull_request:
18+
paths:
19+
- ".github/workflows/check-taskfiles.ya?ml"
20+
- "package.json"
21+
- "package-lock.json"
22+
- "**/Taskfile.ya?ml"
23+
- "**/DistTasks.ya?ml"
24+
schedule:
25+
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
26+
- cron: "0 8 * * TUE"
27+
workflow_dispatch:
28+
repository_dispatch:
29+
30+
jobs:
31+
validate:
32+
name: Validate ${{ matrix.file }}
33+
runs-on: ubuntu-latest
34+
35+
strategy:
36+
fail-fast: false
37+
38+
matrix:
39+
file:
40+
- ./**/Taskfile.yml
41+
- ./**/DistTasks.yml
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v3
46+
47+
- name: Setup Node.js
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: ${{ env.NODE_VERSION }}
51+
52+
- name: Download JSON schema for Taskfiles
53+
id: download-schema
54+
uses: carlosperate/download-file-action@v1
55+
with:
56+
# See: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json
57+
file-url: https://json.schemastore.org/taskfile.json
58+
location: ${{ runner.temp }}/taskfile-schema
59+
60+
- name: Install JSON schema validator
61+
run: npm install
62+
63+
- name: Validate ${{ matrix.file }}
64+
run: |
65+
# See: https://github.com/ajv-validator/ajv-cli#readme
66+
npx \
67+
--package=ajv-cli \
68+
--package=ajv-formats \
69+
ajv validate \
70+
--all-errors \
71+
--strict=false \
72+
-c ajv-formats \
73+
-s "${{ steps.download-schema.outputs.file-path }}" \
74+
-d "${{ matrix.file }}"

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.old
22
build.sh
33
arduino-language-server*
4+
/node_modules/

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
# Arduino Language Server
44

5+
[![Check Taskfiles status](https://github.com/arduino/arduino-language-server/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/arduino-language-server/actions/workflows/check-taskfiles.yml)
6+
57
The **Arduino Language Server** is the tool that powers the autocompletion of the new [Arduino IDE 2][arduino-ide-repo]. It implements the standard [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) so it can be used with other IDEs as well.
68

79
## Bugs & Issues

0 commit comments

Comments
 (0)