diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..ea4b90d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,13 @@ +{ + "name": "nrf-connect:v2.1", + "image": "nordicplayground/nrfconnect-sdk:v2.1-branch", + "features": { + }, + "customizations": { + "vscode": { + "extensions": [ + "nordic-semiconductor.nrf-connect" + ] + } + } +} diff --git a/.github/actions/build/Dockerfile b/.github/actions/build/Dockerfile index 048015c..8f3f60f 100644 --- a/.github/actions/build/Dockerfile +++ b/.github/actions/build/Dockerfile @@ -1,12 +1,4 @@ -FROM debian:bullseye-slim - -RUN apt-get update && \ - apt-get -y install wget tar unzip make clang-format gcc-arm-none-eabi - -RUN cd /opt && \ - wget https://www.nordicsemi.com/-/media/Software-and-other-downloads/SDKs/nRF5/Binaries/nRF5SDK1702d674dde.zip -O nRF5_SDK.zip && \ - unzip nRF5_SDK.zip && \ - mv nRF5_SDK_17.0.2_d674dde nRF5_SDK +FROM nordicplayground/nrfconnect-sdk:v2.1-branch COPY build.sh /build.sh diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 3bd80d2..ff5aa3e 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -1,5 +1,11 @@ name: 'Build' -description: 'Builds b-parasite firmware' +description: 'Builds a nrf-connect sample for b-parasite' +inputs: + sample-dir: + description: 'Sample directory to build' + required: true runs: using: 'docker' image: 'Dockerfile' + args: + - ${{ inputs.sample-dir }} diff --git a/.github/actions/build/build.sh b/.github/actions/build/build.sh index d9decd0..33a6589 100755 --- a/.github/actions/build/build.sh +++ b/.github/actions/build/build.sh @@ -1,10 +1,6 @@ #!/bin/bash set -eux -o pipefail -export SDK_ROOT=/opt/nRF5_SDK -export GNU_INSTALL_ROOT=/usr/bin/ +cd "${GITHUB_WORKSPACE}/${1}" -cd "$GITHUB_WORKSPACE/code/b-parasite" -make clean -make lint -make \ No newline at end of file +west build --build-dir ./build --pristine --board bparasite_nrf52840 \ No newline at end of file diff --git a/.github/workflows/b-parasite.yml b/.github/workflows/b-parasite.yml index 86a9712..0862ab8 100644 --- a/.github/workflows/b-parasite.yml +++ b/.github/workflows/b-parasite.yml @@ -9,9 +9,38 @@ on: jobs: build: runs-on: ubuntu-latest - name: Checks format & builds b-parasite's firmware + name: Checks format & builds samples steps: - name: Checkout - uses: actions/checkout@v2 - - name: Build + uses: actions/checkout@v3 + - name: Run clang-format style check + uses: jidicula/clang-format-action@v4.9.0 + with: + check-path: 'code/nrf-connect' + # Builds and upload blinky.hex. + - name: Build the blinky sample uses: ./.github/actions/build + with: + sample-dir: code/nrf-connect/samples/blinky + - uses: actions/upload-artifact@v3 + with: + name: blinky + path: code/nrf-connect/samples/blinky/build/zephyr/zephyr.hex + # Builds and upload soil_read_loop.hex. + - name: Build the soil_read_loop sample + uses: ./.github/actions/build + with: + sample-dir: code/nrf-connect/samples/soil_read_loop + - uses: actions/upload-artifact@v3 + with: + name: soil_read_loop + path: code/nrf-connect/samples/soil_read_loop/build/zephyr/zephyr.hex + # Builds and upload ble.hex. + - name: Build the ble sample + uses: ./.github/actions/build + with: + sample-dir: code/nrf-connect/samples/ble + - uses: actions/upload-artifact@v3 + with: + name: ble + path: code/nrf-connect/samples/ble/build/zephyr/zephyr.hex \ No newline at end of file diff --git a/code/.clang-format b/code/.clang-format new file mode 100644 index 0000000..0d61ac9 --- /dev/null +++ b/code/.clang-format @@ -0,0 +1,4 @@ +--- + +BasedOnStyle: Google +ColumnLimit: 0