Skip to content
Closed

test #2356

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
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
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Nie kopiuj do obrazu niepotrzebnych rzeczy
.git
.github
.gitignore
*.md
*.txt
*.log
*.zip
*.hex
*.bin
build/
dist/
node_modules/
__pycache__/
*.pyc
nRF5_SDK*/
NRF5_SDK*/
sdk/
libs/
tools/
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build firmware (Guardian Beacon)

on:
workflow_dispatch: {}
push:
branches: [ main, guardian-beacon ]
paths-ignore:
- ".github/workflows/docker.yml"
- "README.md"

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

env:
SDK_ZIP_URL: https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip
SDK_DIR: ${{ github.workspace }}/_nrf5sdk
TOOLCHAIN_DIR: /usr

steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive

- name: Mark repo as safe
run: git config --global --add safe.directory "${{ github.workspace }}"

- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake ninja-build build-essential python3 python3-pip \
gcc-arm-none-eabi binutils-arm-none-eabi nodejs npm
# 🔹 instalujemy lv_font_conv do generowania czcionek
sudo npm install -g lv_font_conv
lv_font_conv --version || echo "lv_font_conv zainstalowany"

- name: Download nRF5 SDK 15.3.0
run: |
mkdir -p "$SDK_DIR"
curl -L "$SDK_ZIP_URL" -o /tmp/nrf5sdk.zip
unzip -q /tmp/nrf5sdk.zip -d "$SDK_DIR"
ls -la "$SDK_DIR"

- name: Configure (CMake)
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DARM_NONE_EABI_TOOLCHAIN_PATH="${TOOLCHAIN_DIR}" \
-DNRF5_SDK_PATH="${SDK_DIR}/nRF5_SDK_15.3.0_59ac345" \
-DBUILD_DFU=1 -DBUILD_RESOURCES=1

- name: Build
run: cmake --build build -j"$(nproc)"

- name: Show build outputs
run: |
ls -lh build || true
ls -lh build/*.bin build/*.hex build/*.zip 2>/dev/null || true

- name: Upload firmware artifacts
uses: actions/upload-artifact@v4
with:
name: guardian-firmware
path: |
build/*.bin
build/*.hex
build/*.zip
build/*.out
if-no-files-found: warn
90 changes: 28 additions & 62 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,36 @@
name: Build and push Docker image
name: Build & Push Docker image (GHCR)

on:
push:
branches: [ main ]
branches:
- main
- guardian-beacon
paths:
- 'docker/**'
pull_request:
branches: [ main ]
paths:
- 'docker/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
- 'Dockerfile'
- '.github/workflows/docker.yml'
workflow_dispatch: {}

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-22.04
env:
USERNAME: infinitime
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_LOGIN_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build
tags: |
type=sha
type=raw,value=latest

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v3
with:
context: ./docker/
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache,mode=max

- name: Build
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v3
with:
context: ./docker/
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
builder: ${{ steps.buildx.outputs.name }}
push: false
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache
- name: Checkout
uses: actions/checkout@v4

- name: Prepare lowercase owner
id: prep
run: |
echo "owner_lc=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT

- name: Login to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

- name: Build & Push (GHCR)
run: |
IMAGE="ghcr.io/${{ steps.prep.outputs.owner_lc }}/guardian-beacon:latest"
docker build -t "$IMAGE" .
docker push "$IMAGE"
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Solidna baza z apt: Debian bookworm
FROM debian:bookworm

SHELL ["/bin/bash", "-lc"]

# Narzędzia systemowe + CMake + Ninja + Python + Node (do lvgl fontów)
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates build-essential git wget curl unzip xz-utils \
cmake ninja-build make python3 python3-pip nodejs npm \
&& rm -rf /var/lib/apt/lists/*

# ARM GCC (dokładnie ta wersja, której używa InfiniTime CI)
ENV GCC_ARM_VER=10.3-2021.10
ENV GCC_ARM_DIR=/opt/gcc-arm-none-eabi-${GCC_ARM_VER}
RUN cd /opt && \
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 && \
tar -xf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 && \
rm gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
ENV PATH="${GCC_ARM_DIR}/bin:${PATH}"

# nRF5 SDK 15.3.0 (pakujemy do /opt, nazwa dokładnie jak w CMake)
# Uwaga: jeśli link u Ciebie wymaga logowania, podmień na własne mirror/artefakt.
ENV NRF_SDK_VER=nRF5_SDK_15.3.0_59ac345
ENV NRF5_SDK_PATH=/opt/${NRF_SDK_VER}
RUN cd /opt && \
wget -q --no-check-certificate https://github.com/polaris-embedded/mirrors/releases/download/nrf5sdk/${NRF_SDK_VER}.zip && \
unzip -q ${NRF_SDK_VER}.zip && rm ${NRF_SDK_VER}.zip

# Dodatkowe narzędzia używane przez InfiniTime (DFU, mcuboot imgtool, lv_font_conv)
RUN pip3 install --no-cache-dir adafruit-nrfutil==0.5.3 imgtool==1.10.0 \
&& npm install -g lv_font_conv

# Ścieżki na zewnątrz
ENV ARM_NONE_EABI_TOOLCHAIN_PATH=${GCC_ARM_DIR}
ENV NRF5_SDK_PATH=${NRF5_SDK_PATH}

WORKDIR /src
# Domyślna powłoka przy docker run
CMD ["/bin/bash"]
Loading