Skip to content

Commit f1ebe3d

Browse files
committed
CI build for the library
Concept taken from T-vK/ESP32-BLE-Keyboard#358
1 parent d687067 commit f1ebe3d

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: ESP32 NimBLE Keyboard CI Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python and install PlatformIO
17+
run: |
18+
python3 -m pip install --upgrade platformio
19+
20+
- name: Build with PlatformIO
21+
run: |
22+
make test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.pio

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
test: ## verify that the library compiles
2+
pio run --project-dir=./test/ci_build --target=clean
3+
pio run --project-dir=./test/ci_build
4+
5+
help:
6+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
7+
8+
.PHONY: test help

test/ci_build/platformio.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[env:esp32dev]
2+
platform = espressif32
3+
board = esp32dev
4+
framework = arduino
5+
lib_ldf_mode = deep+
6+
lib_extra_dirs = ../
7+
lib_deps = ESP32 BLE Keyboard

test/ci_build/src/main.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <Arduino.h>
2+
#include <BleKeyboard.h>
3+
4+
BleKeyboard bleKeyboard("ESP32 Keyboard");
5+
6+
void setup() {
7+
bleKeyboard.begin();
8+
}
9+
10+
void loop() {
11+
if (bleKeyboard.isConnected()) {
12+
bleKeyboard.print("Hello");
13+
}
14+
}

0 commit comments

Comments
 (0)