Skip to content

Publish Docker

Publish Docker #64

name: Publish Docker
on:
push:
branches:
- saga
schedule:
- cron: "0 0 * * *"
jobs:
build:
strategy:
matrix:
ncs_branch:
- v2.0-branch
include:
# Defaults
- ZEPHYR_TOOLCHAIN_VERSION: 0.16.0
ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: xz
# Removed in v1.9
asset_tracker: disable
asset_tracker_v2: enable
# - ncs_branch: v2.4-branch
# - ncs_branch: v2.3-branch
# ZEPHYR_TOOLCHAIN_VERSION: 0.15.2
# ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
# - ncs_branch: v2.2-branch
# ZEPHYR_TOOLCHAIN_VERSION: 0.15.1
# ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
# - ncs_branch: v2.1-branch
# ZEPHYR_TOOLCHAIN_VERSION: 0.14.1
# ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
- ncs_branch: v2.0-branch
ZEPHYR_TOOLCHAIN_VERSION: 0.14.1
ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
# - ncs_branch: v1.9-branch
# ZEPHYR_TOOLCHAIN_VERSION: 0.14.1
# ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
# - ncs_branch: v1.8-branch
# ZEPHYR_TOOLCHAIN_VERSION: 0.14.1
# ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
# asset_tracker: enable
# - ncs_branch: v1.7-branch
# ZEPHYR_TOOLCHAIN_VERSION: 0.14.1
# ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
# asset_tracker: enable
# - ncs_branch: v1.6-branch
# ZEPHYR_TOOLCHAIN_VERSION: 0.14.1
# ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
# asset_tracker: enable
# - ncs_branch: v1.5-branch
# ZEPHYR_TOOLCHAIN_VERSION: 0.14.1
# ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz
# # asset_tracker_v2 needs configuration in 1.5
# asset_tracker_v2: disable
# asset_tracker: enable
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build image
run: |
docker build -t cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }} \
--build-arg sdk_nrf_revision=${{ matrix.ncs_branch }} \
--build-arg ZEPHYR_TOOLCHAIN_VERSION=${{ matrix.ZEPHYR_TOOLCHAIN_VERSION }} \
--build-arg ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT=${{ matrix.ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT }} \
.
- name: Build asset_tracker application
if: matrix.asset_tracker != 'disable'
run: |
docker run --rm \
-v ${PWD}:/workdir/project \
-w /workdir/nrf/applications/asset_tracker \
cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }} \
west build -b nrf9160dk_nrf9160ns --build-dir /workdir/project/build -- -DEXTRA_CFLAGS="-Werror -Wno-dev"
- uses: actions/upload-artifact@v3
if: matrix.asset_tracker != 'disable'
with:
if-no-files-found: error
name: asset_tracker-${{ matrix.ncs_branch }}
path: |
build/zephyr/merged.hex
build/zephyr/app_update.bin
- name: Build asset_tracker_v2 application
if: matrix.asset_tracker_v2 != 'disable'
run: |
docker run --rm \
-v ${PWD}:/workdir/project \
-w /workdir/nrf/applications/asset_tracker_v2 \
cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }} \
west build -b nrf9160dk_nrf9160ns --build-dir /workdir/project/build -- -DEXTRA_CFLAGS="-Werror -Wno-dev"
- uses: actions/upload-artifact@v3
if: matrix.asset_tracker_v2 != 'disable'
with:
if-no-files-found: error
name: asset_tracker_v2-${{ matrix.ncs_branch }}
path: |
build/zephyr/merged.hex
build/zephyr/app_update.bin
- name: Ensure nrfutil works
run: |
docker run --rm cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }} nrfutil version
- name: Ensure nrfjprog works
run: |
docker run --rm cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }} nrfjprog -v
- name: Ensure clang-format works
run: |
docker run --rm cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }} clang-format --version
- name: Login to Github Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Tag image
run: |
docker tag cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }} ghcr.io/cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }}
- name: Push image
run: |
docker push ghcr.io/cubepilot/nrfconnect-sdk:${{ matrix.ncs_branch }}