Skip to content

Commit c25d861

Browse files
authored
Merge pull request #11 from arduino-libraries/ci
Use GitHub Actions for continuous integration
2 parents 1061658 + 7cc847a commit c25d861

File tree

16 files changed

+271
-49
lines changed

16 files changed

+271
-49
lines changed

.codespellrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See: https://github.com/codespell-project/codespell#using-a-config-file
2+
[codespell]
3+
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
4+
ignore-words-list = ,
5+
check-filenames =
6+
check-hidden =
7+
skip = ./.git

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file
2+
version: 2
3+
4+
updates:
5+
# Configure check for outdated GitHub Actions actions in workflows.
6+
# See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot
7+
- package-ecosystem: github-actions
8+
directory: / # Check the repository's workflows under /.github/workflows/
9+
schedule:
10+
interval: daily

.github/workflows/check-arduino.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Check Arduino
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/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+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Arduino Lint
22+
uses: arduino/arduino-lint-action@v1
23+
with:
24+
compliance: specification
25+
# Change this to "update" once the library is added to the index.
26+
library-manager: submit
27+
# Always use this setting for official repositories. Remove for 3rd party projects.
28+
official: true
29+
project-type: library
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Compile Examples
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/compile-examples.yml"
8+
- "examples/**"
9+
- "src/**"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/compile-examples.yml"
13+
- "examples/**"
14+
- "src/**"
15+
schedule:
16+
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms).
17+
- cron: "0 8 * * TUE"
18+
workflow_dispatch:
19+
repository_dispatch:
20+
21+
jobs:
22+
build:
23+
name: ${{ matrix.board.fqbn }}
24+
runs-on: ubuntu-latest
25+
26+
env:
27+
SKETCHES_REPORTS_PATH: sketches-reports
28+
29+
strategy:
30+
fail-fast: false
31+
32+
matrix:
33+
board:
34+
- fqbn: arduino:avr:nano
35+
platforms: |
36+
- name: arduino:avr
37+
type: ethernet
38+
- fqbn: arduino:avr:mega
39+
platforms: |
40+
- name: arduino:avr
41+
type: ethernet
42+
- fqbn: arduino:avr:leonardo
43+
platforms: |
44+
- name: arduino:avr
45+
type: ethernet
46+
- fqbn: arduino:megaavr:uno2018
47+
platforms: |
48+
- name: arduino:megaavr
49+
type: ethernet
50+
- fqbn: arduino:megaavr:nona4809
51+
platforms: |
52+
- name: arduino:megaavr
53+
type: ethernet
54+
- fqbn: arduino:sam:arduino_due_x_dbg
55+
platforms: |
56+
- name: arduino:sam
57+
type: ethernet
58+
- fqbn: arduino:samd:arduino_zero_edbg
59+
platforms: |
60+
- name: arduino:samd
61+
type: ethernet
62+
- fqbn: arduino:samd:mkrzero
63+
platforms: |
64+
- name: arduino:samd
65+
type: ethernet
66+
- fqbn: arduino:samd:nano_33_iot
67+
platforms: |
68+
- name: arduino:samd
69+
type: ethernet
70+
- fqbn: arduino:mbed_portenta:envie_m4
71+
platforms: |
72+
- name: arduino:mbed_portenta
73+
type: ethernet
74+
- fqbn: arduino:mbed_portenta:envie_m7
75+
platforms: |
76+
- name: arduino:mbed_portenta
77+
type: ethernet
78+
- fqbn: arduino:mbed_nano:nano33ble
79+
platforms: |
80+
- name: arduino:mbed_nano
81+
type: ethernet
82+
- fqbn: arduino:mbed_nano:nanorp2040connect
83+
platforms: |
84+
- name: arduino:mbed_nano
85+
type: ethernet
86+
- fqbn: arduino:samd:mkr1000
87+
platforms: |
88+
- name: arduino:samd
89+
type: wifi101
90+
91+
# make board type-specific customizations to the matrix jobs
92+
include:
93+
- board:
94+
type: ethernet
95+
libraries: |
96+
- name: Ethernet
97+
sketch-paths: |
98+
- examples/Ethernet
99+
- board:
100+
type: wifi101
101+
libraries: |
102+
- name: WiFi101
103+
sketch-paths: |
104+
- examples/WiFi
105+
106+
steps:
107+
- name: Checkout repository
108+
uses: actions/checkout@v2
109+
110+
- name: Compile examples
111+
uses: arduino/compile-sketches@v1
112+
with:
113+
github-token: ${{ secrets.GITHUB_TOKEN }}
114+
fqbn: ${{ matrix.board.fqbn }}
115+
platforms: ${{ matrix.board.platforms }}
116+
libraries: |
117+
# Install the library from the local path.
118+
- source-path: ./
119+
${{ matrix.libraries }}
120+
sketch-paths: |
121+
${{ matrix.sketch-paths }}
122+
enable-deltas-report: true
123+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
124+
125+
- name: Save sketches report as workflow artifact
126+
uses: actions/upload-artifact@v2
127+
with:
128+
if-no-files-found: error
129+
path: ${{ env.SKETCHES_REPORTS_PATH }}
130+
name: ${{ env.SKETCHES_REPORTS_PATH }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Report Size Deltas
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/report-size-deltas.yml"
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+
jobs:
17+
report:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Comment size deltas reports to PRs
21+
uses: arduino/report-size-deltas@v1
22+
with:
23+
# The name of the workflow artifact created by the sketch compilation workflow
24+
sketches-reports-source: sketches-reports

.github/workflows/spell-check.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Spell Check
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/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+
jobs:
14+
spellcheck:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Spell check
22+
uses: codespell-project/actions-codespell@master

MDNS.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ MDNSError_t MDNS::_sendMDNSMessage(uint32_t /*peerAddress*/, uint32_t xid, int t
402402
ptr += slen;
403403
}
404404

405-
// PTR record (for the dns-sd service in general)
405+
// PTR record (for the DNS-SD service in general)
406406
this->_writeDNSName((const uint8_t*)DNS_SD_SERVICE, &ptr, buf,
407407
sizeof(DNSHeader_t), 1);
408408

@@ -783,9 +783,9 @@ MDNSError_t MDNS::_processMDNSQuery()
783783
for (j=0; j<MDNS_MAX_SERVICES_PER_PACKET; j++) {
784784
if (NULL != ptrNames[j] && ptrNamesMatches[j]) {
785785
// only compare the part we have. this is incorrect, but good enough,
786-
// since actual MDNS implementations won't go here anyways, as they
786+
// since actual mDNS implementations won't go here anyways, as they
787787
// should use name compression. This is just so that multiple Arduinos
788-
// running this MDNSResponder code should be able to find each other's
788+
// running this mDNSResponder code should be able to find each other's
789789
// services.
790790
if (ptrLensCmp[j] >= ir)
791791
ptrNamesMatches[j] &= this->_matchStringPart(&ptrNamesCmp[j],
@@ -800,7 +800,7 @@ MDNSError_t MDNS::_processMDNSQuery()
800800
} while (rLen > 0 && rLen <= 128);
801801

802802
// if this matched a name of ours (and there are no characters left), then
803-
// check wether this is an A record query (for our own name) or a PTR record query
803+
// check whether this is an A record query (for our own name) or a PTR record query
804804
// (for one of our services).
805805
// if so, we'll note to send a record
806806
if (i < qCnt)
@@ -982,7 +982,7 @@ MDNSError_t MDNS::_processMDNSQuery()
982982
for (j=0; j<MDNS_MAX_SERVICES_PER_PACKET; j++) {
983983
if (servIPs[j][0] == ptrIPs[i] || servIPs[j][0] == 255) {
984984
// the || part is such a hack, but it will work as long as there's only
985-
// one A record per MDNS packet. fucking DNS name compression.
985+
// one A record per mDNS packet. fucking DNS name compression.
986986
ipAddr = &servIPs[j][1];
987987

988988
break;
@@ -1051,7 +1051,7 @@ void MDNS::run()
10511051
uint8_t i;
10521052
unsigned long now = millis();
10531053

1054-
// first, look for MDNS queries to handle
1054+
// first, look for mDNS queries to handle
10551055
(void)_processMDNSQuery();
10561056

10571057
// are we querying a name or service? if so, should we resend the packet or time out?

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ArduinoMDNS
22

3+
[![Check Arduino status](https://github.com/arduino-libraries/ArduinoMDNS/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoMDNS/actions/workflows/check-arduino.yml)
4+
[![Compile Examples status](https://github.com/arduino-libraries/ArduinoMDNS/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoMDNS/actions/workflows/compile-examples.yml)
5+
[![Spell Check status](https://github.com/arduino-libraries/ArduinoMDNS/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/ArduinoMDNS/actions/workflows/spell-check.yml)
6+
37
mDNS library for Arduino. Based on [@TrippyLighting](https://github.com/TrippyLighting)'s [EthernetBonjour](https://github.com/TrippyLighting/EthernetBonjour) library.
48

59
Supports mDNS (registering services) and DNS-SD (service discovery).

examples/Ethernet/DiscoveringServices/DiscoveringServices.ino

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void setup()
4848

4949
// Initialize the mDNS library. You can now reach or ping this
5050
// Arduino via the host name "arduino.local", provided that your operating
51-
// system is mDNS/Bonjour-enabled (such as MacOS X).
51+
// system is mDNS/Bonjour-enabled (such as macOS).
5252
// Always call this before any other method!
5353
mdns.begin(Ethernet.localIP(), "arduino");
5454

@@ -70,7 +70,7 @@ void loop()
7070
char serviceName[256];
7171
int length = 0;
7272

73-
// read in a service name from the Arduino IDE's serial monitor.
73+
// read in a service name from the Arduino IDE's Serial Monitor.
7474
while (Serial.available()) {
7575
serviceName[length] = Serial.read();
7676
length = (length+1) % 256;
@@ -108,7 +108,7 @@ void loop()
108108
mdns.run();
109109
}
110110

111-
// This function is called when a name is resolved via MDNS/Bonjour. We set
111+
// This function is called when a name is resolved via mDNS/Bonjour. We set
112112
// this up in the setup() function above. The name you give to this callback
113113
// function does not matter at all, but it must take exactly these arguments
114114
// as below.
@@ -159,4 +159,3 @@ void serviceFound(const char* type, MDNSServiceProtocol /*proto*/,
159159
}
160160
}
161161
}
162-

examples/Ethernet/RegisteringServices/RegisteringServices.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ void setup()
4848

4949
// Initialize the mDNS library. You can now reach or ping this
5050
// Arduino via the host name "arduino.local", provided that your operating
51-
// system is mDNS/Bonjour-enabled (such as MacOS X).
51+
// system is mDNS/Bonjour-enabled (such as macOS).
5252
// Always call this before any other method!
5353
mdns.begin(Ethernet.localIP(), "arduino");
5454

5555
// Now let's register the service we're offering (a web service) via mDNS!
5656
// To do so, we call the addServiceRecord() method. The first argument is the
5757
// name of our service instance and its type, separated by a dot. In this
5858
// case, the service type is _http. There are many other service types, use
59-
// google to look up some common ones, but you can also invent your own
59+
// Google to look up some common ones, but you can also invent your own
6060
// service type, like _mycoolservice - As long as your clients know what to
6161
// look for, you're good to go.
6262
// The second argument is the port on which the service is running. This is
@@ -84,16 +84,16 @@ void loop()
8484
// in the browser when you connect.
8585
EthernetClient client = server.available();
8686
if (client) {
87-
// an http request ends with a blank line
87+
// an HTTP request ends with a blank line
8888
bool current_line_is_blank = true;
8989
while (client.connected()) {
9090
if (client.available()) {
9191
char c = client.read();
9292
// if we've gotten to the end of the line (received a newline
93-
// character) and the line is blank, the http request has ended,
93+
// character) and the line is blank, the HTTP request has ended,
9494
// so we can send a reply
9595
if (c == '\n' && current_line_is_blank) {
96-
// send a standard http response header
96+
// send a standard HTTP response header
9797
client.println("HTTP/1.1 200 OK");
9898
client.println("Content-Type: text/html");
9999
client.println();

0 commit comments

Comments
 (0)