Files
Nick Cooke f93018e682 fix(ci): add read permissions and pin checkout actions
Add the missing `permissions: contents: read` configuration to workflows
and pin the `actions/checkout` step to a specific commit hash for security
consistency with other Firebase repositories.
2026-07-29 14:30:39 -04:00

129 lines
3.4 KiB
YAML

name: Test after code changes
permissions:
contents: read
on:
workflow_dispatch:
push:
paths:
- '**.c'
- '**.h'
- '**.py'
- '**.sh'
- '**.yml'
- '**.proto'
- '**.mk'
- '**.cmake'
pull_request:
paths:
- '**.c'
- '**.h'
- '**.py'
- '**.sh'
- '**.yml'
- '**.proto'
- '**.mk'
- '**.cmake'
jobs:
smoke_test:
name: Run test suite on Ubuntu 20.04
runs-on: ubuntu-20.04
steps:
- name: Check out code from GitHub
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: nanopb
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install python-is-python3 python3-protobuf protobuf-compiler scons splint valgrind
- name: Run tests
run: |
cd nanopb/tests
scons
test_python2:
name: Test with Python 2 on Ubuntu 20.04
needs: smoke_test
runs-on: ubuntu-20.04
steps:
- name: Check out code from GitHub
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: nanopb
fetch-depth: "0"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install python-protobuf protobuf-compiler scons python-is-python2
- name: Run tests with Python 2
run: |
cd nanopb/tests
scons
test_compilers:
name: Test with gcc & clang on Ubuntu 20.04
needs: smoke_test
runs-on: ubuntu-20.04
steps:
- name: Check out code from GitHub
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: nanopb
fetch-depth: "0"
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install python3-protobuf protobuf-compiler scons
sudo apt-get install clang valgrind splint cmake
sudo apt-get install libstdc++6:i386 libgcc-s1:i386 lib32gcc-9-dev lib32stdc++-9-dev libncurses5:i386 libc6-dbg:i386 libc6-dev:i386 binutils-multiarch
- name: Test with 64-bit GCC
run: |
cd nanopb/tests
rm -rf build
scons CC=gcc CXX=g++ CCFLAGS="-O3"
rm -rf build
scons CC=gcc CXX=g++ CCFLAGS="-Os -flto"
rm -rf build
scons CC=gcc CXX=g++ CCFLAGS="-O1 -DPB_FIELD_32BIT=1"
- name: Test with 32-bit GCC
run: |
cd nanopb/tests
rm -rf build
scons CC=gcc CXX=g++ CCFLAGS="-O3 -m32" LINKFLAGS="-m32"
rm -rf build
scons CC=gcc CXX=g++ CCFLAGS="-Os -flto -m32" LINKFLAGS="-m32"
rm -rf build
scons CC=gcc CXX=g++ CCFLAGS="-O1 -DPB_FIELD_32BIT=1 -m32" LINKFLAGS="-m32"
- name: Test with 64-bit clang
run: |
cd nanopb/tests
rm -rf build
scons CC=clang CXX=clang++ CCFLAGS="-O3"
rm -rf build
scons CC=clang CXX=clang++ CCFLAGS="-Os -DPB_FIELD_32BIT=1"
- name: Test with 32-bit clang
run: |
cd nanopb/tests
rm -rf build
scons CC=clang CXX=clang++ CCFLAGS="-O3 -m32" LINKFLAGS="-m32"
rm -rf build
scons CC=clang CXX=clang++ CCFLAGS="-Os -DPB_FIELD_32BIT=1 -m32" LINKFLAGS="-m32"