Skip to content

Commit

Permalink
Add Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
krzmaz committed Sep 14, 2022
1 parent 3c89422 commit 8819e94
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# we'll add windows-latest later
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v2
- uses: carlosperate/arm-none-eabi-gcc-action@v1

- name: Build
shell: bash
run: |
./build.sh
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ set(PICO_SDK_FETCH_FROM_GIT on)
include(cmake/pico_sdk_import.cmake)


# copy it over from cmake/credentials.cmake.example
include(cmake/credentials.cmake)
if(EXISTS cmake/credentials.cmake)
# copy it over from cmake/credentials.cmake.example
include(cmake/credentials.cmake)
else()
message(WARNING "Credentials file not found, using default values!")
set(WIFI_SSID "SSID" CACHE INTERNAL "WiFi SSID for examples")
set(WIFI_PASSWORD "password" CACHE INTERNAL "WiFi password for examples")
endif()

project(pico_w_webserver C CXX ASM)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
Expand Down
7 changes: 4 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/sh

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

0 comments on commit 8819e94

Please sign in to comment.