Skip to content

Commit 81ce90c

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 7713276 commit 81ce90c

File tree

4 files changed

+475
-0
lines changed

4 files changed

+475
-0
lines changed

.github/workflows/check-taskfiles.yml

Lines changed: 71 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Sync Labels status](https://github.com/arduino/crossbuild/actions/workflows/sync-labels.yml/badge.svg)](https://github.com/arduino/crossbuild/actions/workflows/sync-labels.yml)
44
[![Check Markdown status](https://github.com/arduino/crossbuild/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/crossbuild/actions/workflows/check-markdown-task.yml)
5+
[![Check Taskfiles status](https://github.com/arduino/crossbuild/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/crossbuild/actions/workflows/check-taskfiles.yml)
56

67
This docker container has been created to allow us to easily crosscompile our c++ tools. The idea comes from [multiarch/crossbuild](https://github.com/multiarch/crossbuild), but that container unfortunately is outdated and the apt sources are no longer available.
78

0 commit comments

Comments
 (0)