Skip to content
Draft
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
1 change: 1 addition & 0 deletions nanopb/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/bazel_workspace_support
3 changes: 3 additions & 0 deletions nanopb/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Auto-generated files that don't need human review.
MODULE.bazel.lock linguist-generated=true
extra/requirements_lock.txt linguist-generated=true
35 changes: 35 additions & 0 deletions nanopb/.github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Bazel

on:
workflow_dispatch:
workflow_call:
push:
paths:
- '**bazel**'
pull_request:
paths:
- '**bazel**'

jobs:
build_embedded:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-14]

steps:
- uses: actions/checkout@v4

- name: Mount bazel cache
uses: actions/cache@v2
with:
path: "/home/runner/.cache/bazel"
key: ${{ runner.os }}-bazel

- name: Test
run: |
bazelisk test //...

- name: Build
run: |
bazelisk build //...
157 changes: 157 additions & 0 deletions nanopb/.github/workflows/binary_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: Build binary packages

on:
workflow_dispatch:
workflow_call:
push:
branches:
- 'master'
tags:
- '*'

jobs:
build_linux:
name: Build binary on Ubuntu 20.04
runs-on: ubuntu-20.04

steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
with:
path: nanopb
fetch-depth: "0"

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install dependencies
run: |
python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
python3 -c 'import google.protobuf; print(google.protobuf.__file__)'

- name: Build binary package
run: |
cd nanopb
git clean -dxf
tools/make_linux_package.sh

- name: Fingerprint binary
run: |
openssl sha256 nanopb/dist/*.tar.gz

- name: Upload binary
uses: actions/upload-artifact@v4
with:
path: nanopb/dist/*.tar.gz
name: nanopb-binary-linux

- name: Test binary package
run: |
tar xzf nanopb/dist/*.tar.gz
cd nanopb-*/tests
python3 -m SCons

- name: Test examples
run: |
cd nanopb-*/examples
(cd simple; make; ./simple)
(cd network_server; make)
(cd using_union_messages; make)
(cd cmake_simple; mkdir build; cd build; cmake ..; make)
(cd cmake_relpath; mkdir build; cd build; cmake ..; make)

- name: Run build tests
run: |
cd nanopb-*/build-tests
(cd cmake_with_components; mkdir build; cd build; cmake ..; make)
(cd legacy_cmake_relpath; mkdir build; cd build; cmake ..; make)
(cd legacy_cmake_simple; mkdir build; cd build; cmake ..; make)

build_windows:
name: Build binary on Windows 2019
runs-on: windows-2019

steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
with:
path: nanopb
fetch-depth: "0"

- name: Install dependencies
shell: bash
run: |
python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
python3 -c 'import google.protobuf; print(google.protobuf.__file__)'

- name: Build binary package
shell: bash
run: |
cd nanopb
git clean -dxf
tools/make_windows_package.sh

- name: Fingerprint binary
run: |
openssl sha256 nanopb/dist/*.zip

- name: Upload binary
uses: actions/upload-artifact@v4
with:
path: nanopb/dist/*.zip
name: nanopb-binary-windows

- name: Test binary package
shell: bash
run: |
powershell "Expand-Archive nanopb/dist/*.zip"
ls
cd nanopb-*/nanopb-*/tests
python3 -m SCons

build_macos:
name: Build binary on Mac OS X 14
runs-on: macos-14

steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
with:
path: nanopb
fetch-depth: "0"

- name: Install dependencies
run: |
python3 -m venv venv
venv/bin/python3 -m pip install --upgrade scons protobuf grpcio-tools pyinstaller
venv/bin/python3 -c 'import google.protobuf; print(google.protobuf.__file__)'

- name: Build binary package
run: |
source venv/bin/activate
cd nanopb
git clean -dxf
tools/make_mac_package.sh

- name: Fingerprint binary
run: |
openssl sha256 nanopb/dist/*.tar.gz

- name: Upload binary
uses: actions/upload-artifact@v4
with:
path: nanopb/dist/*.tar.gz
name: nanopb-binary-macos

- name: Test binary package
run: |
tar xzf nanopb/dist/*.tar.gz
cd nanopb-*/tests
../../venv/bin/python3 -m SCons
cd ../examples/simple
make
./simple


18 changes: 4 additions & 14 deletions nanopb/.github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
name: CIFuzz
name: Run CIFuzz fuzz test for 10 minutes
on:
push:
branches:
- master
paths:
- '**.c'
- '**.h'
pull_request:
branches:
- master
paths:
- '**.c'
- '**.h'
workflow_dispatch:
workflow_call:

jobs:
Fuzzing:
Expand All @@ -32,7 +22,7 @@ jobs:
dry-run: false
sanitizer: undefined
- name: Upload Crash
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
Expand Down
71 changes: 71 additions & 0 deletions nanopb/.github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Test CMake-based installation and compilation

on:
workflow_dispatch:
workflow_call:
push:
paths:
- '**CMakeLists**'
- '**cmake**'
pull_request:
paths:
- '**CMakeLists**'
- '**cmake**'

jobs:
build_cmake_linux:
name: CMake on Ubuntu 22.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
python3 -m pip install protobuf grpcio-tools

- name: Build with CMake
run: |
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --install .

- name: Compile example against installed library
run: |
cd examples/simple
nanopb_generator simple.proto
gcc -Wall -Werror -osimple simple.pb.c simple.c -lprotobuf-nanopb -I/usr/local/include/nanopb
./simple

build_cmake_windows:
name: CMake on Windows 2022
runs-on: windows-2022
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install dependencies
run: |
pip install protobuf grpcio-tools

- name: Build with CMake
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Release
cmake --install . --config Release --prefix C:/nanopb-test

- name: Compile example against installed library
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd examples/simple
call C:\nanopb-test\bin\nanopb_generator simple.proto
cl simple.pb.c simple.c /IC:\nanopb-test\include\nanopb C:\nanopb-test\lib\protobuf-nanopb.lib /link /out:simple.exe
simple.exe

6 changes: 6 additions & 0 deletions nanopb/.github/workflows/codeql-buildscript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

sudo apt-get -y update
sudo apt-get -y install python3-protobuf protobuf-compiler #scons splint valgrind
cd examples/simple
make
Loading
Loading