Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2670f2a

Browse files
authored
Merge pull request #215 from per1234/check-general-formatting
Add CI workflow to check general file formatting
2 parents 29684f4 + c1fed7e commit 2670f2a

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

‎.ecrc‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Exclude": [
3+
"LICENSE.txt",
4+
"poetry.lock",
5+
"^internal/rule/schema/schemadata/bindata.go$",
6+
"^internal/rule/schema/testdata/bindata.go$"
7+
]
8+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-general-formatting-task.md
2+
name: Check General Formatting
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
pull_request:
8+
schedule:
9+
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to tools.
10+
- cron: "0 8 * * TUE"
11+
workflow_dispatch:
12+
repository_dispatch:
13+
14+
jobs:
15+
check:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Set environment variables
20+
run: |
21+
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
22+
echo "EC_INSTALL_PATH=${{ runner.temp }}/editorconfig-checker" >> "$GITHUB_ENV"
23+
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Install Task
28+
uses: arduino/setup-task@v1
29+
with:
30+
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
version: 3.x
32+
33+
- name: Download latest editorconfig-checker release binary package
34+
id: download
35+
uses: MrOctopus/download-asset-action@1.0
36+
with:
37+
repository: editorconfig-checker/editorconfig-checker
38+
excludes: prerelease, draft
39+
asset: linux-amd64.tar.gz
40+
target: ${{ env.EC_INSTALL_PATH }}
41+
42+
- name: Install editorconfig-checker
43+
run: |
44+
cd "${{ env.EC_INSTALL_PATH }}"
45+
tar --extract --file="${{ steps.download.outputs.name }}"
46+
# Give the binary a standard name
47+
mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec"
48+
# Add installation to PATH:
49+
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
50+
echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH"
51+
52+
- name: Check formatting
53+
run: task --silent general:check-formatting

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![Check Markdown status](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml)
77
[![Docs Status](https://github.com/arduino/arduino-lint/workflows/Publish%20documentation/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Publish+documentation)
88
[![Codecov](https://codecov.io/gh/arduino/arduino-lint/branch/main/graph/badge.svg?token=nprqPQMbdh)](https://codecov.io/gh/arduino/arduino-lint)
9+
[![Check General Formatting status](https://github.com/arduino/arduino-lint/actions/workflows/check-general-formatting-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-general-formatting-task.yml)
910
[![Check Certificates status](https://github.com/arduino/arduino-lint/actions/workflows/check-certificates.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-certificates.yml)
1011

1112
**Arduino Lint** is a command line tool that checks for common problems in [Arduino](https://www.arduino.cc/) projects:

‎Taskfile.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ tasks:
4444
- task: python:check
4545
- task: docs:check
4646
- task: config:check
47+
- task: general:check-formatting
4748
- task: check-spelling
4849

4950
lint:
@@ -60,6 +61,7 @@ tasks:
6061
cmds:
6162
- task: docs:check-formatting
6263
- task: config:check-formatting
64+
- task: general:check-formatting
6365

6466
format:
6567
desc: Format all files
@@ -312,6 +314,17 @@ tasks:
312314
- npx {{ .PRETTIER }} --write "**/*.{yml,yaml}"
313315
- npx {{ .PRETTIER }} --write "**/*.json"
314316

317+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-general-formatting-task/Taskfile.yml
318+
general:check-formatting:
319+
desc: Check basic formatting style of all files
320+
cmds:
321+
- |
322+
if ! which ec &>/dev/null; then
323+
echo "ec not found or not in PATH. Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation"
324+
exit 1
325+
fi
326+
- ec
327+
315328
check-spelling:
316329
desc: Check for commonly misspelled words
317330
cmds:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /