Skip to content

Ci cd dockertest #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
container: Dockerfile
env:
CMAKE_PREFIX_PATH: /opt/toolchains
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: example-application

- name: Initialize
working-directory: example-application
run: |
west init -l .
west update

- name: Build firmware
working-directory: example-application
run: |
west build -b arduino_nano_33_ble samples/blinky_arduino

- name: Twister Tests
working-directory: example-application
run: |
../zephyr/scripts/twister -G --board-root boards/ --testsuite-root ./tests/

- name: Archive firmware
uses: actions/upload-artifact@v2
with:
name: firmware
path: example-application/build/zephyr/zephyr.*
62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
FROM debian:stable-slim AS base

FROM base AS west

RUN \
apt-get -y update \
&& apt-get -y install --no-install-recommends \
python3 \
python3-pip \
python3-wheel \
&& pip3 install west \
&& apt-get remove -y --purge \
python3-pip \
python3-wheel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

FROM west AS python

ARG ZEPHYR_VERSION=v3.2.0
ENV ZEPHYR_VERSION=${ZEPHYR_VERSION}

RUN \
apt-get -y update \
&& apt-get -y install --no-install-recommends \
git \
python3 \
python3-pip \
python3-wheel \
&& pip3 install \
-r https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/${ZEPHYR_VERSION}/scripts/requirements-base.txt \
&& pip3 install cmake \
&& apt-get remove -y --purge \
python3-pip \
python3-wheel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

FROM python AS sdk

ARG ARCHITECTURE=x86_64
ARG ZEPHYR_SDK_VERSION=0.15.2
ARG ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
ARG TOOLCHAIN=arm-zephyr-eabi

RUN \
export sdk_file_name="zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-$(uname -m)_minimal.tar.gz" \
&& apt-get -y update \
&& apt-get -y install --no-install-recommends \
device-tree-compiler \
git \
ninja-build \
wget \
&& wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/${sdk_file_name}" \
&& mkdir -p ${ZEPHYR_SDK_INSTALL_DIR} && \
tar -xvf ${sdk_file_name} -C ${ZEPHYR_SDK_INSTALL_DIR} --strip-components=1 \
&& ${ZEPHYR_SDK_INSTALL_DIR}/setup.sh -t ${TOOLCHAIN} \
&& rm ${sdk_file_name} \
&& apt-get remove -y --purge \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
13 changes: 13 additions & 0 deletions west.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos

projects:
- name: zephyr
remote: zephyrproject-rtos
revision: main
import: true