Skip to content

Commit afa5faa

Browse files
committed
docker ci test
does docker conainer get pulled? Signed-off-by: Dhruva Gole <goledhruva@gmail.com>
1 parent 87eff28 commit afa5faa

File tree

2 files changed

+144
-0
lines changed

2 files changed

+144
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Dev Container
2+
3+
on:
4+
schedule:
5+
- cron: '24 8 * * *'
6+
push:
7+
branches: [ main ]
8+
# Publish semver tags as releases.
9+
tags: [ 'v*.*.*' ]
10+
pull_request:
11+
branches: [ main ]
12+
13+
env:
14+
# Use docker.io for Docker Hub if empty
15+
REGISTRY: ghcr.io
16+
# github.repository as <account>/<repo>
17+
IMAGE_NAME: ${{ github.actor }}/zephyr
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
id-token: write
26+
27+
strategy:
28+
matrix:
29+
arch: [x86_64]
30+
sdk: [0.15.2]
31+
zephyr: [main,v3.2.0]
32+
tool: [
33+
{ prefix: "arm", suffix: "-zephyr-eabi"},
34+
{ prefix: "x86_64", suffix: "-zephyr-elf"},
35+
]
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v3
40+
41+
# https://github.com/marketplace/actions/docker-setup-buildx
42+
- name: Setup Docker buildx
43+
uses: docker/setup-buildx-action@v2
44+
45+
# Login against a Docker registry except on PR
46+
# https://github.com/docker/login-action
47+
- name: Log into registry ${{ env.REGISTRY }}
48+
if: github.event_name != 'pull_request'
49+
uses: docker/login-action@v2
50+
with:
51+
registry: ${{ env.REGISTRY }}
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
# Extract metadata (tags, labels) for Docker
56+
# https://github.com/docker/metadata-action
57+
- name: Extract Docker metadata
58+
id: meta
59+
uses: docker/metadata-action@v4
60+
with:
61+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
62+
63+
# Build and push Docker image with Buildx (don't push on PR)
64+
# https://github.com/docker/build-push-action
65+
- name: Build and push Docker image
66+
id: build-and-push
67+
uses: docker/build-push-action@v3
68+
with:
69+
context: .
70+
push: ${{ github.event_name != 'pull_request' }}
71+
tags: ghcr.io/${{ github.actor }}/gsoc-2022-arduino-core
72+
labels: ${{ steps.meta.outputs.labels }}
73+
build-args: |
74+
ARCHITECTURE=${{ matrix.arch }}
75+
ZEPHYR_SDK_VERSION=${{ matrix.sdk }}
76+
ZEPHYR_VERSION=${{ matrix.zephyr }}
77+
TOOLCHAIN=${{ matrix.tool.prefix }}${{ matrix.tool.suffix }}

Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
FROM debian:stable-slim AS base
2+
3+
FROM base AS west
4+
5+
RUN \
6+
apt-get -y update \
7+
&& apt-get -y install --no-install-recommends \
8+
python3 \
9+
python3-pip \
10+
python3-wheel \
11+
&& pip3 install west \
12+
&& apt-get remove -y --purge \
13+
python3-pip \
14+
python3-wheel \
15+
&& apt-get clean \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
FROM west AS python
19+
20+
ARG ZEPHYR_VERSION=v3.2.0
21+
ENV ZEPHYR_VERSION=${ZEPHYR_VERSION}
22+
23+
RUN \
24+
apt-get -y update \
25+
&& apt-get -y install --no-install-recommends \
26+
git \
27+
python3 \
28+
python3-pip \
29+
python3-wheel \
30+
&& pip3 install \
31+
-r https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/${ZEPHYR_VERSION}/scripts/requirements-base.txt \
32+
&& pip3 install cmake \
33+
&& apt-get remove -y --purge \
34+
python3-pip \
35+
python3-wheel \
36+
&& apt-get clean \
37+
&& rm -rf /var/lib/apt/lists/*
38+
39+
FROM python AS sdk
40+
41+
ARG ARCHITECTURE=x86_64
42+
ARG ZEPHYR_SDK_VERSION=0.15.2
43+
ARG ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
44+
ARG TOOLCHAIN=arm-zephyr-eabi
45+
46+
RUN \
47+
export sdk_file_name="zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-$(uname -m)_minimal.tar.gz" \
48+
&& apt-get -y update \
49+
&& apt-get -y install --no-install-recommends \
50+
device-tree-compiler \
51+
git \
52+
ninja-build \
53+
wget \
54+
&& wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/${sdk_file_name}" \
55+
&& mkdir -p ${ZEPHYR_SDK_INSTALL_DIR} && \
56+
tar -xvf ${sdk_file_name} -C ${ZEPHYR_SDK_INSTALL_DIR} --strip-components=1 \
57+
&& ${ZEPHYR_SDK_INSTALL_DIR}/setup.sh -t ${TOOLCHAIN} \
58+
&& rm ${sdk_file_name} \
59+
&& apt-get remove -y --purge \
60+
wget \
61+
&& apt-get clean \
62+
&& rm -rf /var/lib/apt/lists/*
63+
&& git clone git@github.com:arduino/ArduinoCore-API .ArduinoCore-API
64+
&& sed '/WCharacter.h/ s/./\/\/ &/' .ArduinoCore-API/api/ArduinoAPI.h > .ArduinoCore-API/api/tmpArduinoAPI.h ;
65+
&& mv .ArduinoCore-API/api/tmpArduinoAPI.h .ArduinoCore-API/api/ArduinoAPI.h ;
66+
&& ln -sf ~/.ArduinoCore-API/api cores/arduino/. ;
67+
&& printf '%s\n' "Module Successfully setup...";

0 commit comments

Comments
 (0)