Skip to content

Commit e0af7f6

Browse files
authored
Merge pull request #4 from per1234/ci
Use GitHub Actions for continuous integration
2 parents de399a8 + f82b8dc commit e0af7f6

11 files changed

+333
-10
lines changed

.codespellrc

+9
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/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# See: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#about-the-dependabotyml-file
2+
version: 2
3+
4+
updates:
5+
# Configure check for outdated GitHub Actions actions in workflows.
6+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md
7+
# See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
8+
- package-ecosystem: github-actions
9+
directory: / # Check the repository's workflows under /.github/workflows/
10+
schedule:
11+
interval: daily
12+
labels:
13+
- "topic: infrastructure"

.github/workflows/check-arduino.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Check Arduino
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
pull_request:
7+
schedule:
8+
# Run every Tuesday at 8 AM UTC to catch breakage caused by new rules added to Arduino Lint.
9+
- cron: "0 8 * * TUE"
10+
workflow_dispatch:
11+
repository_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v3
23+
24+
- name: Arduino Lint
25+
uses: arduino/arduino-lint-action@v1
26+
with:
27+
compliance: strict
28+
# Change this to "update" once the library is added to the index.
29+
library-manager: submit
30+
# Always use this setting for official repositories. Remove for 3rd party projects.
31+
official: true
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Compile Examples
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/compile-examples.ya?ml"
8+
- "library.properties"
9+
- "examples/**"
10+
- "src/**"
11+
pull_request:
12+
paths:
13+
- ".github/workflows/compile-examples.ya?ml"
14+
- "library.properties"
15+
- "examples/**"
16+
- "src/**"
17+
schedule:
18+
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms).
19+
- cron: "0 8 * * TUE"
20+
workflow_dispatch:
21+
repository_dispatch:
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
build:
28+
name: ${{ matrix.board.fqbn }}
29+
runs-on: ubuntu-latest
30+
31+
env:
32+
SKETCHES_REPORTS_PATH: sketches-reports
33+
34+
strategy:
35+
fail-fast: false
36+
37+
matrix:
38+
board:
39+
- fqbn: arduino:mbed_nicla:nicla_vision
40+
# See: https://github.com/arduino/compile-sketches#platforms
41+
platforms: |
42+
- name: arduino:mbed_nicla
43+
- fqbn: arduino:mbed_portenta:envie_m4
44+
platforms: |
45+
- name: arduino:mbed_portenta
46+
- fqbn: arduino:mbed_portenta:envie_m7
47+
platforms: |
48+
- name: arduino:mbed_portenta
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v3
53+
54+
- name: Compile examples
55+
uses: arduino/compile-sketches@v1
56+
with:
57+
github-token: ${{ secrets.GITHUB_TOKEN }}
58+
fqbn: ${{ matrix.board.fqbn }}
59+
platforms: ${{ matrix.board.platforms }}
60+
libraries: |
61+
# Install the library from the local path.
62+
- source-path: ./
63+
# Additional library dependencies can be listed here.
64+
# See: https://github.com/arduino/compile-sketches#libraries
65+
sketch-paths: |
66+
- examples
67+
enable-deltas-report: true
68+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
69+
70+
- name: Save sketches report as workflow artifact
71+
uses: actions/upload-artifact@v3
72+
with:
73+
if-no-files-found: error
74+
path: ${{ env.SKETCHES_REPORTS_PATH }}
75+
name: ${{ env.SKETCHES_REPORTS_PATH }}
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Report Size Deltas
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/report-size-deltas.ya?ml"
8+
schedule:
9+
# Run at the minimum interval allowed by GitHub Actions.
10+
# Note: GitHub Actions periodically has outages which result in workflow failures.
11+
# In this event, the workflows will start passing again once the service recovers.
12+
- cron: "*/5 * * * *"
13+
workflow_dispatch:
14+
repository_dispatch:
15+
16+
permissions:
17+
pull-requests: write
18+
19+
jobs:
20+
report:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Comment size deltas reports to PRs
24+
uses: arduino/report-size-deltas@v1
25+
with:
26+
# The name of the workflow artifact created by the sketch compilation workflow
27+
sketches-reports-source: sketches-reports

.github/workflows/spell-check.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Spell Check
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
pull_request:
7+
schedule:
8+
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates.
9+
- cron: "0 8 * * TUE"
10+
workflow_dispatch:
11+
repository_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
spellcheck:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v3
23+
24+
- name: Spell check
25+
uses: codespell-project/actions-codespell@master

.github/workflows/sync-labels.yml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md
2+
name: Sync Labels
3+
4+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/sync-labels.ya?ml"
9+
- ".github/label-configuration-files/*.ya?ml"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/sync-labels.ya?ml"
13+
- ".github/label-configuration-files/*.ya?ml"
14+
schedule:
15+
# Run daily at 8 AM UTC to sync with changes to shared label configurations.
16+
- cron: "0 8 * * *"
17+
workflow_dispatch:
18+
repository_dispatch:
19+
20+
env:
21+
CONFIGURATIONS_FOLDER: .github/label-configuration-files
22+
CONFIGURATIONS_ARTIFACT: label-configuration-files
23+
24+
jobs:
25+
check:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v3
31+
32+
- name: Download JSON schema for labels configuration file
33+
id: download-schema
34+
uses: carlosperate/download-file-action@v1
35+
with:
36+
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json
37+
location: ${{ runner.temp }}/label-configuration-schema
38+
39+
- name: Install JSON schema validator
40+
run: |
41+
sudo npm install \
42+
--global \
43+
ajv-cli \
44+
ajv-formats
45+
46+
- name: Validate local labels configuration
47+
run: |
48+
# See: https://github.com/ajv-validator/ajv-cli#readme
49+
ajv validate \
50+
--all-errors \
51+
-c ajv-formats \
52+
-s "${{ steps.download-schema.outputs.file-path }}" \
53+
-d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}"
54+
55+
download:
56+
needs: check
57+
runs-on: ubuntu-latest
58+
59+
strategy:
60+
matrix:
61+
filename:
62+
# Filenames of the shared configurations to apply to the repository in addition to the local configuration.
63+
# https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/sync-labels
64+
- universal.yml
65+
66+
steps:
67+
- name: Download
68+
uses: carlosperate/download-file-action@v1
69+
with:
70+
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }}
71+
72+
- name: Pass configuration files to next job via workflow artifact
73+
uses: actions/upload-artifact@v3
74+
with:
75+
path: |
76+
*.yaml
77+
*.yml
78+
if-no-files-found: error
79+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
80+
81+
sync:
82+
needs: download
83+
runs-on: ubuntu-latest
84+
85+
steps:
86+
- name: Set environment variables
87+
run: |
88+
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
89+
echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV"
90+
91+
- name: Determine whether to dry run
92+
id: dry-run
93+
if: >
94+
github.event_name == 'pull_request' ||
95+
(
96+
(
97+
github.event_name == 'push' ||
98+
github.event_name == 'workflow_dispatch'
99+
) &&
100+
github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
101+
)
102+
run: |
103+
# Use of this flag in the github-label-sync command will cause it to only check the validity of the
104+
# configuration.
105+
echo "::set-output name=flag::--dry-run"
106+
107+
- name: Checkout repository
108+
uses: actions/checkout@v3
109+
110+
- name: Download configuration files artifact
111+
uses: actions/download-artifact@v3
112+
with:
113+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
114+
path: ${{ env.CONFIGURATIONS_FOLDER }}
115+
116+
- name: Remove unneeded artifact
117+
uses: geekyeggo/delete-artifact@v1
118+
with:
119+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
120+
121+
- name: Merge label configuration files
122+
run: |
123+
# Merge all configuration files
124+
shopt -s extglob
125+
cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}"
126+
127+
- name: Install github-label-sync
128+
run: sudo npm install --global github-label-sync
129+
130+
- name: Sync labels
131+
env:
132+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133+
run: |
134+
# See: https://github.com/Financial-Times/github-label-sync
135+
github-label-sync \
136+
--labels "${{ env.MERGED_CONFIGURATION_PATH }}" \
137+
${{ steps.dry-run.outputs.flag }} \
138+
${{ github.repository }}

README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
2-
Library to handle the PMIC (Power Management IC) on the following Arduino boards
3-
4-
- [Arduino Portenta H7](https://docs.arduino.cc/hardware/portenta-h7)
5-
- [Arduino Portenta H7 Lite](https://docs.arduino.cc/hardware/portenta-h7-lite)
6-
- [Arduino Portenta H7 Lite Connected](https://docs.arduino.cc/hardware/portenta-h7-lite-connected)
1+
# Arduino_PF1550
2+
3+
[![Check Arduino status](https://github.com/arduino-libraries/Arduino_PF1550/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_PF1550/actions/workflows/check-arduino.yml)
4+
[![Compile Examples status](https://github.com/REPO_OWNER/REPO_NAME/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/REPO_OWNER/REPO_NAME/actions/workflows/compile-examples.yml)
5+
[![Spell Check status](https://github.com/arduino-libraries/Arduino_PF1550/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_PF1550/actions/workflows/spell-check.yml)
6+
7+
Library to handle the PMIC (Power Management IC) on the following Arduino boards
8+
9+
- [Arduino Portenta H7](https://docs.arduino.cc/hardware/portenta-h7)
10+
- [Arduino Portenta H7 Lite](https://docs.arduino.cc/hardware/portenta-h7-lite)
11+
- [Arduino Portenta H7 Lite Connected](https://docs.arduino.cc/hardware/portenta-h7-lite-connected)
712
- [Arduino Nicla Vision](https://docs.arduino.cc/hardware/nicla-vision)

examples/BasicUsage/BasicUsage.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void setup() {
2020
IEndOfCharge::I_5_mA,
2121
IInputCurrentLimit::I_100_mA);
2222

23-
/* TODO: Clarify if a interrupt event is generated by a rising or falling edge,
23+
/* TODO: Clarify if an interrupt event is generated by a rising or falling edge,
2424
* according to schematic/datasheet it's a open-drain output with a pull-up resistor.
2525
* Probably we need to do the registering with a ISR handler internally in the future
2626
* since the PMIC_INT pin PK0 will not be exposed externally.

src/PF1550/PF1550_Control.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void PF1550_Control::onPMICEvent()
211211
uint8_t int_category;
212212
_io.readRegister(Register::PMIC_INT_CATEGORY, &int_category);
213213

214-
/* Call the appopriate event handler */
214+
/* Call the appropriate event handler */
215215
if(isBitSet(int_category, REG_INT_CATEGORY_CHG_INT_bp )) onChargerEvent ();
216216
if(isBitSet(int_category, REG_INT_CATEGORY_SW1_INT_bp )) onSwitch1Event ();
217217
if(isBitSet(int_category, REG_INT_CATEGORY_SW2_INT_bp )) onSwitch2Event ();

src/PF1550/PF1550_Register.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
enum class Register : uint8_t
3333
{
34-
/* PMIC Register Adresses */
34+
/* PMIC Register Addresses */
3535
PMIC_DEVICE_ID = 0x00,
3636
PMIC_OTP_FLAVOR = 0x01,
3737
PMIC_SILICON_REV = 0x02,
@@ -96,7 +96,7 @@ enum class Register : uint8_t
9696
PMIC_I2C_ADDR = 0x68,
9797
PMIC_RC_16MHZ = 0x6B,
9898
PMIC_KEY1 = 0x6B,
99-
/* Charger Register Adresses */
99+
/* Charger Register Addresses */
100100
CHARGER_CHG_INT = 0x80 + 0x00,
101101
CHARGER_CHG_INT_MASK = 0x80 + 0x02,
102102
CHARGER_CHG_INT_OK = 0x80 + 0x04,

0 commit comments

Comments
 (0)