Skip to content

Commit 4ee8a9b

Browse files
committed
Add Github Actions
1 parent 3c89422 commit 4ee8a9b

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
# we'll add windows-latest later
15+
os: [ubuntu-latest, macos-latest]
16+
17+
steps:
18+
- uses:
19+
- actions/checkout@v2
20+
- carlosperate/arm-none-eabi-gcc-action@v1
21+
22+
- name: Build
23+
shell: bash
24+
run: |
25+
./build.sh

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ set(PICO_SDK_FETCH_FROM_GIT on)
1313
include(cmake/pico_sdk_import.cmake)
1414

1515

16-
# copy it over from cmake/credentials.cmake.example
17-
include(cmake/credentials.cmake)
16+
if(EXISTS cmake/credentials.cmake)
17+
# copy it over from cmake/credentials.cmake.example
18+
include(cmake/credentials.cmake)
19+
else()
20+
message(WARNING "Credentials file not found, using default values!")
21+
set(WIFI_SSID "SSID" CACHE INTERNAL "WiFi SSID for examples")
22+
set(WIFI_PASSWORD "password" CACHE INTERNAL "WiFi password for examples")
23+
endif()
1824

1925
project(pico_w_webserver C CXX ASM)
2026
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

build.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/sh
22

33
if which ninja >/dev/null; then
4-
cmake -B build -G Ninja $1
4+
cmake -B build -G Ninja $1 && \
55
ninja -C build $1
66
else
7-
cmake -B build $1
8-
make -j $(getconf _NPROCESSORS_ONLN) -C build $1
7+
cmake -B build $1 && \
8+
make -j $(getconf _NPROCESSORS_ONLN) -C build $1 && \
99
echo "done. P.S.: Consider installing ninja - it's faster"
1010
fi
11+
exit $?

0 commit comments

Comments
 (0)