Skip to content

Commit 4dda5bd

Browse files
committed
feat: Compile Examples during CI
1 parent dd0f1ab commit 4dda5bd

File tree

4 files changed

+197
-1
lines changed

4 files changed

+197
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.205.2/containers/docker-existing-dockerfile
3+
{
4+
"name": "Arduino Development Environment Dockerfile",
5+
6+
// Sets the run context to one level up instead of the .devcontainer folder.
7+
"context": "..",
8+
9+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
10+
"dockerFile": "../.github/actions/run-tests-in-container/Dockerfile",
11+
12+
// Set *default* container specific settings.json values on container create.
13+
"settings": {},
14+
15+
// Add the IDs of extensions you want installed when the container is created.
16+
"extensions": [
17+
"ms-vscode.cpptools",
18+
],
19+
20+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
21+
// "forwardPorts": [],
22+
// Uncomment the next line to run commands after the container is created - for example installing curl.
23+
// "postCreateCommand": "apt-get update && apt-get install -y curl",
24+
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
25+
// "runArgs": [
26+
// "--device=/dev/bus/usb/"
27+
// ],
28+
29+
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
30+
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
31+
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
32+
// "remoteUser": "blues"
33+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Copyright 2022 Blues Inc. All rights reserved.
2+
# Use of this source code is governed by licenses granted by the
3+
# copyright holder including that found in the LICENSE file.
4+
5+
# Build development environment
6+
# docker build --file Dockerfile.arduino-cli --tag arduino-buildpack .
7+
8+
# Launch development environment
9+
# docker run --entrypoint bash --interactive --rm --tty --volume "$(pwd)":/host-volume/ --workdir /host-volume/ arduino-buildpack
10+
11+
# Define global arguments
12+
ARG DEBIAN_FRONTEND="noninteractive"
13+
ARG UID=1000
14+
ARG USER="blues"
15+
16+
# POSIX compatible (Linux/Unix) base image
17+
FROM debian:stable-slim
18+
19+
# Import global arguments
20+
ARG DEBIAN_FRONTEND
21+
# ARG UID
22+
# ARG USER
23+
24+
# Define local arguments
25+
# ARG ARDUINO_CLI_CHECKSUM="068f0a69ffecd5688e0b4bc02609720af57ec1aa60e5ea6a2879af3ed1dc0d9b"
26+
ARG ARDUINO_CLI_VERSION=0.21.1
27+
ARG BINDIR=/usr/local/bin
28+
ARG ECHO_BC_FILE='$bcfile'
29+
30+
# Define environment variables
31+
ENV ARDUINO_UPDATER_ENABLE_NOTIFICATION=false
32+
33+
# Create Non-Root User
34+
# RUN ["dash", "-c", "\
35+
# addgroup \
36+
# --gid ${UID} \
37+
# \"${USER}\" \
38+
# && adduser \
39+
# --disabled-password \
40+
# --gecos \"\" \
41+
# --ingroup \"${USER}\" \
42+
# --uid ${UID} \
43+
# \"${USER}\" \
44+
# && usermod \
45+
# --append \
46+
# --groups \"dialout,plugdev\" \
47+
# \"${USER}\" \
48+
# "]
49+
50+
# Establish development environment
51+
RUN ["dash", "-c", "\
52+
apt-get update --quiet \
53+
&& apt-get install --assume-yes --no-install-recommends --quiet \
54+
bash \
55+
ca-certificates \
56+
curl \
57+
python-is-python3 \
58+
python3 \
59+
python3-pip \
60+
ssh \
61+
&& pip install \
62+
pyserial \
63+
&& apt-get clean \
64+
&& apt-get purge \
65+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
66+
"]
67+
68+
# Download/Install Arduino CLI
69+
RUN ["dash", "-c", "\
70+
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=${BINDIR} sh -s ${ARDUINO_CLI_VERSION} \
71+
# && arduino-cli completion bash > /usr/share/bash-completion/completions/arduino-cli.sh \
72+
&& mkdir -p /etc/bash_completion.d/ \
73+
&& arduino-cli completion bash > /etc/bash_completion.d/arduino-cli.sh \
74+
&& echo >> /etc/bash.bashrc \
75+
# && echo \"for bcfile in /usr/share/bash-completion/completions/* ; do\" >> /etc/bash.bashrc \
76+
# && echo \"for bcfile in /etc/bash_completion.d/* ; do\" >> /etc/bash.bashrc \
77+
# && echo \" [ -f \\\"${ECHO_BC_FILE}\\\" ] && . \\\"${ECHO_BC_FILE}\\\"\" >> /etc/bash.bashrc \
78+
# && echo \"done\" >> /etc/bash.bashrc \
79+
"]
80+
81+
# Configure Arduino CLI
82+
# USER ${USER}
83+
RUN ["dash", "-c", "\
84+
arduino-cli config init \
85+
&& arduino-cli config add board_manager.additional_urls \
86+
https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json \
87+
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json \
88+
https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/main/package_sparkfun_apollo3_index.json \
89+
https://raw.githubusercontent.com/adafruit/arduino-board-index/gh-pages/package_adafruit_index.json \
90+
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json \
91+
&& arduino-cli core update-index \
92+
&& arduino-cli core install arduino:avr \
93+
&& arduino-cli core install arduino:mbed_nano \
94+
&& arduino-cli core install arduino:samd \
95+
&& arduino-cli core install STMicroelectronics:stm32 \
96+
&& arduino-cli core install esp32:esp32 \
97+
&& arduino-cli core install SparkFun:apollo3 \
98+
&& arduino-cli core install adafruit:nrf52 \
99+
&& arduino-cli core install adafruit:samd \
100+
&& arduino-cli core install rp2040:rp2040 \
101+
&& arduino-cli lib install \"Blues Wireless Notecard\" \
102+
&& arduino-cli lib install \"Adafruit BME680 Library\" \
103+
"]
104+
105+
# Set Execution Environment
106+
# WORKDIR /host-volume
107+
108+
ENTRYPOINT ["arduino-cli"]
109+
110+
CMD ["help"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Compile Examples'
2+
author: 'Zachary J. Fields'
3+
description: 'Validate examples by compiling for supported platforms'
4+
runs:
5+
using: 'docker'
6+
image: 'Dockerfile'
7+
entrypoint: arduino-cli
8+
args:
9+
- compile
10+
- --build-property
11+
- build.extra_flags=-Werror
12+
- --fqbn
13+
- ${{ inputs.fully-qualified-board-name }}
14+
- --warnings
15+
- all
16+
- ${{ inputs.example-sketch }}

.github/workflows/note-arduino-ci.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ master ]
88

99
jobs:
10-
validate_code: # job id
10+
validate_library: # job id
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout Code
@@ -26,3 +26,40 @@ jobs:
2626
uses: coverallsapp/github-action@master
2727
with:
2828
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
validate_examples: # job id
30+
runs-on: ubuntu-latest
31+
continue-on-error: true
32+
strategy:
33+
matrix:
34+
example-sketch:
35+
- ./examples/Example0_LibrarylessCommunication/Example0_LibrarylessCommunication.ino
36+
- ./examples/Example1_NotecardBasics/Example1_NotecardBasics.ino
37+
# - ./examples/Example2_PeriodicCommunications/Example2_PeriodicCommunications.ino
38+
- ./examples/Example3_InboundPolling/Example3_InboundPolling.ino
39+
- ./examples/Example4_InboundInterrupts/Example4_InboundInterrupts.ino
40+
- ./examples/Example5_UsingTemplates/Example5_UsingTemplates.ino
41+
# - ./examples/Example6_SensorTutorial/Example6_SensorTutorial.ino
42+
- ./examples/Example7_PowerControl/Example7_PowerControl.ino
43+
fully-qualified-board-name:
44+
# - STMicroelectronics:stm32:BluesW:pnum=SWAN_R5
45+
- esp32:esp32:featheresp32
46+
# - adafruit:samd:adafruit_feather_m4
47+
# - STMicroelectronics:stm32:GenF4:pnum=FEATHER_F405
48+
- arduino:mbed_nano:nano33ble
49+
- SparkFun:apollo3:sfe_artemis_thing_plus
50+
# - STMicroelectronics:stm32:Disco:pnum=B_G431B_ESC1
51+
# - STMicroelectronics:stm32:Nucleo_32:pnum=NUCLEO_F031K6
52+
- rp2040:rp2040:rpipico
53+
# - arduino:avr:mega
54+
steps:
55+
- name: Checkout Code
56+
id: checkout
57+
uses: actions/checkout@v2
58+
with:
59+
submodules: true
60+
- name: Compile Examples
61+
id: compile_examples
62+
uses: ./.github/actions/compile-examples
63+
with:
64+
example-sketch: ${{ matrix.example-sketch }}
65+
fully-qualified-board-name: ${{ matrix.fully-qualified-board-name }}

0 commit comments

Comments
 (0)