Skip to content

Commit 929ec4b

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 83dc2b0 commit 929ec4b

File tree

4 files changed

+373
-0
lines changed

4 files changed

+373
-0
lines changed

.github/workflows/check-taskfiles.yml

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

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Check Go status](https://github.com/arduino/rp2040tools/actions/workflows/check-go-task.yml/badge.svg)](https://github.com/arduino/rp2040tools/actions/workflows/check-go-task.yml)
44
[![Check Markdown status](https://github.com/arduino/rp2040tools/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/rp2040tools/actions/workflows/check-markdown-task.yml)
55
[![Check Prettier Formatting status](https://github.com/arduino/rp2040tools/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/rp2040tools/actions/workflows/check-prettier-formatting-task.yml)
6+
[![Check Taskfiles status](https://github.com/arduino/rp2040tools/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/rp2040tools/actions/workflows/check-taskfiles.yml)
67

78
This repo contains all the tools used by Arduino to upload compiled code to the boards that use the rp2040 processor.
89

0 commit comments

Comments
 (0)