Skip to content

Commit eb68735

Browse files
committed
GH Actions
1 parent 3abd37c commit eb68735

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

.github/workflows/build_examples.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Building
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Set up Python
13+
uses: actions/setup-python@v1
14+
- name: Install dependencies
15+
run: |
16+
python -m pip install --upgrade pip
17+
pip install platformio
18+
- name: Build examples
19+
run: |
20+
chmod +x ./scripts/build_examples.sh
21+
./scripts/build_examples.sh

.github/workflows/cpplint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Linting
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Set up Python
13+
uses: actions/setup-python@v1
14+
- name: Install dependencies
15+
run: |
16+
python -m pip install --upgrade pip
17+
pip install -U cpplint
18+
- name: Linting
19+
run: |
20+
cpplint --repository=. --recursive --linelength=120 --verbose=4 --filter=-build/include,-build/header_guard ./src

scripts/build_examples.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
RED='\033[0;31m'
4+
GREEN='\033[0;32m'
5+
NC='\033[0m'
6+
7+
lines=$(find ./examples/ -maxdepth 1 -mindepth 1 -type d)
8+
retval=0
9+
while read line; do
10+
echo -e "========================== BUILDING $line =========================="
11+
if [[ -e "$line/platformio.ini" ]]
12+
then
13+
output=$(platformio ci --lib="." --project-conf="$line/platformio.ini" $line 2>&1)
14+
else
15+
output=$(platformio ci --lib="." --project-conf="scripts/platformio.ini" $line 2>&1)
16+
fi
17+
if [ $? -ne 0 ]; then
18+
echo "$output"
19+
echo -e "Building $line ${RED}FAILED${NC}"
20+
retval=1
21+
else
22+
echo -e "${GREEN}SUCCESS${NC}"
23+
fi
24+
done <<< "$lines"
25+
26+
exit "$retval"

scripts/cpplint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pip install -U cpplint
2+
cpplint --repository=. --recursive --linelength=120 --verbose=4 --filter=-build/include,-build/header_guard ./src

0 commit comments

Comments
 (0)