Skip to content

Commit c7340de

Browse files
authored
Merge pull request #59 from per1234/sync-infrastructure
Sync infrastructure assets from upstream "templates"
2 parents 787ab78 + b19f5ba commit c7340de

12 files changed

+166
-28
lines changed

.codespellrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
2+
# See: https://github.com/codespell-project/codespell#using-a-config-file
3+
[codespell]
4+
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
5+
ignore-words-list = ,
6+
skip = ./.git,./.licenses,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock
7+
builtin = clear,informal,en-GB_to_en-US
8+
check-filenames =
9+
check-hidden =

.github/workflows/check-npm-task.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ on:
2626
workflow_dispatch:
2727
repository_dispatch:
2828

29-
permissions:
30-
contents: read
31-
3229
jobs:
3330
run-determination:
3431
runs-on: ubuntu-latest
32+
permissions: {}
3533
outputs:
3634
result: ${{ steps.determination.outputs.result }}
3735
steps:
@@ -54,9 +52,18 @@ jobs:
5452
echo "result=$RESULT" >> $GITHUB_OUTPUT
5553
5654
validate:
55+
name: validate (${{ matrix.project.path }})
5756
needs: run-determination
5857
if: needs.run-determination.outputs.result == 'true'
5958
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
project:
66+
- path: .
6067

6168
steps:
6269
- name: Checkout repository
@@ -74,12 +81,21 @@ jobs:
7481
version: 3.x
7582

7683
- name: Validate package.json
77-
run: task --silent npm:validate
84+
run: task --silent npm:validate PROJECT_PATH="${{ matrix.project.path }}"
7885

7986
check-sync:
87+
name: check-sync (${{ matrix.project.path }})
8088
needs: run-determination
8189
if: needs.run-determination.outputs.result == 'true'
8290
runs-on: ubuntu-latest
91+
permissions:
92+
contents: read
93+
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
project:
98+
- path: .
8399

84100
steps:
85101
- name: Checkout repository
@@ -97,7 +113,7 @@ jobs:
97113
version: 3.x
98114

99115
- name: Install npm dependencies
100-
run: task npm:install-deps
116+
run: task npm:install-deps PROJECT_PATH="${{ matrix.project.path }}"
101117

102118
- name: Check package-lock.json
103-
run: git diff --color --exit-code package-lock.json
119+
run: git diff --color --exit-code "${{ matrix.project.path }}/package-lock.json"

.github/workflows/check-taskfiles.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ on:
2929
jobs:
3030
run-determination:
3131
runs-on: ubuntu-latest
32+
permissions: {}
3233
outputs:
3334
result: ${{ steps.determination.outputs.result }}
3435
steps:
@@ -55,6 +56,8 @@ jobs:
5556
needs: run-determination
5657
if: needs.run-determination.outputs.result == 'true'
5758
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
5861

5962
strategy:
6063
fail-fast: false

.github/workflows/libraries_report-size-deltas.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
jobs:
1515
test:
1616
runs-on: ubuntu-latest
17+
permissions: {}
1718

1819
env:
1920
PYTHON_PROJECT_PATH: ${GITHUB_WORKSPACE}/reportsizedeltas
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md
2+
name: Spell Check
3+
4+
env:
5+
# See: https://github.com/actions/setup-python/tree/main#available-versions-of-python
6+
PYTHON_VERSION: "3.11"
7+
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
9+
on:
10+
create:
11+
push:
12+
pull_request:
13+
schedule:
14+
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates.
15+
- cron: "0 8 * * TUE"
16+
workflow_dispatch:
17+
repository_dispatch:
18+
19+
jobs:
20+
run-determination:
21+
runs-on: ubuntu-latest
22+
permissions: {}
23+
outputs:
24+
result: ${{ steps.determination.outputs.result }}
25+
steps:
26+
- name: Determine if the rest of the workflow should run
27+
id: determination
28+
run: |
29+
RELEASE_BRANCH_REGEX="^refs/heads/v[0-9]+$"
30+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
31+
if [[
32+
"${{ github.event_name }}" != "create" ||
33+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
34+
]]; then
35+
# Run the other jobs.
36+
RESULT="true"
37+
else
38+
# There is no need to run the other jobs.
39+
RESULT="false"
40+
fi
41+
42+
echo "result=$RESULT" >> $GITHUB_OUTPUT
43+
44+
spellcheck:
45+
needs: run-determination
46+
if: needs.run-determination.outputs.result == 'true'
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: Install Python
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: ${{ env.PYTHON_VERSION }}
59+
60+
- name: Install Poetry
61+
run: pip install poetry
62+
63+
- name: Install Task
64+
uses: arduino/setup-task@v1
65+
with:
66+
repo-token: ${{ secrets.GITHUB_TOKEN }}
67+
version: 3.x
68+
69+
- name: Spell check
70+
run: task general:check-spelling

.github/workflows/spell-check.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/sync-labels-npm.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ on:
3030
jobs:
3131
check:
3232
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
3335

3436
steps:
3537
- name: Checkout repository
@@ -65,6 +67,7 @@ jobs:
6567
download:
6668
needs: check
6769
runs-on: ubuntu-latest
70+
permissions: {}
6871

6972
strategy:
7073
matrix:
@@ -92,6 +95,9 @@ jobs:
9295
sync:
9396
needs: download
9497
runs-on: ubuntu-latest
98+
permissions:
99+
contents: read
100+
issues: write
95101

96102
steps:
97103
- name: Set environment variables

.github/workflows/test-integration.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
local-source:
2626
if: github.event_name == 'pull_request'
2727
runs-on: ubuntu-latest
28+
permissions:
29+
pull-requests: write
2830

2931
steps:
3032
- name: Checkout repository

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Check Taskfiles status](https://github.com/arduino/report-size-deltas/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/report-size-deltas/actions/workflows/check-taskfiles.yml)
55
[![Tests](https://github.com/arduino/report-size-deltas/workflows/libraries/report-size-deltas%20workflow/badge.svg)](https://github.com/arduino/report-size-deltas/actions?workflow=libraries/report-size-deltas+workflow)
66
[![Integration Tests](https://github.com/arduino/report-size-deltas/actions/workflows/test-integration.yml/badge.svg)](https://github.com/arduino/report-size-deltas/actions/workflows/test-integration.yml)
7-
[![Spell Check](https://github.com/arduino/report-size-deltas/workflows/Spell%20Check/badge.svg)](https://github.com/arduino/report-size-deltas/actions?workflow=Spell+Check)
7+
[![Spell Check status](https://github.com/arduino/report-size-deltas/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/report-size-deltas/actions/workflows/spell-check-task.yml)
88
[![Sync Labels status](https://github.com/arduino/report-size-deltas/actions/workflows/sync-labels-npm.yml/badge.svg)](https://github.com/arduino/report-size-deltas/actions/workflows/sync-labels-npm.yml)
99
[![codecov](https://codecov.io/gh/arduino/report-size-deltas/branch/master/graph/badge.svg)](https://codecov.io/gh/arduino/report-size-deltas)
1010

Taskfile.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,42 @@ tasks:
1010
desc: Check for problems with the project
1111
deps:
1212
- task: npm:validate
13+
- task: general:check-spelling
1314

15+
fix:
16+
desc: Make automated corrections to the project's files
17+
deps:
18+
- task: general:correct-spelling
19+
20+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
21+
general:check-spelling:
22+
desc: Check for commonly misspelled words
23+
deps:
24+
- task: poetry:install-deps
25+
cmds:
26+
- poetry run codespell
27+
28+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
29+
general:correct-spelling:
30+
desc: Correct commonly misspelled words where possible
31+
deps:
32+
- task: poetry:install-deps
33+
cmds:
34+
- poetry run codespell --write-changes
35+
36+
# Parameter variables:
37+
# - PROJECT_PATH: path of the npm-managed project. Default value: "./"
1438
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
1539
npm:install-deps:
1640
desc: Install dependencies managed by npm
17-
run: once
41+
dir: |
42+
"{{default "./" .PROJECT_PATH}}"
1843
cmds:
1944
- npm install
2045

46+
47+
# Parameter variables:
48+
# - PROJECT_PATH: path of the npm-managed project. Default value: "./"
2149
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-task/Taskfile.yml
2250
npm:validate:
2351
desc: Validate npm configuration files against their JSON schema
@@ -54,7 +82,8 @@ tasks:
5482
STYLELINTRC_SCHEMA_URL: https://json.schemastore.org/stylelintrc.json
5583
STYLELINTRC_SCHEMA_PATH:
5684
sh: task utility:mktemp-file TEMPLATE="stylelintrc-schema-XXXXXXXXXX.json"
57-
INSTANCE_PATH: "**/package.json"
85+
INSTANCE_PATH: >-
86+
{{default "." .PROJECT_PATH}}/package.json
5887
PROJECT_FOLDER:
5988
sh: pwd
6089
WORKING_FOLDER:
@@ -82,6 +111,12 @@ tasks:
82111
-r "{{.STYLELINTRC_SCHEMA_PATH}}" \
83112
-d "{{.PROJECT_FOLDER}}/{{.INSTANCE_PATH}}"
84113
114+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
115+
poetry:install-deps:
116+
desc: Install dependencies managed by Poetry
117+
cmds:
118+
- poetry install --no-root
119+
85120
# Make a temporary file named according to the passed TEMPLATE variable and print the path passed to stdout
86121
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/windows-task/Taskfile.yml
87122
utility:mktemp-file:

etc/codespell-ignore-words-list.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tool.poetry]
2+
name = "arduino/report-size-deltas"
3+
version = "0.0.0"
4+
description = ""
5+
authors = ["Arduino <[email protected]>"]
6+
7+
[tool.poetry.dependencies]
8+
python = "3.11.*"
9+
10+
[tool.poetry.group.dev.dependencies]
11+
codespell = "2.2.5"
12+
13+
[build-system]
14+
requires = ["poetry-core"]
15+
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)